Monday, November 11, 2024

saspy + SAS® OnDemand for Academics = as if SAS is right there beside you

Lately, I’ve had some downtime and I took the opportunity to finish a tool. This tool uploads code and data to SAS® OnDemand for Academics, executes them as if running locally, and then automatically diagnoses certain errors and returns the results once completed.
usage: run_saspy.py [-h] [-i INPUT_PGM] [-o OUTPUT_DIR [OUTPUT_DIR ...]] [-d DATA_UPLOAD [DATA_UPLOAD ...]] [-p PLAYPEN] [-k KILL]
                    [-c CFGNAME]

It executes SAS code using saspy. ONLY ONE LEVEL FOLDER SUPPORTED!

options:
  -h, --help            show this help message and exit
  -i INPUT_PGM, --input_pgm INPUT_PGM
                        (Required) Name of the SAS file to be executed.
  -o OUTPUT_DIR [OUTPUT_DIR ...], --output_dir OUTPUT_DIR [OUTPUT_DIR ...]
                        Remote directories in the current working folder, which will be created in ~// to save outputs.
  -d DATA_UPLOAD [DATA_UPLOAD ...], --data_upload DATA_UPLOAD [DATA_UPLOAD ...]
                        Local files or directories in the current working folder, which will be uploaded to ~//. NO ABSOLUTE
                        PATH ALLOWED!
  -p PLAYPEN, --playpen PLAYPEN
                        Name of playpen. Default is playpen.
  -k KILL, --kill KILL  (Y/N) Kill the playpen after completion.
  -c CFGNAME, --cfgname CFGNAME
                        Name of the Configuration Definition to use for the SASsession. If not specified then just saspy.SASsession()
                        is executed.

In the test below, I uploaded pgm and data, executed them and downloaded them locally. When all tests completed, it will check log and free up the space by cleaning up all playpen data. In this way, I will not worry about the space any more.

No comments: