Mail
The HPCFS cluster provides full e-mail functionality, mainly because the resource management system normally notifies users about the jobs it has completed for them via mail notifications. SLURM sends messages only when the user requests them; the program output is always written to a file (by default slurm-<jobid>.out, or as set with --output/--error) and the message contains only a short job summary. When submitting with the sbatch (or srun) command, the following switches can be used:
--mail-type=ENDsends a message when the job finishes--mail-type=BEGINsends a message when the job starts (--mail-type=ALLfor all events)--mail-user=addresssends to a different address
On the control node, mail can be read, sent and forwarded to other mailboxes. The following mail clients can be used on prelog:
mail
alpine
mutt
kmail
All mail clients can read mail from local mailboxes. Remote (POP3) mail retrieval is not provided. If users want notifications on completion (--mail-type=END) or at the end of a job to be sent to a different mailbox, they can do so by specifying, in the script or on the command line with the --mail-user switch, the address to be used for notifications. The following example sends the job completion report to the chosen address
#!/bin/bash
#SBATCH --partition=rome
#SBATCH --ntasks=24
#SBATCH --output=bit1.log
#SBATCH --mail-type=END
#SBATCH --mail-user=leon.kos@example.org
mpiexec BIT1 ../tok-em4e22.inp
This way of working is possible, but less convenient, so it is better to set up delivery to remote mailboxes by forwarding. For this purpose, create the file $HOME/.forward with content like the following example, which both stores all received messages in the local mailbox (first line) and then forwards them (second line). With this setup, received messages in the remote mailbox can be deleted without a second thought, since all messages are also stored on the control node. Alternatively, you could keep only the content of the second line, which means that all mail is forwarded and nothing is stored locally.
\leon
leon.kos@example.org
The .forward file must be properly protected against reading with the command
chmod 600 $HOME/.forward
SLURM and mail can be quickly tested with the command
sbatch --mail-type=END --wrap=env
which will run the env program to print the environment variables on one of the nodes and then send a message by mail. While typing, we usually get notifications as well as a bell for new mail, for example:
You have new mail in /var/spool/mail/leon
Local mail can be read with clients in a terminal window or in graphical form. Clients cannot be mixed, since each one moves read mail into the home directory in its own way after reading. The most spartan, but still usable, is the mail program. Example of use
[leon@prelog ~]$ mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/leon": 3 messages 2 new 3 unread
U 1 slurm@hpc.fs.uni-lj. Mon Dec 27 22:30 18/712 "Slurm Job_id=390 Name=wrap Ended, Run time 00:00:05, COMPLETED, ExitCode 0"
>N 2 slurm@hpc.fs.uni-lj. Mon Dec 27 22:31 18/712 "Slurm Job_id=391 Name=wrap Ended, Run time 00:00:04, COMPLETED, ExitCode 0"
N 3 slurm@hpc.fs.uni-lj. Mon Dec 27 22:31 18/712 "Slurm Job_id=392 Name=wrap Ended, Run time 00:00:01, COMPLETED, ExitCode 0"
& 3
& 2
& x
Alpine and mutt are somewhat better programs for reading messages on screen in a command shell, while kmail is fully graphical. To read local mail in kmail, first add reading from the local directory via Settings - Configure KMail - Add - Local Account and set local mailbox locking via Modify - Locking method - FCNTL or with a dot. For fast and clear work with SLURM, the mutt client is recommended, since it nicely colours messages and allows received mail to be opened directly. At the beginning you need to try a few keys (?, up, down, backspace, enter, x, …) and you can already move between messages.
An example of a message resulting from the command sbatch --mail-type=END --wrap=pwd, which only prints the current directory, is the following (the output /home/leon itself is written to the file slurm-393.out):
From slurm@hpc.fs.uni-lj.si Mon Dec 27 22:53:48 2010
Date: Mon, 27 Dec 2010 22:53:48 +0100
To: leon@hpc.fs.uni-lj.si
From: SLURM workload manager <slurm@hpc.fs.uni-lj.si>
Subject: Slurm Job_id=393 Name=wrap Ended, Run time 00:00:00, COMPLETED, ExitCode 0
Pošta
Sestav HPCFS omogoča polno funkcionalnost elektronske pošte predvsem zaradi tega, ker sistem za upravljanje z računskmi viri normalno obvešča uporabnike o poslih katere je opravil zanje, kar preko poštnih obvestil. SLURM sporočila pošilja le, če jih uporabnik zahteva; izpis programa se vedno zapiše v datoteko (privzeto slurm-<jobid>.out oziroma kot je podano z --output/--error), sporočilo pa vsebuje le kratek povzetek posla. Pri zagonu z ukazom sbatch (ali srun) lahko uporabimo naslednja stikala:
--mail-type=ENDpošlje sporočilo ob zaključku posla--mail-type=BEGINpošlje sporočilo o začetku posla (--mail-type=ALLza vse dogodke)--mail-user=naslovpošlje na drug naslov
Pošto je na nadzornem vozlišču mogoče brati, pošiljati in posredovati na druge predale. Na prelogu je mogoče uporabljati naslednje poštne odjemalce:
mail
alpine
mutt
kmail
Vsi poštni odjemalci lahko berejo pošto iz lokalnih predalov. Oddaljeno (POP3) pobiranje pošte ni predvideno. Če uporabnik želi, da se mu sporočila ob zaključku (--mail-type=END) ali koncu posla pošljejo v drug predal, lahko to storijo tako, da v skriptu ali ukazni vrstici s stikalom --mail-user navedejo naslov, ki naj se uporabi za obvestila. Naslednji primer pošlje poročilo ob zaključku posla na izbran naslov
#!/bin/bash
#SBATCH --partition=rome
#SBATCH --ntasks=24
#SBATCH --output=bit1.log
#SBATCH --mail-type=END
#SBATCH --mail-user=leon.kos@example.org
mpiexec BIT1 ../tok-em4e22.inp
Tak način dela je možen, vendar manj priročen in je zato bolje, da posredovanje na oddaljene poštne predale uredimo s posredovanjem. V ta namen ustvarimo datoteko $HOME/.forward z vsebino kot je naslednji primer, ki hkrati shrani vsa prejeta sporočila v lokalni predal (prva vrstica) in nato še posreduje naprej(druga vrstica). Pri takem načinu dela lahko prejeta sporočila v oddaljenem predalu brez premisleka brišemo, saj so vsa sporočila shranjena tudi na nadzornem vozlišču. Lahko pa bi ohranili vsebino druge vrstice, kar pomeni, da se vsa pošta posreduje naprej in ni nič shranjeno lokalno.
\leon
leon.kos@example.org
Datoteko .forward moramo ustrezno zaščititi proti branju z ukazom
chmod 600 $HOME/.forward
Na hitro lahko testiramo delovanje SLURM in pošte z ukazom
sbatch --mail-type=END --wrap=env
ki bo pognal program env za izpis sistemski spremenljivk ne enem od vozlišč in nato poslal sporočilo po pošti. Običajno dobimo med tipkanjem opozorila kot tudi zvončel na novo pošto kot je npr:
You have new mail in /var/spool/mail/leon
Lokalno pošto lahko beremo z odjemalci v terminalskem oknu ali v okenski obliki. Odjemalce med seboj ne moremo mešati, saj vsak po prebranju pošte premakne prebrano pošto v domači imenik na svoj način. Najbolj špartanski, vendar še vedno uporaben, je program mail. Primer uporabe
[leon@prelog ~]$ mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/leon": 3 messages 2 new 3 unread
U 1 slurm@hpc.fs.uni-lj. Mon Dec 27 22:30 18/712 "Slurm Job_id=390 Name=wrap Ended, Run time 00:00:05, COMPLETED, ExitCode 0"
>N 2 slurm@hpc.fs.uni-lj. Mon Dec 27 22:31 18/712 "Slurm Job_id=391 Name=wrap Ended, Run time 00:00:04, COMPLETED, ExitCode 0"
N 3 slurm@hpc.fs.uni-lj. Mon Dec 27 22:31 18/712 "Slurm Job_id=392 Name=wrap Ended, Run time 00:00:01, COMPLETED, ExitCode 0"
& 3
& 2
& x
Alpine in mutt sta neoliko boljša programa za zaslonsko branje sporočil v ukazni školjki, medtem ko je kmail povsem grafičen. Za branje lokalne pošte v kmailu, je potrebno najprej dodati branje iz lokalnega imenika z Nastavitve - Nastavi Kmail - Dodaj - Krajevni račun in mu nastavimo zaklepanje lokalnega predala z Spremeni - Način zaklepanja - FCNTL ali s piko. Za hitro in pregledno delo s SLURM je priporočena uporaba odjemalca mutt, saj lepo barva sporočila in omogoča neposredno odpiranje prejete pošte. Na začetki je sicer potrebno preizkusiti par tipk (?, up, down, backspace, enter, x, …) in že se lahko sprejajamo med sporočili.
Primer sporočila, ki je rezultat ukaza sbatch --mail-type=END --wrap=pwd, ki izpiše le trenutni imenik je naslednji (sam izpis /home/leon se zapiše v datoteko slurm-393.out):
From slurm@hpc.fs.uni-lj.si Mon Dec 27 22:53:48 2010
Date: Mon, 27 Dec 2010 22:53:48 +0100
To: leon@hpc.fs.uni-lj.si
From: SLURM workload manager <slurm@hpc.fs.uni-lj.si>
Subject: Slurm Job_id=393 Name=wrap Ended, Run time 00:00:00, COMPLETED, ExitCode 0