-
Notifications
You must be signed in to change notification settings - Fork 20
Analysis Scripts
OpenStudio Server Release 2.6.2 introduced initialize and finalize scripts for analyses. If initialize and/or finalize files exist in the specified project structure as defined below, then they will be executed as system calls run by a spawned process with a four hour timeout.
The initialize and finalize scripts are only available for Rails environments where the Rails.application.config.job_manager == :resque
. For most users, this means when OpenStudio Server is run via a Docker deployment or on AWS with an AMI. This functionality is not available for local installs which use delayed_jobs for job management. This functionality is handled by the run_initialization
and run_finalization
methods in the Analysis class.
The scripts are run in a Linux shell. Leveraging this functionality requires Linux scripting.
Analysis initialize and finalize scripts run on the web node as a spawned process. Relevant code is here. The PAT project is unpacked to /mnt/openstudio/analyses/<analysis_id>
. The scripts have access to the following environment variables:
SCRIPT_PATH # dir_path of running script
ANALYSIS_ID
HOST_URL # URL for running server
RAILS_ROOT
ANALYSIS_DIRECTORY #directory that project was unzipped to
Relevant file structure for a PAT project is:
<root of project>/lib/<my additional files>
<root of project>/scripts/analysis/(initialize|finalize).sh
<root of project>/scripts/analysis/(initialize|finalize).args
Initialization and Finalization scripts uploaded via the PAT interface will be created with the appropriate name and directory structure. Similarly, argument files will be created as appropriate when arguments are added via PAT interface. Any additional files uploaded via PAT will be accessible in the lib
directory with the original file name.