From f9386850c61a378108071165cdd11a8aed7d2487 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Mon, 27 Nov 2006 22:38:42 +0000
Subject: [PATCH] For sched/wiki2 job state request, return REJMESSAGE= with
 reason for     a job's failure.

---
 NEWS                               | 2 ++
 src/plugins/sched/wiki2/get_jobs.c | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/NEWS b/NEWS
index f00d2cb339b..60947aac7c9 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ documents those changes that are of interest to users and admins.
  -- Modity job state "reason" field to report why a job failed (previously 
     previously reported only reason waiting to run). Requires cold-start of 
     slurmctld (-c option).
+ -- For sched/wiki2 job state request, return REJMESSAGE= with reason for 
+    a job's failure.
 
 * Changes in SLURM 1.2.0-pre7
 =============================
diff --git a/src/plugins/sched/wiki2/get_jobs.c b/src/plugins/sched/wiki2/get_jobs.c
index c2afe960970..eabd6011432 100644
--- a/src/plugins/sched/wiki2/get_jobs.c
+++ b/src/plugins/sched/wiki2/get_jobs.c
@@ -190,6 +190,13 @@ static char *	_dump_job(struct job_record *job_ptr, int state_info)
 		xstrcat(buf, tmp);
 	}
 
+	if (job_ptr->job_state == JOB_FAILED) {
+		snprintf(tmp, sizeof(tmp),
+			"REJMESSAGE=\"%s\";",
+			job_reason_string(job_ptr->state_reason));
+		xstrcat(buf, tmp);
+	}
+
 	snprintf(tmp, sizeof(tmp), 
 		"UPDATETIME=%u;WCLIMIT=%u;",
 		(uint32_t) job_ptr->time_last_active,
-- 
GitLab