Declares one executable node of a dependent HPC workflow assembled with
slurm_pipeline() and executed with slurm_pipeline_run(). Upstream stage
outputs are passed into downstream stages either via args_from_upstream
(a function mapping the named list of upstream results to a new args_list)
or automatically as a single fan-in task fun(upstream_results) when both
args_list and args_from_upstream are NULL.
Usage
slurm_stage(
name,
fun,
args_list = NULL,
args_from_upstream = NULL,
depends_on = character(),
resources = NULL,
packages = character(),
globals = list(),
seed = NULL,
container_sif = NULL,
container_binds = character(),
modules = character(),
env_vars = list(),
dependency_type = c("afterok", "afterany", "afternotok"),
simplify_upstream = TRUE
)Arguments
- name
Unique stage identifier (letters, digits,
_,-).- fun
Worker function
fun(arg)executed for each task in this stage.- args_list
Optional list (or vector coercible to list) of task inputs for this stage. Required for root stages (stages with empty
depends_on).- args_from_upstream
Optional function
function(upstream_results)returning anargs_listbuilt dynamically from collected upstream stage outputs (named by upstream stage name).- depends_on
Character vector of upstream stage names that must finish before this stage runs. Default
character().- resources
Optional
slurmpilot_resourcesobject (fromresource_spec()orestimate_resources()). IfNULL, a sensible default spec is constructed automatically at runtime fromlength(stage_args).- packages
Character vector of worker packages to attach.
- globals
Named list of helper objects/functions bound to
fun.- seed
Optional integer base seed for independent
L'Ecuyer-CMRGparallel RNG streams.- container_sif
Optional path to Apptainer
.sifimage.- container_binds
Optional character vector of Apptainer
--bindmounts.- modules
Optional character vector of HPC modules to load.
- env_vars
Optional named list/vector of extra environment variables.
- dependency_type
SLURM dependency condition:
"afterok"(default),"afterany", or"afternotok".- simplify_upstream
Logical; passed to
slurm_collect()when collecting upstream stage results for this stage. DefaultTRUE.
