kjnh10 / saseg_runner

Run egp file from python
MIT License
10 stars 2 forks source link
python sas-enterprise-guide

PyPI PyPI PyPI PyPI

Overview

saseg_runner get you run egp file from python or command line.

Requirment

Install

pip install saseg_runner

Usage

as python library

from saseg_runner import run_egp, SASEGRuntimeError
run_egp(egp_path='test_success.egp', eg_version='7.1', profile_name='Your Profile')

# opening SAS Enterprise Guide 7.1
# -> application instance created
# activating profile:[SAS Asia]
# -> profile:[SAS Asia] activated
# opening test_success.egp
# -> egp file opened
# running test_success.egp
# -> run finished
# -> saved to test_success_20191031-1102.egp
# getting logs from test_success_20191031-1102.egp
# -> log created
# successfully finished exectuing test_success.egp
# elapsed_time:40[sec]

In case some tasks in the egp file fails, 'run_egp' can raise Exception of SASEGRuntimeError!

from saseg_runner import run_egp, SASEGRuntimeError
run_egp(egp_path='test_fail.egp', eg_version='7.1', profile_name='Your Profile')

# opening SAS Enterprise Guide 7.1
# -> application instance created
# activating profile:[SAS Asia]
# -> profile:[SAS Asia] activated
# opening test_fail.egp
# -> egp file opened
# running test_fail.egp
# -> run finished
# -> saved to test_fail_20191031-1056.egp
# getting logs from test_fail_20191031-1056.egp
# -> log created
# [task 2] failed in test_fail.egp
# ERROR: CLI error occured: [DataDirect][ODBC lib] Specified driver could not be loaded
# Traceback (most recent call last):
#   File "saseg_runner/runner.py", line 123, in <module>
#     run_egp(SCRIPTDIR_PATH.parent.parent / 'test/test_fail.egp')
#   File "saseg_runner/runner.py", line 103, in run_egp
#     raise SASEGRuntimeError
# __main__.SASEGRuntimeError

Parameters

from command line

run_egp <your egp file path>