Scatter Work and Reduce Results¶
Use scatter when independent input shards can run as separate jobs. Start with a small pipeline, then adapt a scientific pipeline template.
# Template: replace tool, config, field, and result key with declared public ports.
version: 1
name: batch-analysis
defaults:
backend: local
stages:
- id: batch
tool: section/tool
config: tool.yaml
scatter:
by: input_path
strategy: csv
chunk_size: 100
outputs:
table: output_csv
This is a contract template, not a runnable tool configuration. Supply exactly one
of chunk_size and chunks. Check the installed plugin's input field and reducer
before applying scatter. Independent shards are submitted before waiting on Slurm.
File scatter supports SDF, CSV, TSV, lines, and automatic detection. For path
collections, a Path input receives one path per shard; a list[Path] input can
receive chunks. Keep scatter_manifest.csv and reduced artifact metadata to join
results back to inputs. Do not align independently sorted collections by row number.
Molecular workflows often require pose-level execution followed by ligand-level
selection. Use poses.extract, scatter the pose collection, collect metrics with
results.collect, then apply group_by: ligand and top_n_per_group.
Inspect manifests and failures before treating a reduced table as complete.
See artifacts and built-ins.
Distributed tools (release candidate)¶
For a declared tool such as PhESa, add submission: auto (or array/individual)
to scatter to use the shared distributed execution contract. Ordinary tool configs
can instead enable distribution, with exactly one of chunk_size and chunks.
Do not enable both on one stage. Existing scatter specifications are unchanged.
See the PhESa example.
New distribution-only policies can set legacy_scatter=False to preserve the
previous uncontracted pipeline reduction behavior. Distributed scatter leaves
strategy: auto; the tool owns record parsing and scientific work-unit boundaries.
Slurm execution independence (release candidate)¶
Standalone distributed Slurm jobs submit all chunk arrays (or individual jobs) and an all-done collector before reporting submission success. The collector uses the original parent identity and writes the canonical pooled result directly; there is no local pipeline wrapper or completion monitor. Input preparation can still take time before submission is acknowledged.
Pipelines select a Slurm coordinator when all scientific stages use Slurm. Mixed scientific backends are rejected. Generic built-ins run on the coordinator. The coordinator uses atomic execution-family declarations on shared storage, without accessing the central SQLite registry. CLI/GUI reconciliation imports owned child declarations; no status query performs science or advances the pipeline.
orchestration:
backend: auto
compute:
slurm_partition: coordinator
slurm_time: '2-00:00:00'
slurm_cpus_per_task: 1
sbatch_options: ['--mem=4G']
Coordinator defaults are one node/task/CPU, no inherited GPU requests, and the
scheduler's default memory and wall time. Partition, account and environment are
inherited from the first scientific stage; orchestration.compute overrides them.
Set a wall time covering the entire pipeline. Stage compute settings remain
independent. A foreground pipeline command waits for the remote coordinator;
--detach returns after coordinator acknowledgement. Disconnecting the caller
does not stop remote execution.
Compute nodes must provide Slurm client commands, the required plugin environment, and access to shared run/input paths. Missing prerequisites fail explicitly without falling back to the submitting machine. Interrupted or ambiguous submissions retain their evidence and require reconciliation before retrying. Existing recorded job hierarchies are not rewritten automatically.
GUI submission preparation runs in a short-lived local operation. A preparing
submission phase is not acknowledgement of the complete Slurm graph; the operation
exits after dispatch and never monitors scientific completion. Only acknowledged
submissions have the submitting-machine independence guarantee.