Skip to content

refactor(workflow): guard the stage store with a touch() sentinel - #29

Merged
lguerard merged 1 commit into
mainfrom
refactor/workflow-sentinels
Jun 24, 2026
Merged

refactor(workflow): guard the stage store with a touch() sentinel#29
lguerard merged 1 commit into
mainfrom
refactor/workflow-sentinels

Conversation

@lguerard

Copy link
Copy Markdown
Contributor

Why

Audited our re-run avoidance against imcf/sopa. Sopa's tricks: marker-file outputs (.zgroup) and touch() completion sentinels on every heavy stage — it never declares a directory() output for a real artifact. We matched the marker (zarr.json) and .done sentinels for segment/merge, but prepare still output directory(STAGE) — the exact thing that deletes/recreates (and "moved") the stage store on a re-run, with fuzzy directory mtime.

Change

prepare now outputs touch(STAGE_OK) instead of directory(STAGE); segment depends on the sentinel. Scripts already open the store by path, so no script change.

Result (verified locally)

  • Fresh run: 12/12, labels written.
  • touch every script, all outputs present, --rerun-triggers mtimeNothing to be done (upgrade-immune).
  • Delete one tile's .done → only segment(1)+merge+all re-run; convert/prepare stay cached.

Note: sopa relies on shell:+use-conda to dodge code-change reruns; we use script:, so we pin rerun-triggers: mtime (added earlier) for the same effect — equivalent, and arguably more explicit.

🤖 Generated with Claude Code

Replace the prepare rule's directory(STAGE) output with a touch()ed
STAGE_OK marker (sopa's sentinel discipline). Snakemake then tracks a
tiny leaf file instead of a directory, so it no longer deletes/recreates
(or "moves") the stage store on a re-run and is immune to directory-mtime
quirks. segment depends on the sentinel; scripts open the store by path.

With this + marker outputs + rerun-triggers: mtime, touching any script
yields "Nothing to be done", and losing one tile re-runs only that tile
and the merge — convert/prepare stay cached.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lguerard
lguerard merged commit 4af65c3 into main Jun 24, 2026
2 checks passed
@lguerard
lguerard deleted the refactor/workflow-sentinels branch June 24, 2026 14:26
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.

1 participant