slurm: Email-Benachrichtigung
This commit is contained in:
parent
f661696f32
commit
ebe29427f9
37
aufgabe5.2/slurm/slurm-mail
Normal file
37
aufgabe5.2/slurm/slurm-mail
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
use warnings;
|
||||||
|
use strict;
|
||||||
|
use 5.014;
|
||||||
|
|
||||||
|
if ($#ARGV < 2) {
|
||||||
|
say "USAGE: $0 -s msg recipient '$#ARGV'";
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub escape {
|
||||||
|
my $arg = shift;
|
||||||
|
|
||||||
|
$arg =~ s/'/'\\''/g;
|
||||||
|
return "'" . $arg . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
my $msg = escape $ARGV[1];
|
||||||
|
my $recipient = escape $ARGV[2];
|
||||||
|
|
||||||
|
die "no job id passed via argv" unless $msg =~ /Job_id=(\d+)/;
|
||||||
|
my $id = $1;
|
||||||
|
|
||||||
|
open my $job_fh, "/var/log/slurm/job_completions"
|
||||||
|
or die "Could not open slurms jobcompletion: $!";
|
||||||
|
my @matches = grep /$id/, <$job_fh>;
|
||||||
|
close $job_fh;
|
||||||
|
|
||||||
|
if ($#matches < 0) {
|
||||||
|
die "job id $id not found";
|
||||||
|
}
|
||||||
|
$matches[0] =~ s/\s+/\n/g;
|
||||||
|
my $new_msg = $matches[0];
|
||||||
|
|
||||||
|
open my $mail, "| mail -s $msg $recipient";
|
||||||
|
print $mail $new_msg;
|
||||||
|
close $mail;
|
@ -14,6 +14,7 @@ ProctrackType=proctrack/cgroup
|
|||||||
ReturnToService=2
|
ReturnToService=2
|
||||||
TaskPlugin=task/affinity
|
TaskPlugin=task/affinity
|
||||||
UsePAM=1
|
UsePAM=1
|
||||||
|
MailProg=/usr/local/bin/slurm-mail
|
||||||
|
|
||||||
# TIMERS
|
# TIMERS
|
||||||
SlurmctldTimeout=300
|
SlurmctldTimeout=300
|
||||||
|
@ -26,3 +26,5 @@ __EOF__
|
|||||||
$ batch --mail-type=END --mail-user=$USER /tmp/myscript
|
$ batch --mail-type=END --mail-user=$USER /tmp/myscript
|
||||||
\end{lstlisting}
|
\end{lstlisting}
|
||||||
|
|
||||||
|
Um die geforderten Informationen in der Email wie verwendete Nodes, Start- und Endzeitpunkt verschicken zu können,
|
||||||
|
haben wir ein Skript geschrieben (siehe aufgabe5.2/slurm/slurm-mail).
|
||||||
|
Loading…
Reference in New Issue
Block a user