Only send job cancelled messsage if not already in ending state
diff --git a/src/slurmd/slurmstepd/req.c b/src/slurmd/slurmstepd/req.c
index 2aff707..9e5cb15 100644
--- a/src/slurmd/slurmstepd/req.c
+++ b/src/slurmd/slurmstepd/req.c
@@ -684,6 +684,7 @@
int rc = SLURM_SUCCESS;
int errnum = 0;
int sig;
+ static int msg_sent = 0;
debug("_handle_signal_container for job %u.%u",
job->jobid, job->stepid);
@@ -711,8 +712,8 @@
goto done;
}
- if (job->nodeid == 0) {
- static int msg_sent = 0;
+ if ((job->nodeid == 0) && (msg_sent == 0) &&
+ (job->state < SLURMSTEPD_STEP_ENDING)) {
char *entity;
if (job->stepid == SLURM_BATCH_SCRIPT)
entity = "JOB";
@@ -720,9 +721,7 @@
entity = "STEP";
/* Not really errors,
* but we want messages displayed by default */
- if (msg_sent)
- ;
- else if (sig == SIGXCPU) {
+ if (sig == SIGXCPU) {
error("*** %s CANCELLED DUE TO TIME LIMIT ***", entity);
msg_sent = 1; /* we just want to log the event */
goto done; /* don't actually send the signal */