From ff2983baac3cc29186b13ba0d62c160f72547c88 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Wed, 23 Jul 2008 23:54:03 +0000
Subject: [PATCH] svn merge -r14578:14618
 https://eris.llnl.gov/svn/slurm/branches/slurm-1.2

---
 NEWS                     | 5 +++++
 src/slurmctld/job_mgr.c  | 8 +++++++-
 src/slurmctld/proc_req.c | 1 +
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 737083271b9..1d809a0fe82 100644
--- a/NEWS
+++ b/NEWS
@@ -403,6 +403,11 @@ documents those changes that are of interest to users and admins.
     Moved existing digital signature logic into new plugin: crypto/openssl.
     Added new support for crypto/munge (available with GPL license).
 
+* Changes in SLURM 1.2.34
+=========================
+ -- Permit the cancellation of a job that is in the process of being 
+    requeued.
+
 * Changes in SLURM 1.2.33
 =========================
  -- Cancelled or Failed jobs will now report their job and step id on exit
diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c
index b9ec0a96991..9d082150398 100644
--- a/src/slurmctld/job_mgr.c
+++ b/src/slurmctld/job_mgr.c
@@ -1677,7 +1677,13 @@ extern int job_signal(uint32_t job_id, uint16_t signal, uint16_t batch_flag,
 	/* save user ID of the one who requested the job be cancelled */
 	if(signal == SIGKILL)
 		job_ptr->requid = uid;
-	
+	if ((job_ptr->job_state == (JOB_PENDING | JOB_COMPLETING)) &&
+	    (signal == SIGKILL)) {
+		job_ptr->job_state = JOB_CANCELLED | JOB_COMPLETING;
+		verbose("job_signal of requeuing job %u successful", job_id);
+		return SLURM_SUCCESS;
+	}
+
 	if ((job_ptr->job_state == JOB_PENDING) &&
 	    (signal == SIGKILL)) {
 		last_job_update		= now;
diff --git a/src/slurmctld/proc_req.c b/src/slurmctld/proc_req.c
index 3451467bd1d..ca650c7c255 100644
--- a/src/slurmctld/proc_req.c
+++ b/src/slurmctld/proc_req.c
@@ -983,6 +983,7 @@ static void _slurm_rpc_job_step_kill(slurm_msg_t * msg)
 
 	/* do RPC call */
 	if (job_step_kill_msg->job_step_id == SLURM_BATCH_SCRIPT) {
+		/* NOTE: SLURM_BATCH_SCRIPT == NO_VAL */
 		error_code = job_signal(job_step_kill_msg->job_id, 
 					job_step_kill_msg->signal, 
 					job_step_kill_msg->batch_flag, uid);
-- 
GitLab