From a64e499e2d2bf6eb0e519af5c36139225b49e18d Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Thu, 2 Dec 2010 19:50:25 +0000
Subject: [PATCH] In srun, log if a job allocation is revoked while waiting for
 resources.

---
 src/srun/allocate.c       | 6 +++++-
 testsuite/expect/test1.64 | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/srun/allocate.c b/src/srun/allocate.c
index 49af546e3e1..4925466738e 100644
--- a/src/srun/allocate.c
+++ b/src/srun/allocate.c
@@ -126,6 +126,8 @@ static void _signal_while_allocating(int signo)
 	destroy_job = 1;
 	if (pending_job_id != 0) {
 		slurm_complete_job(pending_job_id, NO_VAL);
+		info("Job allocation %u has been revoked.", pending_job_id);
+
 	}
 }
 
@@ -438,6 +440,8 @@ allocate_nodes(void)
 	/* create message thread to handle pings and such from slurmctld */
 	msg_thr = slurm_allocation_msg_thr_create(&j->other_port, &callbacks);
 
+	/* NOTE: Do not process signals in separate pthread. The signal will
+	 * cause slurm_allocate_resources_blocking() to exit immediately. */
 	xsignal_unblock(sig_array);
 	for (i = 0; sig_array[i]; i++)
 		xsignal(sig_array[i], _signal_while_allocating);
@@ -448,7 +452,7 @@ allocate_nodes(void)
 		if (destroy_job) {
 			/* cancelled by signal */
 			break;
-		} else if(!resp && !_retry()) {
+		} else if (!resp && !_retry()) {
 			break;
 		}
 	}
diff --git a/testsuite/expect/test1.64 b/testsuite/expect/test1.64
index 86e0d6bb311..e49a71e73e4 100755
--- a/testsuite/expect/test1.64
+++ b/testsuite/expect/test1.64
@@ -56,7 +56,7 @@ expect {
 		send_user "\nSent SIGINT\n"
 		exp_continue
 	}
-	-re "Terminated job" {
+	-re "Job allocation ($number) has been revoked" {
 		incr matches
 		exp_continue
 	}
-- 
GitLab