Repository navigation
fix: localize declared path inputs on the instance (#37) - #38
Conversation
The staging script only synced the task's OWN S3 work dir, then ran .command.sh.
But a task's declared `path` inputs usually live elsewhere — produced by an
upstream process, or from a samplesheet / channel (s3://) — so they were never
placed on the instance, and stock nf-core modules ran with missing inputs.
buildStagingScript now takes the task's resolved input map
(task.getInputFilesMap()) and, before running the task, copies each declared
input from its real source URI to ${LOCAL_DIR}/<stageName> so the symlinks
.command.sh creates resolve:
- s3:// sources -> aws s3 cp (--recursive for directory inputs)
- stage names with subdirs are mkdir -p'd first
- non-s3 sources are left to the work-dir sync (unchanged)
Preserves the existing Docker (#30), .exitcode, and `spored complete` (#24)
behavior. Adds Spock coverage for the emitted stage-in commands. 30 tests green.
Bring nf-spawn under the spore.host-wide SemVer + Keep-a-Changelog policy. The release ritual notes nf-spawn's specifics (bump build.gradle version to match the tag — the workflow verifies it). CHANGELOG seeds Unreleased with the #37 input-localization fix from this PR.
|
Filer of #37 here (the aws-microbiome-demo taxprofiler pipeline that surfaced this). Code-review pass — I can't run a full end-to-end validation yet (see the blocker at the bottom), but the approach looks right and directly targets the failure I reported. The fix maps onto the exact failureMy #37 case: the demo's samplesheet sets
Two things only a live run will confirm (the unit tests stub
|
|
@scttfrdmn — this is ready for a real-pipeline check against the taxprofiler demo (aws-microbiome-demo) that surfaced #37. Unit tests cover the generated stage-in, but I can't reproduce a full multi-process pipeline locally, so a run on your env is the real validation. Try it from this branchgit fetch origin fix/37-stage-declared-inputs && git checkout fix/37-stage-declared-inputs
./gradlew installPlugin # builds + installs nf-spawn-0.2.8 into ~/.nextflow/plugins/
# pin the local build in your pipeline's nextflow.config:
# plugins { id '[email protected]' }
# process.executor = 'spawn'
nextflow run <taxprofiler> -profile <...> -work-dir s3://<your-bucket>/workWhat to look for
Two things I'd especially want your eyes on
If it works end-to-end I'll merge; if a class of input still doesn't stage, paste the failing task's staging script + the |
|
Thanks — How the demo installs nf-spawn ( TARGET_NF_SPAWN_VERSION="0.2.8"
NF_SPAWN_PLUGIN_DIR="/opt/nextflow_cache/plugins/nf-spawn-${TARGET_NF_SPAWN_VERSION}"
if [ ! -d "${NF_SPAWN_PLUGIN_DIR}/classes" ]; then
curl -fsSL ".../releases/download/v${VER}/nf-spawn-${VER}.zip" ...
fiIt pulls a release ZIP into The trap: the PR leaves
Cleanest path to a real validation: bump Once that ZIP exists I'll point the demo at it and run the arm64 leg (which doubles as my rehearsal + the benchmark's arm64 leg), then report back specifically: does FASTQC find its staged reads, do the aliased-module stage names line up, and does the |
…0.2.9 Address PR #38 review: keying --recursive on a trailing slash misses an s3:// directory input whose URI has no trailing slash. Detect via Files.isDirectory (trailing slash kept as an unambiguous fast-path + stat-failure fallback). Bump to 0.2.9 + promote CHANGELOG so the demo head node can pull a distinct release ZIP (the baked 0.2.8 install guard would otherwise skip the fix, and @0.2.8 couldn't prove which code ran). Per SemVer (pre-1.0, backward-compatible) this is the right MINOR-equivalent bump; the release workflow verifies the tag matches build.gradle's version.
|
Done — both your points are in, and v0.2.9 is published with the ZIP the demo needs. Release: https://github.com/spore-host/nf-spawn/releases/tag/v0.2.9 → Your one-line change should now be unambiguous: TARGET_NF_SPAWN_VERSION = "0.2.9" # worker_script.py + build_ami.pyThe Your review point (directory detection): fixed. On the two things only a live run confirms — those are exactly what I'm hoping your run answers, and I deliberately didn't try to fake them in unit tests (the stubs prove the emitter, not the identity):
If FASTQC finds its reads and the aliased stage names line up, I'll close #37. If a class of input still doesn't stage (e.g. something not in |
|
Validated against the taxprofiler demo with nf-spawn 0.2.9 (3 small accessions, native arm64/Graviton). Two clear wins and one new blocker: ✅ #38's input staging works. FASTQC's failure moved from the original "Skipping '…raw_1.gz' which didn't exist" (missing input) to a write-permission error on the symlink it creates next to the now-present input. The ✅ Native arm64 container ran. ❌ Next blocker (filed separately as #39). The task now fails with: Root cause (confirmed against the v0.2.9 On the two caveats I flagged earlier:
Happy to re-run the moment #39 lands — same one-line version bump on my end. |
…#42) The declared-input staging from #37/#38 emitted two broken commands so the inputs were never actually copied (silently, since the script runs `set -uo pipefail`, not `-e`): 1. nf-amazon's S3 Path renders `toUri().toString()` with an empty authority (`s3:///bucket/key`, three slashes), so the bucket landed in the path and `aws s3 cp` parsed an empty bucket. normalizeS3Uri() now collapses the leading `s3:///` to `s3://`. 2. The destination single-quoted the literal `${LOCAL_DIR}`, so the shell passed it to `aws` unexpanded — the file would have landed in a dir named `${LOCAL_DIR}`. `${LOCAL_DIR}/` is now kept outside the single quotes (only the stage name is quoted), matching how WORKDIR_S3/AWS_REGION are handled. Also guards each input copy with `|| exit 1` so a failed stage-in fails loud instead of letting the task run with a missing input and fail later with a confusing MissingFileException.
The
spawnexecutor's staging script only didaws s3 sync <the task's own work dir>then ran.command.sh. But a task's declaredpathinputs normally live outside its own work dir — produced by an upstream process, or from a samplesheet /Channel.fromPath(oftens3://). They were never placed on the instance, so stock nf-core modules ran with missing inputs (the FASTQC-can't-find-its-reads symptom in the issue).Change
buildStagingScriptnow takes the task's resolved input map (task.getInputFilesMap()) and, before the task runs, copies each declared input from its real source URI to${LOCAL_DIR}/<stageName>— the name.command.shsymlinks against:s3://sources →aws s3 cp(--recursivefor directory inputs)mkdir -pfirsts3://sources → left to the existing work-dir sync (unchanged)Preserves the existing Docker (#30),
.exitcode, andspored complete(#24) machinery. New Spock tests assert the emitted stage-in commands; 30 tests green.Approach note
This is the targeted form of the issue's option 1/2: it localizes every declared input by source URI (covering cross-task + samplesheet
s3://), spliced into nf-spawn's existing remote staging script. I went this way rather than generating a full Nextflow.command.runbecause nf-amazon's S3 copy strategy isn't a build dep here and.command.runwould also swallow nf-spawn's own Docker/exitcode/complete handling — this keeps those intact while fixing the staging gap.Validation ask
Unit-tested, but I can't run a full multi-process pipeline locally. @filer — could you run this build against the taxprofiler demo (aws-microbiome-demo) that surfaced this? Specifically whether FASTQC now finds its staged reads. Happy to iterate on what the generated stage-in looks like for your inputs.
Closes #37 (pending that validation).