Paper 1071-2021
Authors
Anand Vyas
Abstract
As more and more organizations have started to adopt DevOps tools and practices, automating systems and services is the norm to achieve accuracy, reliability and avoid any human errors. Many organizations have integrated their SAS® platform with these toolsets to achieve maximum automation. In this paper, we will discuss how we can automate start/stop of SAS® LASR Analytic server by making API calls using PROC HTTP.
Introduction
SAS® LASR Analytic server allows multi-user access to in-memory data. It supports both single machine and distributed computing workloads. This data is consumed by high performance products like SAS® Visual Analytics.
If you administer a SAS® platform with SAS® LASR Analytic server, you might be aware that you need to login to SAS® Visual Analytics Administrator user interface to start the server process. On Linux platform SAS® provides an out-of-the-box startup script “sas.servers” to start and stop SAS® platform services.
Objective
Automate and integrate start/stop of SAS® LASR Analytic servers using “sas.servers” script using PROC HTTP.
Pre-requirements
This code works on/after SAS® Release version 9.4 M6.
You need to have SAS® LASR Analytic server installed and configured at your site
Sudo privileges to SAS® Installer account (e.g. “sas”) to execute shell script as SAS® LASR Administrator account (e.g. “lasradm”) without asking for password
SAS® Installer account (e.g. “sas”) password to copy script files under the SAS® configuration directory
Home directory exists for SAS® LASR Administrator account (e.g. “lasradm”)
All other SAS® services including Mid-Tier should be running
Configuration
Login to SAS® Compute server where SAS® LASR Analytic server context has been configured using Installer account (e.g. “sas”) and navigate to your SAS® configuration directory (e.g. “/<sasconfig-path>/Lev1”)
Download the SAS® program “lasr_ops.sas” and shell script “LASROps.sh” under the configuration directory. Links to GitHub repository are shared below.
Edit the SAS® program “lasr_ops.sas” and provide username and password.
Edit the shell script “LASROps.sh” and updated the SAS® configuration directory path at your site.
By default, log output is pointed to LASR Administrator’s account (e.g. “lasradm”) home directory. You can also redirect the log to any location where the user has access.
If you have the sudo permission correctly configured you can run below commands to start, stop and check status of the LASR servers.
To integrate this batch process into “sas.servers” script you will have to edit out-of-the-box “sas.servers.mid” script. In this script, at the end there is a case statement where you need to add the above command. Replace “/sasconfig/Lev1” path to match at your site.
Note: It’s a good practice to take backup of any out-of-the-box file that you change.
Example below:
By default, status output is written to a text file “lasr_status.txt” under SAS® LASR Administrator account home directory on Linux based system. If you want to run this code on Windows based system you can modify the location to any path where the user has access to write.
Example below:
Full Code
Download the full SAS code and shell script from the below links.
lasr_ops.sas: https://raw.githubusercontent.com/vyasanand/LASROps/master/lasr_ops.sas
LASROps.sh: https://raw.githubusercontent.com/vyasanand/LASROps/master/LASROps.sh
Sample Use Cases
This automation can be useful in SAS environments in scenarios where:
Maintenance
During scheduled maintenance window or system restarts, start/stop of SAS® LASR Analytic servers could be automated using this code.
Environment Monitoring
Proactively monitor status of SAS® LASR Analytic servers.
Auto recover SAS® LASR Analytic servers in case of failure.
Conclusion
This code is an example on how PROC HTTP can be used to automate SAS® LASR Analytic server operations using APIs. There are other ways to automate start/stop LASR servers using PROC LASR procedure or by enabling autoload option on the LASR library.
Using this approach SAS® LASR Analytic server would start in exactly same way as a user would do via user interface. This helps to automatically trigger any add-on properties like “reload-on-restart”, if enabled.
References
HTTP Procedure https://go.documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.5&docsetId=proc&docsetTarget=n0bdg5vmrpyi7jn1pbgbje2atoov.htm&locale=en
The ABCs of PROC HTTP
https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2019/3232-2019.pdf
What’s New in SAS Environment Manager Administration
https://go.documentation.sas.com/?cdcId=bicdc&cdcVersion=9.4&docsetId=evadmfun&docsetTarget=evadmfunwhatsnew26.htm&locale=en#
Contact Information:
Your comments and questions are valued and encouraged. Contact the author at:
Anand Vyas
Thakral One PTE LTD.
Technical Consultant
anand.vyas@thakralone.com
... View more