Skip to content

fix: symlink ext.volumes DB by stage-name basename, not source URI (#55) - #56

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/55-symlink-by-stagename-basename
Jun 15, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/55-symlink-by-stagename-basename

Conversation

@scttfrdmn

Copy link
Copy Markdown
Collaborator

Closes #55. The fix that makes ext.volumes actually zero-copy for staged-db_path pipelines — caught by the filer's excellent live diagnosis on taxprofiler.

The bug (disproved both my earlier hypotheses)

0.5.0 (#51) symlinked a path input to an ext.volumes mount only when the input's source URI was that local mount. But pipelines like taxprofiler stage db_path — they copy the DB into Nextflow's S3 work area first. So the source URI nf-spawn sees is s3://…/classify/stage-<uuid>/…/metaphlan, never /opt/databases/metaphlan. The #51 "is the source a local mount?" check was always false → nf-spawn fell back to the #37 aws s3 cp --recursive and downloaded the DB per task. The volume was bind-mounted into the container but completely unused.

Kraken2 "worked" only because its 16.6 GB copy completed; MetaPhlAn's 36.1 GB (two ~8.6 GB .bt2l) truncated → find -L metaphlan found no index → empty --bowtie2db → bowtie2 BrokenPipe. Neither was ever zero-copy.

The fix

buildInputStaging now matches a declared input's stage-name basename against the attached ext.volumes mount basenames (e.g. input metaphlan ↔ mount /opt/databases/metaphlan). On a match it symlinks the stage name → the mount and skips the copy — regardless of the source URI Nextflow reports. The bind-mount (already added in #51) makes the symlink resolve inside the container. So the DB is read straight off the read-only volume, zero per-task download, even when the pipeline stages db_path.

  • New volumeMountPaths (ext.volumes → mount path list) + baseName helpers; mountPaths threaded submit → buildStagingScript → buildInputStaging.
  • Guarded: if the matched mount isn't present at run time, it errors loudly (exit 1) rather than silently producing a dangling link.

Tests

54 total, 0 failures. Added: stage-name-matches-mount → symlink not copy (even with an s3:// source); non-matching inputs still copied alongside; volumeMountPaths + baseName units. README "Delivering reference data" updated to describe the basename match (and that the mount must be named to match the input/db_name).

To validate (filer)

Re-run taxprofiler on 0.6.0 with the MetaPhlAn mount basename matching its db_name stage name. Expect: no aws s3 cp of the DB, a metaphlan symlink → /opt/databases/metaphlan in the work dir, and MetaPhlAn completing zero-copy like Kraken2.

0.5.0 only symlinked a path input to an ext.volumes mount when the input's
SOURCE URI was that local mount. But pipelines that stage db_path (taxprofiler
copies it into the Nextflow S3 work area) present the source as an s3:// stage
copy — never the mount — so nf-spawn fell back to `aws s3 cp` and downloaded the
DB per task. The volume was bind-mounted but unused. A 16 GB DB copied fine; a
36 GB one truncated and the tool failed (find -L found no index → bowtie2 died).

Now buildInputStaging matches a declared input's stage-name BASENAME against the
attached ext.volumes mounts and, on a match, symlinks stage-name → mount and
skips the copy regardless of the reported source URI. So a volume-backed DB is
read zero-copy off the read-only volume even when the pipeline stages db_path.

New helpers: volumeMountPaths (ext.volumes → mount path list), baseName. Threaded
mountPaths through submit → buildStagingScript → buildInputStaging.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0.5.0 stage-name symlink works for --db <name> (Kraken2) but not find -L <name> (MetaPhlAn) — symlink missing in task work dir

1 participant