Skip to content

Simulation Runner

Overview

The SimRunner is the object responsible for running a simulation, including any associated pre- and post-processing actions.

It operates with:

  • an Execution context: the locations of engine distributions and the runner runtime assets.
  • an Execution configuration: whether the main simulation is launched as a script or a command, which options and arguments are used, the encoding of input files, and which pre- and post-processing actions should be executed.

Runner File Workspace and Context Path Variables

During the runner execution, 4 folders are created:

  • an input files folder: input files (for third parties and scripts)
  • an output files folder, outputs files (from third parties and scripts) (theorically)
  • a log files folder: third parties and scripts logs
  • a temporary folder: for convenience in scripts

Some of context path variables are accessible:

  • for templating in configurations (command, ...) through {} string templating
  • in the pre/main/post scripts if they exists througt environment variables

Those variable are:

  • INPUTS_FOLDER_PATH: the inputs folder
  • OUTPUTS_FOLDER_PATH: the outputs folder
  • TMP_FOLDER_PATH: the temporary folder
  • MAIN_INPUT_PATH: the main input absolute path

Example in a sim_runner_exec_config configuration yaml file:

main_input_file_replace_templates:
  # inputs
  "MESH_FILENAME= ": "MESH_FILENAME= {INPUTS_FOLDER_PATH}/"
Example in a pre script:

INPUTS_FOLDER_PATH   = Path(os.getenv("INPUTS_FOLDER_PATH"))
OUTPUTS_FOLDER_PATH  = Path(os.getenv("OUTPUTS_FOLDER_PATH"))

Sim Runner Configuration

Example of yaml conf file sim_runner_exec_config.yaml:

main:
  type: "command"
  command_template: "ls {INPUTS_FOLDER_PATH}"

post:
  type: "script"

SimRunnerExecConfig

Configuration of the execution plan of a **simulation** with pre / main / post steps.
Field Type Req. Default
main ExecCommandConfig or ExecScriptConfig ✅
input_encoding str or None None
pre ExecScriptConfig or None None
post ExecScriptConfig or None None
environment dict[str, str] or None None
main_input_file_replace_templates dict[str, str] or None None
runtime_folder_path str or None None
distribution_info DistributionInfoConfig or None None
main_inputfile_inputsrelativepath str or None None

main : Main configuration, defining the command or script to run

input_encoding : Encoding used when reading input files

pre : Pre actions configuration

post : Post actions configuration

environment : Dict of environnement variables, context path variables templating could be used

main_input_file_replace_templates : Dict of old/new strings to replace in the main input file of the simulation, context path variables templating could be used

main_inputfile_inputsrelativepath : Default relative main input file. It could be overwritten bu configuration config context if necessary

ExecCommandConfig

Field Type Req. Default
type Literal["command"] "command"
command_template str ✅
cwd Literal["tmp_folder_path", "folder_path", "inputs_folder_path", "outputs_folder_path"] "tmp_folder_path"
environment dict[str, str] or None None
auto_move_outputs bool False

command_template : Command to execute, context path variables templating could be used

cwd : Curent working directory of the command execution

environment : Dict of environnement variables, context path variables templating could be used

auto_move_outputs : Activate the automatic identification and move of output files from inputs to outputs file workspace folders

ExecScriptConfig

Field Type Req. Default
type Literal["script"] "script"
cwd Literal["tmp_folder_path", "folder_path", "inputs_folder_path", "outputs_folder_path"] "outputs_folder_path"
environment dict[str, str] or None None
auto_move_outputs bool False

cwd : Curent working directory of the script execution

environment : Dict of environnement variables, context path variables templating could be used

auto_move_outputs : Activate the automatic identification and move of output files from inputs to outputs file workspace folders

DistributionInfoConfig

Configuration to discover ditribution info in engine manager contex
Field Type Req. Default
method Literal["configfile", "command"] or None "configfile"
command list[str] or None None

method : Method to determine distribution info

command : Command to execute, for json info