# simtools-run-application ```{eval-rst} .. automodule:: simtools.applications.run_application :members: :exclude-members: main ``` ```{eval-rst} Allows to run several simtools applications with a single configuration file, which includes both the name of the simtools application and the configuration for the application. This application is used for model parameter setting workflows. Strong assumptions are applied on the directory structure for input and output files of applications, for details see the CTAO Simulation Model Parameter Setting `repository `_. .. tip:: Browse the CTAO Simulation Model Parameter Setting `repository `_ for a list of examples and templates for configuration files. For simplified configuration, a placeholder called ``__SETTING_WORKFLOW__`` can be used in the configuration file. This placeholder will be replaced with the directory below ``input`` (example: configuration file is in ``input/LSTN-design/num_gains/019d776b-e24c-741d-bc05-e3f6f7ec77c7/config.yml``, then the placeholder will be replaced with ``LSTN-design/num_gains/019d776b-e24c-741d-bc05-e3f6f7ec77c7``). This will also be the directory for any output generated by the application. Run time environments can be defined in the configuration file using the ``runtime_environment`` block, or in a standalone file passed with ``--runtime_environment_file``. A workflow keeps its runtime in a ``runtime.yml`` beside its ``config.yml``, which is created with the workflow and identifies the simtools image by digest and the simulation-models revision. A workflow must not define both a ``runtime_environment`` block and a ``runtime.yml``. The following example shows a Podman runtime environment: .. code-block:: yaml runtime_environment: image: ghcr.io/gammasim/simtools-prod@sha256:IMAGE_DIGEST environment_file: ./.env container_engine: podman options: - '--arch amd64' The optional ``simulation_models`` block selects the simulation-model repository for all applications in the workflow. ``git_path`` is the path to the Git repository as seen inside the container, and ``git_revision`` is a tag or commit: .. code-block:: yaml runtime_environment: image: ghcr.io/gammasim/simtools-prod@sha256:IMAGE_DIGEST simulation_models: git_path: /repositories/simulation-models git_revision: 1.2.3 Model-source options given on the command line take precedence over the ``simulation_models`` block. For Apptainer, set ``container_engine: apptainer``. simtools uses ``apptainer exec`` and does not pull the image itself, so provide a local SIF file or an Apptainer-supported OCI reference. The ``network`` setting is not supported by Apptainer. If the ``ignore_runtime_environment`` flag is set, the application will run in the current environment, ignoring any definitions in the configuration file. Host ``SIMTOOLS_`` environment settings, including values loaded from ``.env`` or the file selected by ``--env_file``, are passed to container applications. Host model-source paths are mounted read-only and translated to a container path. Other host paths must be accessible in the container. Values already set in the host process take precedence over the file. For local runs, ``--env_file`` is passed to each child application. If the ``overwrite_collection_files`` flag is set, files collected in the optional ``collection`` block of the workflow configuration are allowed to overwrite existing destination files with the same basename. The model-repository configuration and other environment variables are described in :ref:`environment-variables`. **Example** Run the application with the configuration file ``config_file_name``: .. code-block:: console simtools-run-application --config_file config_file_name Run the application with the configuration file ``config_file_name``, but skipping all steps except step 2 and 3 (useful for debugging): .. code-block:: console simtools-run-application --config_file config_file_name --steps 2 3 ``` ## Workflow placeholders and collection Pass a YAML mapping with `--context_file` and override individual entries using repeatable `--replace KEY=VALUE` arguments. Command-line replacements take precedence. The runner supplies `__CONFIG_DIRECTORY__` automatically and resolves placeholders in referenced backend profiles. Unresolved placeholders fail before execution. Resolved execution configuration is saved under the first application output directory's `provenance/` directory. Collection entries can set `write_inventory: true` to write relative source/destination paths and SHA-256 checksums to `inventory.json`. Set `preserve_relative_paths: true` to retain comparison-pair subdirectories rather than flattening filenames. Literal filenames must match uniquely; use explicit glob patterns for multiple pairs. In-place collection records the file without copying it onto itself. ## Command line arguments ```{eval-rst} .. simtools-cli-help:: :application: run_application :no-heading: ```