Search code examples
snakemake

what is the snakemake variable name for slurm job id?


When I run jobs on snakemake using --profile ./slurm, I see in standard output:

Submitted job 406 with external jobid '1956125'

in slurm/config.yaml I have:

cores: "all"
cluster: "sbatch --partition=mypartition -A myaccount  -t {resources.time_min} --mem={resources.mem_mb} -c {resources.cpus} -o slurm/logs/{jobid}.out -e slurm/logs/{jobid}.err --mail-type=FAIL --mail-user=mymail.edu --parsable"
default-resources: [cpus=1, mem_mb=2000, time_min=10080, parition=mypartition]
use-conda: true

This writes log files like 406.err and what I want is 1956125.err

How do I do this?


Solution

  • 406 is the internal jobid from snakemake. You want the external jobid from slurm.

    IIRC that should be possible by using %j instead of {jobid}:

    cluster: "sbatch --partition=mypartition -A myaccount  -t {resources.time_min} --mem={resources.mem_mb} -c {resources.cpus} -o slurm/logs/%j.out -e slurm/logs/%j.err --mail-type=FAIL --mail-user=mymail.edu --parsable"
    

    Let us know if it works.