Add --mail-type and --mail-user arguments
- Add the usual srun
--mail-type
and--mail-user
arguments tosmux new-session
. This lets a user receive emails when their job has started, ended, etc. - This addresses https://support.erc.monash.edu/a/tickets/92190
How did I test this?
First install my patched smux:
- On my laptop,
scp -rp smux/ lexg@m3-login3:/scratch/nq46/lexg/smux2
. - On M3,
cd /scratch/nq46/lexg/smux2
. python -m venv venv
. venv/bin/activate
pip install .
With my venv loaded and patched smux installed, verify that --help
works properly:
(venv) [lexg@m3-login3 smux2 (master)]$ smux new-session --help
usage: smux new-session [-h] [--ntasks <n>] [--nodes <n>] [--mem <n>] [--cpuspertask <n>] [--qos <n>] [-J <n>]
[-A <n>] [-p PARTITION] [-r RESERVATION] [-t TIME] [--gres <n>] [-o <n>] [-e <n>]
[--mail-type <n>] [--mail-user <n>]
...
--mail-type <n> Notify user by email when certain event types occur
(https://slurm.schedmd.com/srun.html#OPT_mail-type)
--mail-user <n> User to receive email notification of state changes as defined by --mail-type
(https://slurm.schedmd.com/srun.html#OPT_mail-user)
And I confirmed that setting --mail-type
and --mail-user
indeed resulted in emails being sent to my inbox (see job ID 42013037).
smux new-session --mail-user=lex.gallon@monash.edu --mail-type=ALL
Double-confirm by checking sacct: Confirm the flags were set in the corresponding job command too:
(venv) [lexg@m3-login3 smux2 (master)]$ sacct -j 42013037 --format=SubmitLine%140
SubmitLine
--------------------------------------------------------------------------------------------------------------------------------------------
sbatch --ntasks 1 -J interactive_session --mail-type=ALL --mail-user=lex.gallon@monash.edu --output=smux-%j.out --error=smux-%j.err
srun --pty -O --ntasks 1 --jobid 42013037 tmux attach-session -t interactive_session
And also confirm that not setting those arguments results in no emails being sent, as expected.
smux new-session