On Wed, May 3, 2017 at 7:44 PM, Giovanni Torres <[email protected]> wrote:

> Ideally, we would like to receive a different signal when is canceled
> by a user, and when is canceled because of a higher priority job.

While searching how to implement this, I found out about
https://slurm.schedmd.com/prolog_epilog.html. Which lets me write a simple
script to find if the job was canceled by a user or canceled to be
resumed later.

I just had to put these in slurm.conf:

EpilogSlurmctld=/usr/local/bin/job-epilog.sh
PrologEpilogTimeout=300 #seconds

And write a simple script, for example:

#!/bin/bash

export PATH='/usr/bin:/usr/local/bin'
                                                                     │
logger --tag epilog --stderr $(sacct --brief --noheader --jobs="$SLURM_JOB_ID")

exit 0

Then I get in syslog:

epilog: 283 CANCELLED 0:0
epilog: 279 PREEMPTED 0:0

CANCELLED vs PREEMPTED, which is exactly what I wanted.

Leaving this here, in case somebody else have a similar query.

Cheers!

-- 
Giovanni

Reply via email to