From c19cb29ed6cf0cddb1dc024b2e6cbd6def6bcc49 Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Tue, 10 Jun 2014 14:43:35 -0700
Subject: [PATCH] Log proper backfill job test time

The backfill scheduler was always reporting the time that a job
was being considered as NOW rather than the time that was really
being considered.
---
 src/plugins/sched/backfill/backfill.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/plugins/sched/backfill/backfill.c b/src/plugins/sched/backfill/backfill.c
index c9ee5e499b1..44d1929c3a5 100644
--- a/src/plugins/sched/backfill/backfill.c
+++ b/src/plugins/sched/backfill/backfill.c
@@ -168,16 +168,15 @@ static void _dump_job_sched(struct job_record *job_ptr, time_t end_time,
 	xfree(node_list);
 }
 
-static void _dump_job_test(struct job_record *job_ptr, bitstr_t *avail_bitmap)
+static void _dump_job_test(struct job_record *job_ptr, bitstr_t *avail_bitmap,
+			   time_t start_time)
 {
 	char begin_buf[32], *node_list;
 
-	if (job_ptr->start_time == 0) {
+	if (start_time == 0)
 		strcpy(begin_buf, "NOW");
-	} else {
-		slurm_make_time_str(&job_ptr->start_time, begin_buf,
-				    sizeof(begin_buf));
-	}
+	else
+		slurm_make_time_str(&start_time, begin_buf, sizeof(begin_buf));
 	node_list = bitmap2node_name(avail_bitmap);
 	info("Test job %u at %s on %s", job_ptr->job_id, begin_buf, node_list);
 	xfree(node_list);
@@ -1016,7 +1015,7 @@ static int _attempt_backfill(void)
 		}
 
 		if (debug_flags & DEBUG_FLAG_BACKFILL)
-			_dump_job_test(job_ptr, avail_bitmap);
+			_dump_job_test(job_ptr, avail_bitmap, start_res);
 		j = _try_sched(job_ptr, &avail_bitmap, min_nodes, max_nodes,
 			       req_nodes, exc_core_bitmap);
 
@@ -1072,7 +1071,7 @@ static int _attempt_backfill(void)
 				continue;
 			} else if (rc != SLURM_SUCCESS) {
 				/* Planned to start job, but something bad
-				 * happended. */
+				 * happened. */
 				job_ptr->start_time = 0;
 				break;
 			} else {
-- 
GitLab