[slurm-users] epilog when job is killed for max time

Josep Manel Andrés Moscardó josep.moscardo at embl.de
Thu Nov 8 01:26:55 MST 2018


Hi,
Somebody else gave me this piece of code (I hope he doesn't mind me 
sharing it :) , at least it is how they do it:

#!/bin/bash

#SBATCH --signal=B:USR1 at 300  #<------ This will make Slurm send signal 
USR1 to the bash process 300 seconds before the time limit
#SBATCH -t 00:06:00

resubmit() {
echo "It's time to resubmit";  # <----- Run whatever is necessary. 
Shutdown the DDBB, resubmit the job using the checkpointing files...
}

trap "resubmit" USR1

sleep 1000 &   # <----- Your program goes here. It's important to run on 
the background otherwise bash will not process the signal until this 
command finishes

wait   # <---- wait until all the background processes are finished. If 
a signal is received this will stop, process the signal and finish the 
script.


On 7/11/18 21:16, Noam Bernstein wrote:
> Hi slurm users - I’ve been looking through the slurm prolog/epilog manuals, but haven’t been able to figure out if there’s a way to get an epilog script (requested by the user) to run when a job is killed for running out of time, and have the epilog script be able to detect that (through an env variable, for example).  Is this possible?
> 
> 								thanks,
> 								Noam
> 

-- 
Josep Manel Andrés Moscardó
Systems Engineer, IT Operations
EMBL Heidelberg
T +49 6221 387-8394

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5396 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.schedmd.com/pipermail/slurm-users/attachments/20181108/824f8ce1/attachment.bin>


More information about the slurm-users mailing list