From 6c0f84b4dc86cd0028fa6df0dd0a2b0b1c20a148 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Fri, 27 Mar 2009 15:11:54 +0000
Subject: [PATCH] Modify slurm logic so that an scontrol requeue request will
 work even if JobRequeue is configured off (apply it only to node failures
 rather than explicit requeue requests). Change test3.8 to match change in
 logic.

---
 src/slurmctld/job_mgr.c  |  6 +++-
 testsuite/expect/test3.8 | 74 ----------------------------------------
 2 files changed, 5 insertions(+), 75 deletions(-)

diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c
index 7c89e61d88e..ec17713a319 100644
--- a/src/slurmctld/job_mgr.c
+++ b/src/slurmctld/job_mgr.c
@@ -6135,7 +6135,11 @@ extern int job_requeue (uid_t uid, uint32_t job_id, slurm_fd conn_fd)
 		rc = ESLURM_ALREADY_DONE;
 		goto reply;
 	}
-	if ((job_ptr->details == NULL) || (job_ptr->details->requeue == 0)) {
+	if (job_ptr->details == NULL) {
+		/* NOTE: the job_ptr->details->requeue value is only
+		 * used for automatic job requeue after a node failure.
+		 * It does not apply when a job requeue is explicitly
+		 * requested. */
 		rc = ESLURM_DISABLED;
 		goto reply;
 	}
diff --git a/testsuite/expect/test3.8 b/testsuite/expect/test3.8
index 9222eab84a8..a0bb018faee 100755
--- a/testsuite/expect/test3.8
+++ b/testsuite/expect/test3.8
@@ -177,80 +177,6 @@ if {[file exists $file_flag_4]} {
 	set exit_code 1
 }
 
-#
-# Now run the same test, but with job requeue disabled via the 
-# srun --no-requeue option
-#
-set job_id        0
-
-exec $bin_rm -f $file_flag_1 $file_flag_2 $file_flag_3 $file_flag_4
-
-set sbatch_pid [spawn $sbatch --no-requeue --output=$file_out --error=$file_err -t1 $file_in]
-expect {
-	-re "Submitted batch job ($number)" {
-		set job_id $expect_out(1,string)
-		exp_continue
-	}
-	timeout {
-		send_user "\nFAILURE: srun not responding\n"
-		slow_kill $sbatch_pid
-		set exit_code 1
-	}
-	eof {
-		wait
-	}
-}
-if {$job_id == 0} {
-	send_user "\nFAILURE: batch submit failure\n"
-	exit 1
-}
-
-#
-# Wait for job to begin, then requeue it
-#
-if {[wait_for_job $job_id "RUNNING"] != 0} {
-	send_user "\nFAILURE: waiting for job to begin\n"
-	set exit_code 1
-}
-set disabled 0
-exec $bin_sleep 5
-spawn $scontrol requeue $job_id
-expect {
-	-re "error.*disabled" {
-		set disabled 1
-		send_user "This error was expected, no worries\n"
-		exp_continue
-	}
-	timeout {
-		send_user "\nFAILURE: scontrol not responding\n"
-		set exit_code 1
-	}
-	eof {
-		wait
-	}
-}
-if {$disabled == 0} {
-	send_user "\nFAILURE: srun's --no-requeue option ignored\n"
-	set exit_code 1
-}
-
-#
-# Wait for job to complete and check for files
-#
-if {[wait_for_job $job_id "DONE"] != 0} {
-	send_user "\nFAILURE: waiting for job to complete\n"
-	set exit_code 1
-}
-if {[wait_for_file $file_flag_1] != 0} {
-	send_user "\nFAILURE: file $file_flag_1 is missing\n"
-	set exit_code 1
-}
-if {[file exists $file_flag_2]} {
-	send_user "\nFAILURE: file $file_flag_2 is found\n"
-	set exit_code 1
-}
-
-
 if {$exit_code == 0} {
 	exec $bin_rm -f $file_in $file_out $file_err
 	exec $bin_rm -f $file_flag_1 $file_flag_2 $file_flag_3 $file_flag_4
-- 
GitLab