1
$\begingroup$

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": my@email.com and an option to the sbatch command --email {cluster.email} but that did not work.

Anyone knows how to do it?

$\endgroup$
3
  • 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$ – charlesdarwin Mar 11 '19 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 '19 at 7:55
  • $\begingroup$ so --mail-user on its own didn't work but by adding the --mail-type, it worked! $\endgroup$ – charlesdarwin Mar 16 '19 at 15:48
4
$\begingroup$

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

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

--mail-type=ALL
--mail-user=you@email.com

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:

--mail-type=END,FAIL

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

--mail-type=

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.

--mail-user=

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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