woom fill#
Fill a Jinja template file with context variables and write it to a destination file.
This command allows you to manually fill template files using the workflow context. The templates are rendered with the same context variables that are available during workflow execution, including task-specific variables, cycle information, and member data.
usage: woom fill [-h] [--task-name TASK_NAME] [--cycle CYCLE]
[--member MEMBER] [--dry-run]
[--log-level {debug,info,warning,error,critical}]
[--log-no-color]
template destination
Positional Arguments#
- template
template file
- destination
output file
Named Arguments#
- --task-name
target task name
- --cycle
target cycle
- --member
target member
- --dry-run, --test
run in fake mode for testing purpose
Default:
False- --log-level
Possible choices: debug, info, warning, error, critical
logging level
Default:
'info'- --log-no-color
suppress colors in console
Default:
False
When to use#
Use this command when you need to:
Generate configuration files before running the workflow
Fill templates outside of the automatic task submission process
Test template rendering with specific context parameters
Create files that depend on workflow context but aren’t part of a task
The [[fill]] section in tasks configuration#
Instead of using this command manually, you can configure templates to be filled automatically during task submission by adding a [[fill]] section to your task configuration. See Tasks configuration specifications for details.
Examples#
Fill a template with default context:
woom fill template.j2 output.txt
Fill a template for a specific task:
woom fill namelist.nml.j2 run/namelist.nml --task-name run_model
Fill a template for a specific cycle and member:
woom fill config.cfg.j2 run/config.cfg --task-name run_model --cycle 2020-01-01T00:00:00 --member 1
By default, task name, cycle and member default to the respective environment variables WOOM_TASK_NAME, WOOM_CYCLE and WOOM_MEMBER.
Test template rendering without writing the file:
woom fill template.j2 output.txt --dry-run