Project Starter Scripts

Project starter scripts are parts of wizards. They are Python scripts that must contain a top-level function named app, taking arguments passed from the front end code. Starter scripts are used to trigger optiSLang project execution from the front end. Arguments to the app function must contain the path to a newly created project directory or an optiSLang project within it. In almost all cases, the project directory must be created beforehand using the /create_working_dir request. Additional arguments can be passed from front end to this function as required.

Additional global variables are always present. Some of them must be provided to the optiSLang starter command:

  • optislang_home: Path to the optiSLang installation

  • projects_dir: Path to the projects directory

  • listener_id: Registers a listener when starting optiSLang

  • listener_port: Listener port number

  • user: Name of the user that ran the script

If optiSLang Web Service is configured for OpenID Connect/OAuth2 based authentication, the access_token global variable is available in the starter script and can be used for forwarding authentication/authorization to applications or APIs called from within the starter script. The access_token variable contains a JSON Web Token (JWT).

Possible return values of project starter scripts are:

  • original_working_dir: Path to the original working directory of the optiSLang project. This is usually the working directory of the project within the projects directory of optiSLang Web Service, created when the wizard was executed. This return value must be provided to let optiSLang Web Service know the location of the project. It can be skipped if the project is started exactly from this location.

  • log_file: Path to an optional log file containing optiSLang project start information and other log messages. The contents of this file are provided to the front end user interface.

  • error_log_file: Path to an optional error log file containing optiSLang project start errors. The contents of this file are provided to the front end user interface and displayed in the project start message box.

  • optislang_start_timeout: Overrides the default timeout for optiSLang start-up when started with this wizard.