tourmaline
tourmaline copied to clipboard
How to prevent Snakemake from re-running rules when their output is already present
Snakemake has the unfortunate habit of re-running rules when their output is already present. To prevent this, follow these steps:
- Run the rule you want with the
--dry-runflag. This will show you the "reason" that each rule is being run. - If the reason is:
- "Updated input files": Run the rule with the
--touchparameter, which will touch output files (mark them up to date without really changing them) instead of running their commands. This is used to pretend that the rules were executed, in order to fool future invocations of snakemake. Fails if a file does not yet exist. - "Software environment definition has changed since last execution": Run the rule with the parameter
--rerun-triggers mtimes, which is the traditional way of just considering file modification dates. Otherwise, the default is to use all triggers, which guarantees that results are consistent with the workflow code and configuration but may cause undesirable behavior.
- "Updated input files": Run the rule with the
@ksilnoaa, this should help some of the issues we've had. I will add this text to the README for the main branch.