I am working on a SLURM-based cluster. I am currently using the following slurm json file:

    "__default__" :
        "A" : "overall",
        "time" : "96:00:00",
        "nodes": 1,
        "ntasks": 1,
        "cpus" : 24,
        "p" : "LONG",
        "mem": 16G,
        "output": "snakemake%A.out",
        "error": "snakemake%A.err"

along with the following command:

snakemake --jobs 200 --use-conda --printshellcmds  --cluster-config slurm.json --cluster "sbatch -A {cluster.A} -p {cluster.p} -t {cluster.time} --output {cluster.output} --error {cluster.error} --ntasks {cluster.ntasks} --cpus-per-task {cluster.cpus} --mem {cluster.mem}"

I would like to be able to specify my email and receive an email when a job finishes. I have tried adding a line in the json file with "email": [email protected] and an option to the sbatch command --email {cluster.email} but that did not work.

Anyone knows how to do it?

  • 1
    $\begingroup$ After looking at some headers of files (#SBATCH --mail-user=email@comI have used --mail-user instead. I'll let you know if I receive an email. $\endgroup$ Mar 11, 2019 at 23:13
  • 1
    $\begingroup$ I'd be surprised if --mail-user didn't end up working. Note also --mail-type. $\endgroup$
    – Devon Ryan
    Mar 12, 2019 at 7:55
  • $\begingroup$ so --mail-user on its own didn't work but by adding the --mail-type, it worked! $\endgroup$ Mar 16, 2019 at 15:48

1 Answer 1


As noted by the comments and the SLURM manual (not so much bioinformatics related?)

You need the following terms in your batch/queuing command:

[email protected]

I used "ALL" which will send you all reports. If you just want the finish message then you would use "END" and "FAIL" like such:


Here are the specifics from the manual if you wish to make a different selection:


Notify user by email when certain event types occur. Valid type values are NONE, BEGIN, END, FAIL, REQUEUE, ALL (equivalent to BEGIN, END, FAIL, REQUEUE, and STAGE_OUT), STAGE_OUT (burst buffer stage out and teardown completed), TIME_LIMIT, TIME_LIMIT_90 (reached 90 percent of time limit), TIME_LIMIT_80 (reached 80 percent of time limit), TIME_LIMIT_50 (reached 50 percent of time limit) and ARRAY_TASKS (send emails for each array task). Multiple type values may be specified in a comma separated list. The user to be notified is indicated with --mail-user. Unless the ARRAY_TASKS option is specified, mail notifications on job BEGIN, END and FAIL apply to a job array as a whole rather than generating individual email messages for each task in the job array.


User to receive email notification of state changes as defined by --mail-type. The default value is the submitting user.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.