refactor(workflow): guard the stage store with a touch() sentinel - #29
Merged
Conversation
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>
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.
Why
Audited our re-run avoidance against imcf/sopa. Sopa's tricks: marker-file outputs (
.zgroup) andtouch()completion sentinels on every heavy stage — it never declares adirectory()output for a real artifact. We matched the marker (zarr.json) and.donesentinels for segment/merge, butpreparestill outputdirectory(STAGE)— the exact thing that deletes/recreates (and "moved") the stage store on a re-run, with fuzzy directory mtime.Change
preparenow outputstouch(STAGE_OK)instead ofdirectory(STAGE);segmentdepends on the sentinel. Scripts already open the store by path, so no script change.Result (verified locally)
touchevery script, all outputs present,--rerun-triggers mtime→ Nothing to be done (upgrade-immune)..done→ onlysegment(1)+merge+allre-run;convert/preparestay cached.Note: sopa relies on
shell:+use-condato dodge code-change reruns; we usescript:, so we pinrerun-triggers: mtime(added earlier) for the same effect — equivalent, and arguably more explicit.🤖 Generated with Claude Code