I have a snakemake workflow containing a rule that runs another "inner" snakemake workflow.
Sometimes a certain rule of the inner workflow fails, which means the inner workflow fails. As a result, all files listed under the output
of the inner workflow are deleted by the outer workflow, even if the rules of the inner workflow that created them completed successfully.
Is there a way to prevent snakemake from deleting the outputs of failed rules? Or maybe you can suggest another workaround?
A few notes:
- The outputs of the inner workflow must be listed, b/c they are used as input for other rules in the outer workflow.
- I tried setting the outputs of the inner workflow as
protected
, but this didn't help. - I've also tried adding
exit 0
to the end of the call to the inner workflow to make snakemake think it completed successfully,
like this:
rule run_inner:
input:
inputs...
output:
outputs...
shell:
"""
snakemake -s inner.snakefile
exit 0
"""
but outputs are still deleted.
Would appreciate any help. Thanks!