From 412bf5fcd2b54c9026d0a8aa1859ee1ca7d8c086 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Tue, 15 Jun 2010 20:15:10 +0000
Subject: [PATCH] tweak for problem if power save configured along with gang
 scheduling to avoid having srun generate an error that the node isn't ready
 for use

---
 src/api/job_info.c      | 2 +-
 src/slurmctld/job_mgr.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/api/job_info.c b/src/api/job_info.c
index 3a48fc320ea..ad08485923d 100644
--- a/src/api/job_info.c
+++ b/src/api/job_info.c
@@ -1081,7 +1081,7 @@ extern int slurm_job_node_ready(uint32_t job_id)
 	msg.job_id   = job_id;
 
 	if (slurm_send_recv_controller_msg(&req, &resp) < 0)
-		return -1;
+		return READY_JOB_ERROR;
 
 	if (resp.msg_type == RESPONSE_JOB_READY) {
 		rc = ((return_code_msg_t *) resp.data)->return_code;
diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c
index 06ee10d455d..09195715336 100644
--- a/src/slurmctld/job_mgr.c
+++ b/src/slurmctld/job_mgr.c
@@ -7144,8 +7144,10 @@ extern int job_node_ready(uint32_t job_id, int *ready)
 	if (job_ptr == NULL)
 		return ESLURM_INVALID_JOB_ID;
 
-	if (!IS_JOB_RUNNING(job_ptr))
+	if (!IS_JOB_RUNNING(job_ptr) && !IS_JOB_SUSPENDED(job_ptr)) {
+		/* Gang scheduling might suspend job immediately */
 		return 0;
+	}
 
 	rc = select_g_job_ready(job_ptr);
 	if (rc == READY_JOB_FATAL)
-- 
GitLab