Repository navigation
Description
Summary
nf-spawn's staging script only does aws s3 sync <this-task's-own-workDir> <local>. It never runs Nextflow's input localization (.command.run / nxf_stage), so declared path inputs that live anywhere other than the task's own work dir are never placed on the instance. Any process whose inputs are produced by an upstream process, come from Channel.fromPath, or are listed as s3:// paths in a samplesheet will run with its input files missing.
This means stock nf-core modules (which all take staged path inputs) generally can't run under the spawn executor today.
Where it is
SpawnTaskHandler.buildStagingScript() (src/main/groovy/io/nextflow/spawn/SpawnTaskHandler.groovy):
// 1. Stage inputs down from the S3 work dir.
sb << 'aws s3 sync "${WORKDIR_S3}" "${LOCAL_DIR}/" --region "${AWS_REGION}" --quiet\n'WORKDIR_S3 is the task's own work dir (task.workDirStr). The comment says "Stage inputs down from the S3 work dir," but Nextflow does not pre-place a task's declared inputs into its own work dir for a custom executor — input localization is normally emitted by Nextflow into .command.run (nxf_stage()), which copies each declared input (including foreign/cross-task/S3 files) into the work dir at run time. nf-spawn writes its own user-data wrapper that runs .command.sh directly and never invokes that stage-in step. (grep nxf_stage over the repo: 0 hits.)
How it manifests (real run — nf-core/taxprofiler 2.0.0)
A pipeline that fetches FASTQs in one process and feeds them to taxprofiler's FASTQC (input: path reads):
- FASTQC's task work dir on S3 contained only
.command.sh/.command.err/.exitcode— no input FASTQ. .command.shsymlinks the expected basename, which isn't present:ln -s SRR059374_stool_1.fastq.gz SRR059374_stool_..._raw_1.gz fastqc ... SRR059374_stool_..._raw_1.gz → Skipping 'SRR059374_stool_..._raw_1.gz' which didn't exist, or couldn't be read- The upstream producer's outputs were in S3, just under the producer's work-dir prefix — a different prefix than the FASTQC task's work dir, so
aws s3 sync <FASTQC-workdir>never pulls them.
The only process that worked was a hand-written one that does its own aws s3 cp of its inputs inside the script body — i.e. it sidesteps staging entirely. That's the current de-facto requirement, and it's not viable for stock nf-core modules.
Suggested fix
Have the staging script localize declared inputs the way Nextflow's nxf_stage does, before running .command.sh. Options, roughly in order of robustness:
- Emit/run Nextflow's own staging. Let Nextflow generate
.command.run(withnxf_stage) and have the instance execute that instead of a hand-rolled wrapper — so foreign-file copy, symlinks, and stage-in mode all behave exactly as on other executors. - Stage
task.getInputFilesMap()explicitly. InbuildStagingScript, iterate the task's resolved input files andaws s3 cpeach source URI →${LOCAL_DIR}/<stageName>before theaws s3 syncof the work dir. Covers cross-task and samplesheets3://inputs. - At minimum, document that the
spawnexecutor currently requires every process to self-fetch its inputs, since that's a hard constraint today.
Happy to test a fix against the taxprofiler demo that surfaced this (aws-microbiome-demo) — it reproduces reliably with a 2-process fetch→profile pipeline.
Environment
- nf-spawn 0.2.8, spawn 0.45.0, Nextflow 26.04.x, AL2023 arm64 (Graviton),
workDir = s3://…, nf-amazon 2.8.0. - Observed 2026-06-13.
Activity
docs: add CLAUDE.md (SemVer 2.0.0 + Keep a Changelog policy) + CHANGELOG
fix: localize declared path inputs on the instance (#37) (#38)
fix: repair s3:// input URI and expand ${LOCAL_DIR} in stage-in (#41) (…
docs: clarify ext.volumes vs staged path inputs for reference data (#49…
feat: dispatch each task via spawn task run (spawn#386 adapter migrat…