Jinja templates#
These templates are filled with the Input dictionary and the Input environment variables that are generated by the workflow for each task.
The job.sh template#
This template is used by woom.tasks.Task.render_content() to create the job script.
Default
job.sh jinja template#{% block header -%}
#!/bin/bash
# Prolog
set -eo pipefail
on_exit() {
status=$?
echo $status > "$WOOM_SUBMISSION_DIR/job.status"
exit $status
}
trap on_exit EXIT
{% endblock %}
{% block env -%}
{{ task.export_env(params) }}
{% endblock %}
{% block pre_run -%}
# Go to run dir
{{ task.export_run_dir() }}
{% endblock %}
{% block run -%}
# Run the commandline(s)
{{ task.export_commandline() }}
{% endblock %}
{% block post_run -%}
{% if task.artifacts %}
# Check artifacts
{{ task.export_artifacts_checking() }}
{% endif %}
{% endblock %}
The env.sh template#
This template is used by woom.env.EnvConfig.render() to format the environment declaration in The job.sh template.
Default
env.sh jinja template#{% block raw_text -%}
{% if env.raw_text %}
# Raw init env
{{ env.raw_text }}
{% endif %}
{% endblock %}
{% block modules -%}
{% if env.module_load %}
# Environment modules
{% if env.module_setup %}
{{ env.module_setup }}
{% endif %}
{% if env.module_use %}
module use {{ env.module_use }}
{% endif %}
{% if env.module_load %}
module load {{ env.module_load }}
{% endif %}
{% endif %}
{% endblock %}
{% block uv -%}
{% if workflow_dir is defined %}
{% set venv_activate = os.path.join(workflow_dir, ".venv", "bin", "activate") %}
{% if env.uv_venv is true or (env.uv_env is none and os.path.exists(venv_activate)) %}
# UV virtual environment
source {{ venv_activate }}
{% endif %}
{% endif %}
{% endblock %}
{% block env_vars -%}
{% if env.has_vars() %}
# Environment variables
{# forward #}
{% for name in env.vars_forward %}
export {{ name }}="{{ os.environ[name] }}"
{% endfor %}
{# set #}
{% for name, value in env.vars_set.items() %}
export {{ name }}="{{ value|as_str_env }}"
{% endfor %}
{# prepend #}
{% for name, value in env.vars_prepend.items() %}
export {{ name }}={{ value|as_str_env }}{{ os.pathsep }}${{ name }}
{% endfor %}
{# append #}
{% for name, value in env.vars_append.items() %}
export {{ name }}=${{ name }}{{ os.pathsep }}{{ value|as_str_env }}
{% endfor %}
{% endif %}
{% endblock %}
{% block conda -%}
{% if env.conda_activate %}
# Conda
{% if env.conda_setup %}
{{ env.conda_setup }}
{% endif %}
conda activate {{ env.conda_activate }}
{% endif %}
{% endblock %}
{% block custom -%}
{# Custom configuration block #}
{% endblock %}