Repository navigation
Description
Problem
Per-process EBS-snapshot volumes (ext.volumes, #45) are the wrong primitive for a shared reference DB read by a wide fan-out. Fast Snapshot Restore — the only way to make snapshot-volumes fast on cold tasks — has a per-snapshot credit bucket (~10 concurrent fully-warmed volumes). A 30-sample taxprofiler run created ~50 volumes from 2 DB snapshots near-simultaneously; the credits drained instantly and most volumes were created NOT fast-restored, falling back to ~6-8 MB/s S3 lazy-load. Classification crawled (8/30 Kraken2 after 60 min) on ~/hr of idle-reading instances.
The right primitive for one stable reference, many concurrent readers is a shared filesystem — FSx for Lustre (S3-backed, lazy-import) or EFS. spawn already supports both on spawn launch (--fsx-id, --fsx-create, --fsx-import-path, --efs-id, …). But nf-spawn forwards neither — SpawnTaskHandler reads only instanceType/region/ttl/spot/ami/volumeSize/volumes/az, so a Nextflow process can't request an FSx/EFS mount per task.
Proposal
Forward two new ext directives to the existing spawn flags, passed only when set (default = today's behavior):
process {
withName: 'KRAKEN2_KRAKEN2' {
ext.fsx = [ id: 'fs-0abc...', mount: '/fsx' ] // → spawn launch --fsx-id fs-0abc... --fsx-mount-point /fsx
// or ext.efs = [ id: 'fs-0def...', mount: '/efs' ] // → --efs-id ... --efs-mount-point ...
}
}Minimal form: ext.fsx = 'fs-0abc...' → --fsx-id fs-0abc... (default mount /fsx). The DB then lives once on the shared FS; N tasks mount it read-only with no per-volume credit limit and no copy. Mirrors the ext.volumes→--attach-volume and ext.az→--az (#62) forwarding already in place.
Implementation sketch
Same shape as ext.az (#62): read ext.fsx/ext.efs in submit(), append --fsx-id/--fsx-mount-point (or --efs-id/--efs-mount-point) to buildLaunchCommand when present. The instance-side staging script already symlinks a path input whose stage-name basename matches a mount (#55), so a shared-FS DB at /fsx/<dbname> would resolve zero-copy the same way ext.volumes mounts do.
Context
Consuming project: aws-microbiome-demo (nf-core/taxprofiler, ~30-100 samples wide fan-out over a stable 56 GB Kraken2+MetaPhlAn DB set). The EBS-volume+FSR path (#62 + s3:// db_path markers) works cleanly at small N but hits the FSR credit cliff at wide fan-out; a shared FSx mount is the scale answer. Filing as a feature request — not modifying nf-spawn.
Activity
scttfrdmn commentedon Jun 16, 2026
One implementation detail worth making explicit, from inspecting 0.7.0: the #55 zero-copy symlink is driven by
buildInputStaging(inputs, mountPaths)wheremountPathscomes fromvolumeMountPaths(ext.volumes)— i.e. only ext.volumes mounts. So forwardingext.fsxto--fsx-idalone is necessary but not sufficient: the FSx mount point (e.g./fsx) must ALSO be fed into that samemountPathslist, so a stagedpathinput whose stage-name basename matches a dir under the FSx mount gets symlinked instead of copied — same zero-copy behavior ext.volumes already gets.Concretely, two parts:
ext.fsx→spawn launch --fsx-id <id> --fsx-mount-point <mnt>(launch side)<mnt>(or<mnt>/<name>) in themountPathspassed tobuildInputStaging(staging side, so the head's s3:// db_path stage resolves to the FSx-mounted DB on the task with no copy)Without (2), tasks would mount FSx but taxprofiler's staged db_path would still try to localize from S3 instead of using the mount.
scttfrdmn commentedon Jun 16, 2026
Status note: the spawn-side FSx primitive is now well-developed in spawn 0.56.0 — async ephemeral-FSx create on launch + spored runtime mount (spawn#194/#198/#199), fail-closed --fsx-create lifecycle (spawn#193/#197), and refcount-aware ttl-reaper reclaim of orphaned FSx filesystems (spawn#192/#196). So the launch/mount/teardown machinery nf-spawn would forward to is ready and hardened (the reaper in particular removes the 'FSx bills forever if you forget to delete' risk for ephemeral per-run filesystems).
This issue (the nf-spawn forwarding of ext.fsx → spawn launch --fsx-*, plus feeding the FSx mount into the #55 buildInputStaging mountPaths) remains the only gap between here and a working shared-DB wide-fan-out. With 0.56.0's async-create-on-launch, an ext.fsx that maps to --fsx-create + --fsx-import-path (ephemeral per-run FS, reaper-cleaned) may be a cleaner shape than requiring a pre-built --fsx-id — worth considering both forms when implementing.
Consumer side (aws-microbiome-demo) is already wired ready: FSX_ID/FSX_MOUNT config knobs, nextflow_config emits ext.fsx per classifier with FSx→EBS→baked precedence, s3:// db_path markers retained so the head needs no mount. Just waiting on the nf-spawn release to flip it on.
chore(release): v0.8.0
fix: stage-out skips inputs stage-in symlinked to a mount (#99) (#110)