Repository navigation
feat: cost cap, container passthrough, and pinned node-side installs - #15
Merged
Merged
Conversation
Three gaps that together kept an otherwise-working executor out of a catalog that pins every image by digest and caps every launch (#12, #13). COST CAP (#12). TTL was the only ceiling on a job, defaulting to 4h, so a fan-out of N jobs had a worst case of N x 4h x the instance rate with no second belt. spored enforces TTL and cost INDEPENDENTLY and the first to fire wins, so lifecycle.cost_limit is a genuine second limit — and the failure it catches is the expensive one: a job that HANGS rather than fails produces no error for Snakemake to retry or abort on, so it bills until the TTL expires. Emitted only when set, so spawn's own default still applies. CONTAINER (#12). A rule's `container:` now reaches spec.container, with --spawn-container as a workflow-wide default and the per-rule directive winning. The job then runs through spawn's existing container path (Docker on demand, digest pull, private-ECR auth, GPU flags) instead of a bare AL2023 host where the tool had to already be present. Read via getattr(job, "container_img_url") — defensive, matching this file's existing style, since the attribute is absent on jobs and versions with no container notion. Routing through spec.container rather than installing apptainer in the preamble was the reporter's own preference and is strictly better: AL2023 ships no apptainer (an EPEL package, and AL2023 does not enable EPEL), so the alternative means rebuilding what spawn already does. PINNED INSTALLS (#13). The node-side specs were unpinned ranges resolved from PyPI per instance at run time, so two jobs in one workflow could run different Snakemake versions — the fan-out launches instances minutes apart and a release landing mid-workflow is enough — and nothing recorded what either resolved. They now default to `==` the submitter's own versions, via importlib.metadata, so the nodes agree with the submitting host by construction. Resolved at CALL time, not as parameter defaults, which would bind at import. The resolved specs are echoed into each job's log so the software that ran is recoverable even when a caller loosens the pin deliberately, and --spawn-snakemake-spec/--spawn-storage-spec allow exactly that. Worth noting the storage plugin is NOT a hard dependency of this package, so its fallback is reachable in normal use; the test asserts whichever is actually true in the running environment rather than assuming the dist is present, and both branches were exercised locally (with and without it installed). README (#13). `pip install snakemake-executor-plugin-spawn` cannot work — not on PyPI — and that is the first thing a new user runs. Replaced with the git+https@<tag> form, plus the two things that cost the reporter time: the plugin must land in the SAME environment as Snakemake (discovery is by module-name prefix inside Snakemake's interpreter), and a venv is usually required rather than tidy because Homebrew's Python is PEP 668 externally-managed and refuses pip outright. A test ties the README's pin to pyproject's version so it cannot rot one release later. 43 tests pass; ruff and mypy clean. Negative checks confirmed: a stale README pin fails, and disabling the cost_limit emission fails. Fixes #12 Fixes #13
scttfrdmn
added a commit
that referenced
this pull request
Oct 4, 2026
…#17) Routing a rule's container: to spec.container is architecturally wrong for this adapter. spec.command here is a Snakemake RE-INVOCATION (format_job_exec -> python -m snakemake --mode remote ...), not the rule's shell. So setting spec.container ran Snakemake inside the science image, which for a single-tool bioconda image means no Snakemake, no storage plugin, no dnf, no sudo and no root. Confirmed on a real pinned arm64 image: snakemake-spawn: python3.11 install failed -> rc=1 docker: invalid reference format -> rc=125 (docker:// left on) This should not have shipped, and the reason is mine. The reporter retracted the suggestion on #12 at 01:13Z with "Don't do that — it cannot work with this adapter's architecture, and I'd rather say so before someone implements it", then at 01:17Z opened PR #14 containing ONLY the half that works, then withdrew that PR at 01:33Z. I opened PR #15 at 01:55Z — 42 minutes after the retraction — implementing both halves including the retracted one, merged it, released it as v0.3.0, and closed an issue they had asked to keep open for part 1. I read the issue BODY and never the comments or the repo's open PRs. Verifying an issue's claims against the code is not sufficient; the thread can already contain the answer, and here it contained an explicit instruction not to do what I did. Removed rather than caveated: advertising a setting that cannot work reads as a supported feature. tests/test_no_container_passthrough.py fails if either the build_task_spec argument or the --spawn-container setting returns, with the reasoning inline so it is not re-added as an obvious one-field fix. --spawn-cost-limit is untouched. That half was correct, is wanted, and was the half the reporter had already split out. MINOR (0.4.0), not PATCH: a setting that was advertised is being withdrawn. It never functioned, so nothing can depend on its behaviour, but it was documented. The shape that can work is #16: Snakemake already forwards --software-deployment-method to the node and intends to own containerisation itself; the node only lacks a runtime, and apptainer's el9 aarch64 RPMs install on AL2023 and are pinnable. That needs the two decisions the reporter asked for and is not a patch. Refs #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #12. Fixes #13.
Three gaps that together kept an otherwise-working executor out of a catalog that pins every image by digest and caps every launch.
Cost cap (#12) — the one that mattered most
TTL was the only ceiling on a job, defaulting to 4h, so a fan-out of N jobs had a worst case of N × 4h × the instance rate with no second belt.
sporedenforces TTL and cost independently and the first to fire wins, solifecycle.cost_limitis a genuine second limit.It catches the expensive failure specifically: a job that hangs rather than fails produces no error for Snakemake to retry or abort on, so it bills until the TTL expires. Emitted only when set, so spawn's own default still applies.
Worth knowing:
--cost-limitbecame a compute + storage total in spawn 0.116.0 (spawn#616), so a cap now bounds EBS too.Container passthrough (#12)
A rule's
container:now reachesspec.container, with--spawn-containeras a workflow-wide default and the per-rule directive winning — so a workflow that already names images needs no new configuration.I took your preferred shape (route through
spec.container) rather than installing apptainer in the preamble, and your reasoning holds: AL2023 ships no apptainer (EPEL, which AL2023 doesn't enable), so the alternative means rebuilding what spawn's container path already does correctly.Read via
getattr(job, "container_img_url", None)— defensive, matching this file's existing style, since the attribute is absent on jobs and Snakemake versions with no container notion.Pinned node-side installs (#13)
Took suggestion (1) and (2) and (3), since they compose:
==the submitting environment's own versions viaimportlib.metadata, so the nodes agree with the submitting host by construction.--spawn-snakemake-spec/--spawn-storage-specto pin exactly, with the old ranges as fallbacks.Resolved at call time rather than as parameter defaults, which would bind at import — there's a test for that, because it's the kind of thing that looks fine and silently freezes.
One thing your report didn't cover and I found while testing: the storage plugin is not a hard dependency of this package (
pyprojectdeclares onlysnakemake-interface-executor-plugins+snakemake), so its fallback is reachable in normal use. The test asserts whichever is actually true in the running environment rather than assuming the dist is present, and I exercised both branches locally — with and without it installed.README (#13)
Replaced the bare
pip installwith thegit+https@<tag>form, and documented the two things that cost you time: the plugin must land in the same environment as Snakemake (discovery is by module-name prefix inside Snakemake's own interpreter), and a venv is usually required rather than tidy, because Homebrew's Python is PEP 668 externally-managed and refusespip installoutright.I pinned
@v0.2.0— the latest release that actually exists — rather than the version this will become, and added a test tying the README's pin topyproject.toml's version. That's deliberate: a pin naming a tag that doesn't exist yet is the same class of bug as the PyPI line, and the test means the release ritual can't leave it stale one release later.Verification
43 tests pass;
ruff checkandmypyclean. Negative checks confirmed to fail: a stale README pin, and disabling thecost_limitemission.Context
Found in an audit prompted by this report: no workflow adapter emitted
lifecycle.cost_limit— nf-spawn, miniwdl-spawn, cwl-spawn, airflow-spawn and pegasus-spawn all have the same gap, filed as nf-spawn#100, miniwdl-spawn#12, cwl-spawn#12, airflow-spawn#12 and pegasus-spawn#5. airflow-spawn is also missingcontainer(airflow-spawn#13). So this wasn't a snakemake oversight so much as the first place anyone noticed.