I'm submitting jobs to slurm/sbatch
via snakemake
. I'm trying to send the log from sbatch to a file in the same directory tree of the rule's output.
For example, this works:
rm -rf foo
snakemake -s test.smk --jobs 1 --cluster "sbatch --output log.txt"
but it fails (i.e. slurm job status is FAILED) if I try:
rm -rf foo
snakemake -s test.smk --jobs 1 --cluster "sbatch --output {output}.log"
presumably, because {output}
points to foo/bar/
which does not exist. But snakemake should have created it, right?
This is test.smk
:
rule all:
output:
'foo/bar/done.txt'
shell:
"""
touch {output}
"""
So, how can I send logs to a directory tree not yet existing but created by the rule? (I'm reluctant in including code in the snakefile that create dirs in anticipation).
snakemake -v
4.8.0