Repository navigation
Description
Summary
ext.volumes (0.3.0, #45) attaches an EBS volume and mounts it at a fixed path on the task instance. But nf-core pipelines that take a reference DB as a staged path input — i.e. essentially all of them — don't consume data that way: they take a db_path, and Nextflow stages it from the head into each task's work dir. The two mechanisms compete, and ext.volumes can't actually feed such a pipeline.
Concretely, with nf-core/taxprofiler 2.0.0 and a databases.csv whose db_path is the volume mount point (/opt/databases/metaphlan):
- Head-side validation fails first. taxprofiler validates every
db_pathexists on the head node (samplesheetToListvsschema_database.json, in pipeline init — before any task launches). The volume mounts on the task, not the head, so the path doesn't exist there:Entry 2: Error for field 'db_path' (/opt/databases/metaphlan): the file or directory '/opt/databases/metaphlan' does not exist → SchemaValidationException → whole pipeline aborts - Even past validation, db_path is a staged input.
workflows/taxprofiler.nfbranches ondb_path.name.endsWith('.tar.gz')and the profiling subworkflow carriesdbas a path object intoKRAKEN2_KRAKEN2(reads, db)/METAPHLAN_METAPHLAN(…, db)(bothpath db). So Nextflow wants to copy db_path head→task work dir — which conflicts with the volume already mounted at that path.
How I found it (and a false positive to flag)
Migrating the demo's Kraken2 + MetaPhlAn DBs onto EBS volumes (spawn snapshot create + ext.volumes). Kraken2 appeared to work in an earlier run — but that was a false positive: the AMI still had the DB baked at the same path, so it satisfied both the head validation and was physically on the task; Kraken2 read the baked copy and the volume was never actually exercised. MetaPhlAn (no baked copy) is what exposed the incompatibility.
The gap
ext.volumes is great for data a process reads directly from a known mount path (a tool you call yourself, like our hand-rolled FETCH_FASTQ could). It does not work when the pipeline models the data as a declared path input it stages itself — there's no way to tell Nextflow/the module "this input is already present at the mount, don't stage it, and don't fail head-side validation."
Possible directions (raising, not prescribing)
- Docs/guidance: document that
ext.volumessuits self-mounted data, not stagedpathinputs — so people don't try to back an nf-coredb_pathwith it (as I did). - An s3:// db_path path instead: for staged inputs, the thing that does fit is nf-spawn's existing Task instances don't stage Nextflow file inputs (only sync the task's own work dir) — breaks any process with a staged
pathinput #37 input localization — if a pipeline accepts ans3://db_path, nf-spawn alreadyaws s3 cps declared inputs to the task. That sidesteps volumes entirely for DBs (at the cost of staging 16–34 GB per task). Worth documenting as the recommended pattern for staged-input DBs, withext.volumesreserved for self-mounted data. - Head-side presence: validation-style checks that run on the head can't see a task-only mount — inherent to the split. Nothing nf-spawn can do about a pipeline's head-side validation, which is why volumes can't satisfy it.
Context
nf-spawn 0.4.0, spawn 0.50.0, taxprofiler 2.0.0, AL2023 arm64. Not a regression — ext.volumes does what it says; this is about which data-delivery model it fits. Full write-up in the demo repo's docs/ami-vs-data-volume.md. Happy to test a documented pattern or a fix.
Activity
docs: clarify ext.volumes vs staged path inputs for reference data (#49…
scttfrdmn commentedon Jun 14, 2026
Confirmed your analysis end-to-end — and agree it's not a bug:
ext.volumesdoes exactly what it says; this is about which data-delivery model it fits. I checked the code for a possible fix and there isn't a viable one, because both failure points are outside nf-spawn's reach:pathinputs itself (head → task work dir); there's no hook for a module to say "already mounted, skip staging," and the staged copy collides with the mount.So this is documentation. Merged #50, which adds a Delivering reference data section to the README spelling out the two models:
ext.volumes→ data a process reads directly from a fixed mount path (a tool you call with--db /path). Explicitpath/db_pathinput, with the two reasons above.s3://db_path→ the recommended pattern for staged-input DBs (the nf-core norm): nf-spawn's Task instances don't stage Nextflow file inputs (only sync the task's own work dir) — breaks any process with a stagedpathinput #37 localizationaws s3 cps the declared input per-task — no volume, no head-side path — at the cost of the per-task download (16–34 GB), so it suits modest fan-out.Good catch on the Kraken2 false positive too (baked DB at the same path satisfied both head validation and the task) — that's exactly the kind of thing that hides this until a DB without a baked copy (MetaPhlAn) exposes it. I noted it in the PR.
Closing as resolved-by-docs. If you hit a pipeline that takes an
s3://db_pathand the #37 localization misbehaves with a 30 GB DB, open a fresh issue — that path I can fix.scttfrdmn commentedon Jun 14, 2026
Update — the conclusion on this changed for the better. I'd first said volume-backed staged
pathinputs were impossible and to use ans3://db_path(download per task). On a closer trace that was wrong: it's two small, fixable gaps in nf-spawn, not an inherent limit. Fixed in nf-spawn v0.5.0 (#51 / PR #52):pathinput is referenced by its work-dir stage name (taxprofiler's metaphlan doesfind -L metaphlan_db ...). nf-spawn now symlinks that stage name → the localext.volumesmount (the spawn equivalent ofstageInMode=symlink), sofind -Lresolves to the read-only volume — no copy./opt/databases/xinside Docker.The one piece nf-spawn can't do — the head-side
existscheck — you cover by attaching the same read-only snapshot on the head node at the same path. Validation passes, no pipeline fork. (Read-only data replicates freely: attach the one snapshot to head + every task.)So the full pattern is now:
spawn snapshot createonce → attach read-only on head + tasks viaext.volumes→ unmodified nf-core pipeline reads the DB off the mount, zero copy, zero per-task download. Thes3://route stays only as a fallback when you can't mount on the head. README's "Delivering reference data" section has the recipe.Bump
TARGET_NF_SPAWN_VERSIONto0.5.0. The one thing I'd validate on your end: confirm the MetaPhlAnfind -Lresolves the symlinked stage name to the volume on a real run (directorypathinput → stage-name basename match), and that a.tar.gz-named DB vs a directory mount behaves. Keen to hear.scttfrdmn commentedon Jun 14, 2026
Tested the full volume-backed-DB path on nf-spawn 0.5.0 + spawn 0.51.1 (the #166 mount-ordering fix). Big progress, and one remaining MetaPhlAn-specific snag — with the artifacts you asked for.
What works now ✅
--attach-volumeDBs before the workload, so taxprofiler's head-sidedb_pathvalidation passes (was the earlier abort)..command.shdoeskraken2 --db kraken2(relative stage name), the symlink→mount resolves, exit 0. So the 0.5.0 symlink+bind-mount mechanism demonstrably works for at least the direct-path case.What still fails: MetaPhlAn (
find -Lon the stage name) ❌Same setup (its own
ext.volumesmount/opt/databases/metaphlan, snapshot has the full bowtie2 index — verified on the head). MetaPhlAn's task:FAILED exit=0(clean container exit, no*_profile.txt→ Nextflow fails it). The error:i.e. bowtie2 died immediately (no DB), breaking the reads pipe. The cause is the DB lookup in
.command.sh:find -L metaphlan(relative stage name) returns nothing →$BT2_DBempty → bowtie2 fails. And the task work dir has nometaphlanentry (only the staged FASTQs +.command.*).The diagnostic contrast
Both DBs are directory
ext.volumesmounts referenced by relative stage name in.command.sh:--db kraken2→ resolves, works.find -L metaphlan→ empty, fails.So for MetaPhlAn the stage-name symlink→mount either wasn't created or
find -Lcan't traverse it, whereas Kraken2's did. Possibly relevant differences: MetaPhlAn's mount basename ismetaphlanand it's accessed viafind -L <name>(needs the symlink to be a traversable dir), vs Kraken2 handing the name straight to the tool. The MetaPhlAn DB is also larger (34 GB vol vs 16 GB) and the task needed a 100 GB root to even pull the (conda) image — but the failure here is purely the missingmetaphlanstage entry, not space.Artifacts
.command.sh: thefind -L "metaphlan"block above (verbatim)..command.{sh,err,out},.exitcode, the 2*.fastp.fastq.gz,versions.yml— nometaphlansymlink/dir.--db kraken2, plus its.report.txtoutput.Happy to pull the task instance's
ls -laof the work dir live or the spawn staging script if that pins it down — say the word. Env: nf-spawn 0.5.0, spawn 0.51.1, taxprofiler 2.0.0, AL2023 arm64, both DBs viaext.volumes.feat: dispatch each task via spawn task run (spawn#386 adapter migrat…