Search code examples
snakemake

"scancel: error: Invalid job id Submitted batch job" with --cluster-cancel from snakemake


I am running snakemake using this command:

snakemake --profile slurm -j 1 --cores 1 --cluster-cancel "scancel"

which writes this to standard out:

Submitted job 224 with external jobid 'Submitted batch job 54174212'.

but after I cancel the run with ctrl + c, I get the following error:

scancel: error: Invalid job id Submitted batch job 54174212

What I would guess is that the jobid is 'Submitted batch job 54174212' and snakemake tries to run scancel 'Submitted batch job 54174212' instead of the expected scancel 54174212. If this is the case, how do I change the jobid to something that works with scancel?


Solution

  • Your suspicion is probably correct, snakemake probably tries to cancel the wrong job (id Submitted batch job 54174212).

    Check your slurm profile for snakemake which you invoke (standard location ~/.config/snakemake/slurm/config.yaml): Does it contain the --parsable flag for sbatch?

    Missing to include that flag is a mistake I made before. Adding the flag solved it for me.