Hooks & Adapters
Small Python functions that prepare the environment or collect results.
Where they live
- Under
hooks/in your BRS, importable as modules.
Referencing hooks
- In
template_config.yamlorworkflow_config.yaml: ``` hooks: pre_render:- hooks.prepare:main post_render:
- hooks.prepare:main pre_run:
- hooks.env:init post_run:
- hooks.collect:main ```
- Use
module:functionor justmodule(defaults tomain).
Hook signature
# hooks/env.py
def main(ctx):
# set up environment, validate inputs, etc.
return None
Common patterns
- Modules: load cluster modules or set PATHs.
- Conda/venv: activate environments before running tools.
- Containers: prepare
singularity/dockerinvocations. - Collection: summarize outputs or write auxiliary metadata files.