From e6a711e85dd515fad9a147c86ebeca44df0cbe45 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Wed, 20 Feb 2008 01:36:47 +0000
Subject: [PATCH] svn merge -r13295:13308
 https://eris.llnl.gov/svn/slurm/branches/slurm-1.2

---
 NEWS                                |  5 +++
 contribs/perlapi/Makefile.am        |  6 ++--
 contribs/perlapi/Makefile.in        |  6 ++--
 slurm.spec                          |  9 ++++--
 src/plugins/sched/wiki/get_jobs.c   | 36 +++++++--------------
 src/plugins/sched/wiki/get_nodes.c  | 32 ++++++------------
 src/plugins/sched/wiki2/get_jobs.c  | 43 +++++++++----------------
 src/plugins/sched/wiki2/get_nodes.c | 50 ++++++++++-------------------
 8 files changed, 70 insertions(+), 117 deletions(-)

diff --git a/NEWS b/NEWS
index c6dd067931a..ecadbc49f28 100644
--- a/NEWS
+++ b/NEWS
@@ -161,6 +161,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.24
+=========================
+ -- In sched/wiki and sched/wiki2, support non-zero UPDATE_TIME specification
+    for GETNODES and GETJOBS commands.
+
 * Changes in SLURM 1.2.23
 =========================
  -- Fix for libpmi to not export unneeded variables like xstr*
diff --git a/contribs/perlapi/Makefile.am b/contribs/perlapi/Makefile.am
index 6cbdfb13271..00939f2da34 100644
--- a/contribs/perlapi/Makefile.am
+++ b/contribs/perlapi/Makefile.am
@@ -24,7 +24,7 @@ $(perl_dir)/Makefile:	$(perl_dir)/Makefile.PL
 			${LN_S} -f ../${srcdir}/$$f $$f; \
 		done; \
 	fi
-	@cd $(perl_dir) && $(perlpath) Makefile.PL $(PERL_MM_PARAMS) prefix=${prefix} INSTALLDIRS=perl LIB=@libdir@/perl5 installman1dir=@mandir@/man1 installman3dir=@mandir@/man3
+	@cd $(perl_dir) && $(perlpath) Makefile.PL $(PERL_MM_PARAMS) prefix=${prefix}
 
 #
 # Note on linking logic below
@@ -39,7 +39,7 @@ all-local: $(perl_dir)/Makefile #libslurm
 if HAVE_AIX
 	@cd $(perl_dir) && \
 	if [ ! -f Makefile ]; then \
-		$(perlpath) Makefile.PL $(PERL_MM_PARAMS) prefix=${prefix} INSTALLDIRS=perl LIB=@libdir@/perl5 installman1dir=@mandir@/man1 installman3dir=@mandir@/man3; \
+		$(perlpath) Makefile.PL $(PERL_MM_PARAMS) prefix=${prefix}; \
 	fi && \
 	($(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) -g -static $(CFLAGS)" $(PERL_EXTRA_OPTS) || \
 	 $(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) -g -static $(CFLAGS)" $(PERL_EXTRA_OPTS)) && \
@@ -47,7 +47,7 @@ if HAVE_AIX
 else
 	@cd $(perl_dir) && \
 	if [ ! -f Makefile ]; then \
-		$(perlpath) Makefile.PL $(PERL_MM_PARAMS) prefix=${prefix} INSTALLDIRS=perl LIB=@libdir@/perl5 installman1dir=@mandir@/man1 installman3dir=@mandir@/man3; \
+		$(perlpath) Makefile.PL $(PERL_MM_PARAMS) prefix=${prefix}; \
 	fi && \
 	($(MAKE) CC="$(CC)" LD="$(CC) $(CFLAGS)" CCFLAGS="$(PERL_CFLAGS) -g -static $(CFLAGS)" $(PERL_EXTRA_OPTS) || \
 	 $(MAKE) CC="$(CC)" LD="$(CC) $(CFLAGS)" CCFLAGS="$(PERL_CFLAGS) -g -static $(CFLAGS)" $(PERL_EXTRA_OPTS)) && \
diff --git a/contribs/perlapi/Makefile.in b/contribs/perlapi/Makefile.in
index 2f249e55166..809be00b096 100644
--- a/contribs/perlapi/Makefile.in
+++ b/contribs/perlapi/Makefile.in
@@ -425,7 +425,7 @@ $(perl_dir)/Makefile:	$(perl_dir)/Makefile.PL
 			${LN_S} -f ../${srcdir}/$$f $$f; \
 		done; \
 	fi
-	@cd $(perl_dir) && $(perlpath) Makefile.PL $(PERL_MM_PARAMS) prefix=${prefix} INSTALLDIRS=perl LIB=@libdir@/perl5 installman1dir=@mandir@/man1 installman3dir=@mandir@/man3
+	@cd $(perl_dir) && $(perlpath) Makefile.PL $(PERL_MM_PARAMS) prefix=${prefix}
 
 #
 # Note on linking logic below
@@ -439,14 +439,14 @@ $(perl_dir)/Makefile:	$(perl_dir)/Makefile.PL
 all-local: $(perl_dir)/Makefile #libslurm
 @HAVE_AIX_TRUE@	@cd $(perl_dir) && \
 @HAVE_AIX_TRUE@	if [ ! -f Makefile ]; then \
-@HAVE_AIX_TRUE@		$(perlpath) Makefile.PL $(PERL_MM_PARAMS) prefix=${prefix} INSTALLDIRS=perl LIB=@libdir@/perl5 installman1dir=@mandir@/man1 installman3dir=@mandir@/man3; \
+@HAVE_AIX_TRUE@		$(perlpath) Makefile.PL $(PERL_MM_PARAMS) prefix=${prefix}; \
 @HAVE_AIX_TRUE@	fi && \
 @HAVE_AIX_TRUE@	($(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) -g -static $(CFLAGS)" $(PERL_EXTRA_OPTS) || \
 @HAVE_AIX_TRUE@	 $(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) -g -static $(CFLAGS)" $(PERL_EXTRA_OPTS)) && \
 @HAVE_AIX_TRUE@	cd ..;
 @HAVE_AIX_FALSE@	@cd $(perl_dir) && \
 @HAVE_AIX_FALSE@	if [ ! -f Makefile ]; then \
-@HAVE_AIX_FALSE@		$(perlpath) Makefile.PL $(PERL_MM_PARAMS) prefix=${prefix} INSTALLDIRS=perl LIB=@libdir@/perl5 installman1dir=@mandir@/man1 installman3dir=@mandir@/man3; \
+@HAVE_AIX_FALSE@		$(perlpath) Makefile.PL $(PERL_MM_PARAMS) prefix=${prefix}; \
 @HAVE_AIX_FALSE@	fi && \
 @HAVE_AIX_FALSE@	($(MAKE) CC="$(CC)" LD="$(CC) $(CFLAGS)" CCFLAGS="$(PERL_CFLAGS) -g -static $(CFLAGS)" $(PERL_EXTRA_OPTS) || \
 @HAVE_AIX_FALSE@	 $(MAKE) CC="$(CC)" LD="$(CC) $(CFLAGS)" CCFLAGS="$(PERL_CFLAGS) -g -static $(CFLAGS)" $(PERL_EXTRA_OPTS)) && \
diff --git a/slurm.spec b/slurm.spec
index 2de94a3702e..4a5d2d82648 100644
--- a/slurm.spec
+++ b/slurm.spec
@@ -118,8 +118,9 @@ BuildRequires: openssl-devel >= 0.9.6 openssl >= 0.9.6
 # http://slforums.typo3-factory.net/index.php?showtopic=11378
 %define _unpackaged_files_terminate_build      0
 
-
-%define _perlarch %(perl -e 'use Config; $T=$Config{installsitearch}; $P=$Config{installprefix}; $T =~ s/$P//; print $T;') 
+# First we remove $prefix/local and then just prefix to make 
+# sure we get the correct installdir
+%define _perlarch %(perl -e 'use Config; $T=$Config{installsitearch}; $P=$Config{installprefix}; $P1="$P/local"; $T =~ s/$P1//; $T =~ s/$P//; print $T;') 
 
 %define _perldir %{_prefix}%{_perlarch}
 
@@ -305,6 +306,10 @@ test -f $RPM_BUILD_ROOT/%{_perldir}/auto/Slurm/Slurm.so &&
   echo "%{_perldir}/auto/Slurm/Slurm.so"      >> $LIST
 test -f $RPM_BUILD_ROOT/%{_mandir}/man3/Slurm.3 &&
 echo "%{_mandir}/man3/Slurm.3"                 >> $LIST
+test -f $RPM_BUILD_ROOT/%{_perldir}/auto/Slurm/Slurm.bs &&
+  echo "%{_perldir}/auto/Slurm/Slurm.bs"      >> $LIST
+test -f $RPM_BUILD_ROOT/%{_perldir}/auto/Slurm/autosplit.ix &&
+  echo "%{_perldir}/auto/Slurm/autosplit.ix"      >> $LIST
 
 LIST=./torque.files
 touch $LIST
diff --git a/src/plugins/sched/wiki/get_jobs.c b/src/plugins/sched/wiki/get_jobs.c
index 6c6fd1f626b..7da06dc9db3 100644
--- a/src/plugins/sched/wiki/get_jobs.c
+++ b/src/plugins/sched/wiki/get_jobs.c
@@ -45,8 +45,8 @@
 #include "src/slurmctld/locks.h"
 #include "src/slurmctld/slurmctld.h"
 
-static char *	_dump_all_jobs(int *job_cnt, int state_info);
-static char *	_dump_job(struct job_record *job_ptr, int state_info);
+static char *	_dump_all_jobs(int *job_cnt, time_t update_time);
+static char *	_dump_job(struct job_record *job_ptr, time_t update_time);
 static char *	_get_group_name(gid_t gid);
 static uint16_t _get_job_cpus_per_task(struct job_record *job_ptr);
 static uint32_t	_get_job_end_time(struct job_record *job_ptr);
@@ -62,11 +62,6 @@ static uint32_t	_get_job_time_limit(struct job_record *job_ptr);
 static int	_hidden_job(struct job_record *job_ptr);
 static char *	_task_list(struct job_record *job_ptr);
 
-
-#define SLURM_INFO_ALL		0
-#define SLURM_INFO_VOLITILE	1
-#define SLURM_INFO_STATE	2
-
 /*
  * get_jobs - get information on specific job(s) changed since some time
  * cmd_ptr IN - CMD=GETJOBS ARG=[<UPDATETIME>:<JOBID>[:<JOBID>]...]
@@ -102,7 +97,7 @@ extern int	get_jobs(char *cmd_ptr, int *err_code, char **err_msg)
 	/* Locks: read job, partition */
 	slurmctld_lock_t job_read_lock = {
 		NO_LOCK, READ_LOCK, NO_LOCK, READ_LOCK };
-	int job_rec_cnt = 0, buf_size = 0, state_info;
+	int job_rec_cnt = 0, buf_size = 0;
 
 	arg_ptr = strstr(cmd_ptr, "ARG=");
 	if (arg_ptr == NULL) {
@@ -126,16 +121,9 @@ extern int	get_jobs(char *cmd_ptr, int *err_code, char **err_msg)
 	}
 	tmp_char++;
 	lock_slurmctld(job_read_lock);
-	if (update_time == 0)
-		state_info = SLURM_INFO_ALL;
-	else if (update_time > last_job_update)
-		state_info = SLURM_INFO_STATE;
-	else
-		state_info = SLURM_INFO_VOLITILE;
-
 	if (strncmp(tmp_char, "ALL", 3) == 0) {
 		/* report all jobs */
-		buf = _dump_all_jobs(&job_rec_cnt, state_info);
+		buf = _dump_all_jobs(&job_rec_cnt, update_time);
 	} else {
 		struct job_record *job_ptr;
 		char *job_name, *tmp2_char;
@@ -145,7 +133,7 @@ extern int	get_jobs(char *cmd_ptr, int *err_code, char **err_msg)
 		while (job_name) {
 			job_id = (uint32_t) strtoul(job_name, NULL, 10);
 			job_ptr = find_job_record(job_id);
-			tmp_buf = _dump_job(job_ptr, state_info);
+			tmp_buf = _dump_job(job_ptr, update_time);
 			if (job_rec_cnt > 0)
 				xstrcat(buf, "#");
 			xstrcat(buf, tmp_buf);
@@ -180,7 +168,7 @@ static int	_hidden_job(struct job_record *job_ptr)
 	return 0;
 }
 
-static char *   _dump_all_jobs(int *job_cnt, int state_info)
+static char *   _dump_all_jobs(int *job_cnt, time_t update_time)
 {
 	int cnt = 0;
 	struct job_record *job_ptr;
@@ -191,7 +179,7 @@ static char *   _dump_all_jobs(int *job_cnt, int state_info)
 	while ((job_ptr = (struct job_record *) list_next(job_iterator))) {
 		if (_hidden_job(job_ptr))
 			continue;
-		tmp_buf = _dump_job(job_ptr, state_info);
+		tmp_buf = _dump_job(job_ptr, update_time);
 		if (cnt > 0)
 			xstrcat(buf, "#");
 		xstrcat(buf, tmp_buf);
@@ -202,7 +190,7 @@ static char *   _dump_all_jobs(int *job_cnt, int state_info)
 	return buf;
 }
 
-static char *	_dump_job(struct job_record *job_ptr, int state_info)
+static char *	_dump_job(struct job_record *job_ptr, time_t update_time)
 {
 	char tmp[16384], *buf = NULL;
 	uint32_t end_time, suspend_time;
@@ -210,15 +198,13 @@ static char *	_dump_job(struct job_record *job_ptr, int state_info)
 	if (!job_ptr)
 		return NULL;
 
-	/* SLURM_INFO_STATE or SLURM_INFO_VOLITILE or SLURM_INFO_ALL */
 	snprintf(tmp, sizeof(tmp), "%u:STATE=%s;",
 		job_ptr->job_id, _get_job_state(job_ptr));
 	xstrcat(buf, tmp);
 
-	if (state_info == SLURM_INFO_STATE)
+	if (update_time > last_job_update)
 		return buf;
 
-	/* SLURM_INFO_VOLITILE or SLURM_INFO_ALL */
 	if ((job_ptr->job_state == JOB_PENDING)
 	&&  (job_ptr->details)
 	&&  (job_ptr->details->req_nodes)
@@ -318,10 +304,10 @@ static char *	_dump_job(struct job_record *job_ptr, int state_info)
 		xstrcat(buf,tmp);
 	}
 
-	if (state_info == SLURM_INFO_VOLITILE)
+	if (job_ptr->details &&
+	    (update_time > job_ptr->details->submit_time))
 		return buf;
 
-	/* SLURM_INFO_ALL only */
 	snprintf(tmp, sizeof(tmp),
 		"UNAME=%s;GNAME=%s;",
 		uid_to_string((uid_t) job_ptr->user_id),
diff --git a/src/plugins/sched/wiki/get_nodes.c b/src/plugins/sched/wiki/get_nodes.c
index 45fa3b6550c..ac574e3f01b 100644
--- a/src/plugins/sched/wiki/get_nodes.c
+++ b/src/plugins/sched/wiki/get_nodes.c
@@ -39,14 +39,10 @@
 #include "src/slurmctld/locks.h"
 #include "src/slurmctld/slurmctld.h"
 
-static char *	_dump_all_nodes(int *node_cnt, int state_info);
-static char *	_dump_node(struct node_record *node_ptr, int state_info);
+static char *	_dump_all_nodes(int *node_cnt, time_t update_time);
+static char *	_dump_node(struct node_record *node_ptr, time_t update_time);
 static char *	_get_node_state(struct node_record *node_ptr);
 
-#define SLURM_INFO_ALL		0
-#define SLURM_INFO_VOLITILE	1
-#define SLURM_INFO_STATE	2
-
 /*
  * get_nodes - get information on specific node(s) changed since some time
  * cmd_ptr IN - CMD=GETNODES ARG=[<UPDATETIME>:<NODEID>[:<NODEID>]...]
@@ -72,7 +68,7 @@ extern int	get_nodes(char *cmd_ptr, int *err_code, char **err_msg)
 	/* Locks: read node, read partition */
 	slurmctld_lock_t node_read_lock = {
 		NO_LOCK, NO_LOCK, READ_LOCK, READ_LOCK };
-	int node_rec_cnt = 0, buf_size = 0, state_info;
+	int node_rec_cnt = 0, buf_size = 0;
 
 	arg_ptr = strstr(cmd_ptr, "ARG=");
 	if (arg_ptr == NULL) {
@@ -90,16 +86,9 @@ extern int	get_nodes(char *cmd_ptr, int *err_code, char **err_msg)
 	}
 	tmp_char++;
 	lock_slurmctld(node_read_lock);
-	if (update_time == 0)
-		state_info = SLURM_INFO_ALL;
-	else if (update_time > last_node_update)
-		state_info = SLURM_INFO_STATE;
-	else
-		state_info = SLURM_INFO_VOLITILE;
-
 	if (strncmp(tmp_char, "ALL", 3) == 0) {
 		/* report all nodes */
-		buf = _dump_all_nodes(&node_rec_cnt, state_info);
+		buf = _dump_all_nodes(&node_rec_cnt, update_time);
 	} else {
 		struct node_record *node_ptr;
 		char *node_name, *tmp2_char;
@@ -112,7 +101,7 @@ extern int	get_nodes(char *cmd_ptr, int *err_code, char **err_msg)
 				      node_name);
 				continue;
 			}
-			tmp_buf = _dump_node(node_ptr, state_info);
+			tmp_buf = _dump_node(node_ptr, update_time);
 			if (node_rec_cnt > 0)
 				xstrcat(buf, "#");
 			xstrcat(buf, tmp_buf);
@@ -134,7 +123,7 @@ extern int	get_nodes(char *cmd_ptr, int *err_code, char **err_msg)
 	return 0;
 }
 
-static char *	_dump_all_nodes(int *node_cnt, int state_info)
+static char *	_dump_all_nodes(int *node_cnt, time_t update_time)
 {
 	int i, cnt = 0;
 	struct node_record *node_ptr = node_record_table_ptr;
@@ -143,7 +132,7 @@ static char *	_dump_all_nodes(int *node_cnt, int state_info)
 	for (i=0; i<node_record_count; i++, node_ptr++) {
 		if (node_ptr->name == NULL)
 			continue;
-		tmp_buf = _dump_node(node_ptr, state_info);
+		tmp_buf = _dump_node(node_ptr, update_time);
 		if (cnt > 0)
 			xstrcat(buf, "#");
 		xstrcat(buf, tmp_buf);
@@ -154,7 +143,7 @@ static char *	_dump_all_nodes(int *node_cnt, int state_info)
 	return buf;
 }
 
-static char *	_dump_node(struct node_record *node_ptr, int state_info)
+static char *	_dump_node(struct node_record *node_ptr, time_t update_time)
 {
 	char tmp[512], *buf = NULL;
 	int i;
@@ -162,7 +151,6 @@ static char *	_dump_node(struct node_record *node_ptr, int state_info)
 	if (!node_ptr)
 		return NULL;
 
-	/* SLURM_INFO_STATE or SLURM_INFO_VOLITILE or SLURM_INFO_ALL */
 	snprintf(tmp, sizeof(tmp), "%s:STATE=%s;",
 		node_ptr->name, 
 		_get_node_state(node_ptr));
@@ -178,11 +166,9 @@ static char *	_dump_node(struct node_record *node_ptr, int state_info)
 		xstrcat(buf, tmp);
 	}
 
-	if ((state_info == SLURM_INFO_STATE) ||
-	    (state_info == SLURM_INFO_VOLITILE))
+	if (update_time > 0)
 		return buf;
 
-	/* SLURM_INFO_ALL only */
 	if (slurmctld_conf.fast_schedule) {
 		/* config from slurm.conf */
 		snprintf(tmp, sizeof(tmp),
diff --git a/src/plugins/sched/wiki2/get_jobs.c b/src/plugins/sched/wiki2/get_jobs.c
index 9f0840501e9..522efc3d91a 100644
--- a/src/plugins/sched/wiki2/get_jobs.c
+++ b/src/plugins/sched/wiki2/get_jobs.c
@@ -45,8 +45,8 @@
 #include "src/common/uid.h"
 #include "src/slurmctld/locks.h"
 
-static char *	_dump_all_jobs(int *job_cnt, int state_info);
-static char *	_dump_job(struct job_record *job_ptr, int state_info);
+static char *	_dump_all_jobs(int *job_cnt, time_t update_time);
+static char *	_dump_job(struct job_record *job_ptr, time_t update_time);
 static char *	_get_group_name(gid_t gid);
 static void	_get_job_comment(struct job_record *job_ptr, 
 			char *buffer, int buf_size);
@@ -63,10 +63,6 @@ static uint32_t	_get_job_tasks(struct job_record *job_ptr);
 static uint32_t	_get_job_time_limit(struct job_record *job_ptr);
 static int	_hidden_job(struct job_record *job_ptr);
 
-#define SLURM_INFO_ALL		0
-#define SLURM_INFO_VOLITILE	1
-#define SLURM_INFO_STATE	2
-
 static uint32_t cr_enabled = 0, cr_test = 0;
 
 /* We only keep a few reject message to limit the overhead */
@@ -124,7 +120,7 @@ extern int	get_jobs(char *cmd_ptr, int *err_code, char **err_msg)
 	/* Locks: read job, partition */
 	slurmctld_lock_t job_read_lock = {
 		NO_LOCK, READ_LOCK, NO_LOCK, READ_LOCK };
-	int job_rec_cnt = 0, buf_size = 0, state_info;
+	int job_rec_cnt = 0, buf_size = 0;
 
 	if (cr_test == 0) {
 		select_g_get_info_from_plugin(SELECT_CR_PLUGIN,
@@ -154,16 +150,9 @@ extern int	get_jobs(char *cmd_ptr, int *err_code, char **err_msg)
 	}
 	tmp_char++;
 	lock_slurmctld(job_read_lock);
-	if (update_time == 0)
-		state_info = SLURM_INFO_ALL;
-	else if (update_time > last_job_update)
-		state_info = SLURM_INFO_STATE;
-	else
-		state_info = SLURM_INFO_VOLITILE;
-
 	if (strncmp(tmp_char, "ALL", 3) == 0) {
 		/* report all jobs */
-		buf = _dump_all_jobs(&job_rec_cnt, state_info);
+		buf = _dump_all_jobs(&job_rec_cnt, update_time);
 	} else {
 		struct job_record *job_ptr = NULL;
 		char *job_name = NULL, *tmp2_char = NULL;
@@ -173,7 +162,7 @@ extern int	get_jobs(char *cmd_ptr, int *err_code, char **err_msg)
 		while (job_name) {
 			job_id = (uint32_t) strtoul(job_name, NULL, 10);
 			job_ptr = find_job_record(job_id);
-			tmp_buf = _dump_job(job_ptr, state_info);
+			tmp_buf = _dump_job(job_ptr, update_time);
 			if (job_rec_cnt > 0)
 				xstrcat(buf, "#");
 			xstrcat(buf, tmp_buf);
@@ -213,7 +202,7 @@ static int	_hidden_job(struct job_record *job_ptr)
 	return 0;
 }
 
-static char *   _dump_all_jobs(int *job_cnt, int state_info)
+static char *   _dump_all_jobs(int *job_cnt, time_t update_time)
 {
 	int cnt = 0;
 	struct job_record *job_ptr;
@@ -224,7 +213,7 @@ static char *   _dump_all_jobs(int *job_cnt, int state_info)
 	while ((job_ptr = (struct job_record *) list_next(job_iterator))) {
 		if (_hidden_job(job_ptr))
 			continue;
-		tmp_buf = _dump_job(job_ptr, state_info);
+		tmp_buf = _dump_job(job_ptr, update_time);
 		if (cnt > 0)
 			xstrcat(buf, "#");
 		xstrcat(buf, tmp_buf);
@@ -235,7 +224,7 @@ static char *   _dump_all_jobs(int *job_cnt, int state_info)
 	return buf;
 }
 
-static char *	_dump_job(struct job_record *job_ptr, int state_info)
+static char *	_dump_job(struct job_record *job_ptr, time_t update_time)
 {
 	char tmp[16384], *buf = NULL;
 	uint32_t end_time, suspend_time;
@@ -244,15 +233,13 @@ static char *	_dump_job(struct job_record *job_ptr, int state_info)
 	if (!job_ptr)
 		return NULL;
 
-	/* SLURM_INFO_STATE or SLURM_INFO_VOLITILE or SLURM_INFO_ALL */
 	snprintf(tmp, sizeof(tmp), "%u:STATE=%s;",
 		job_ptr->job_id, _get_job_state(job_ptr));
 	xstrcat(buf, tmp);
 
-	if (state_info == SLURM_INFO_STATE)
+	if (update_time > last_job_update)
 		return buf;
 
-	/* SLURM_INFO_VOLITILE or SLURM_INFO_ALL */
 	if (job_ptr->job_state == JOB_PENDING) {
 		char *req_features = _get_job_features(job_ptr);
 		if (req_features) {
@@ -365,20 +352,20 @@ static char *	_dump_job(struct job_record *job_ptr, int state_info)
 		xstrcat(buf, tmp);
 	}
 
-	if (state_info == SLURM_INFO_VOLITILE)
+	snprintf(tmp, sizeof(tmp),
+		"NAME=\"%s\";", job_ptr->name);
+	xstrcat(buf, tmp);
+
+	if (job_ptr->details &&
+	    (update_time > job_ptr->details->submit_time))
 		return buf;
 
-	/* SLURM_INFO_ALL only */
 	snprintf(tmp, sizeof(tmp),
 		"UNAME=%s;GNAME=%s;",
 		uid_to_string((uid_t) job_ptr->user_id),
 		_get_group_name(job_ptr->group_id));
 	xstrcat(buf, tmp);
 
-	snprintf(tmp, sizeof(tmp),
-		"NAME=\"%s\";", job_ptr->name);
-	xstrcat(buf, tmp);
-
 	return buf;
 }
 
diff --git a/src/plugins/sched/wiki2/get_nodes.c b/src/plugins/sched/wiki2/get_nodes.c
index e83fe48d564..cdfbea0d72a 100644
--- a/src/plugins/sched/wiki2/get_nodes.c
+++ b/src/plugins/sched/wiki2/get_nodes.c
@@ -40,18 +40,14 @@
 #include "src/slurmctld/locks.h"
 #include "src/slurmctld/slurmctld.h"
 
-static char *	_dump_all_nodes(int *node_cnt, int state_info);
+static char *	_dump_all_nodes(int *node_cnt, time_t update_time);
 static char *	_dump_node(struct node_record *node_ptr, hostlist_t hl, 
-			   int state_info);
+			   time_t update_time);
 static char *	_get_node_state(struct node_record *node_ptr);
 static int	_same_info(struct node_record *node1_ptr, 
-			   struct node_record *node2_ptr, int state_info);
+			   struct node_record *node2_ptr, time_t update_time);
 static int	_str_cmp(char *s1, char *s2);
 
-#define SLURM_INFO_ALL		0
-#define SLURM_INFO_VOLITILE	1
-#define SLURM_INFO_STATE	2
-
 /*
  * get_nodes - get information on specific node(s) changed since some time
  * cmd_ptr IN   - CMD=GETNODES ARG=[<UPDATETIME>:<NODEID>[:<NODEID>]...]
@@ -83,7 +79,7 @@ extern int	get_nodes(char *cmd_ptr, int *err_code, char **err_msg)
 	/* Locks: read node, read partition */
 	slurmctld_lock_t node_read_lock = {
 		NO_LOCK, NO_LOCK, READ_LOCK, READ_LOCK };
-	int node_rec_cnt = 0, buf_size = 0, state_info;
+	int node_rec_cnt = 0, buf_size = 0;
 
 	arg_ptr = strstr(cmd_ptr, "ARG=");
 	if (arg_ptr == NULL) {
@@ -101,16 +97,9 @@ extern int	get_nodes(char *cmd_ptr, int *err_code, char **err_msg)
 	}
 	tmp_char++;
 	lock_slurmctld(node_read_lock);
-	if (update_time == 0)
-		state_info = SLURM_INFO_ALL;
-	else if (update_time > last_node_update)
-		state_info = SLURM_INFO_STATE;
-	else
-		state_info = SLURM_INFO_VOLITILE;
-
 	if (strncmp(tmp_char, "ALL", 3) == 0) {
 		/* report all nodes */
-		buf = _dump_all_nodes(&node_rec_cnt, state_info);
+		buf = _dump_all_nodes(&node_rec_cnt, update_time);
 	} else {
 		struct node_record *node_ptr = NULL;
 		char *node_name, *slurm_hosts;
@@ -126,7 +115,7 @@ extern int	get_nodes(char *cmd_ptr, int *err_code, char **err_msg)
 					      node_name);
 					continue;
 				}
-				tmp_buf = _dump_node(node_ptr, NULL, state_info);
+				tmp_buf = _dump_node(node_ptr, NULL, update_time);
 				if (node_rec_cnt > 0)
 					xstrcat(buf, "#");
 				xstrcat(buf, tmp_buf);
@@ -152,7 +141,7 @@ extern int	get_nodes(char *cmd_ptr, int *err_code, char **err_msg)
 	return 0;
 }
 
-static char *	_dump_all_nodes(int *node_cnt, int state_info)
+static char *	_dump_all_nodes(int *node_cnt, time_t update_time)
 {
 	int i, cnt = 0, rc;
 	struct node_record *node_ptr = node_record_table_ptr;
@@ -164,7 +153,7 @@ static char *	_dump_all_nodes(int *node_cnt, int state_info)
 		if (node_ptr->name == NULL)
 			continue;
 		if (use_host_exp == 2) {
-			rc = _same_info(uniq_node_ptr, node_ptr, state_info);
+			rc = _same_info(uniq_node_ptr, node_ptr, update_time);
 			if (rc == 0) {
 				uniq_node_ptr = node_ptr;
 				if (hl) {
@@ -177,7 +166,7 @@ static char *	_dump_all_nodes(int *node_cnt, int state_info)
 				continue;
 			} else {
 				tmp_buf = _dump_node(uniq_node_ptr, hl, 
-						     state_info);
+						     update_time);
 				hostlist_destroy(hl);
 				hl = hostlist_create(node_ptr->name);
 				if (hl == NULL)
@@ -185,7 +174,7 @@ static char *	_dump_all_nodes(int *node_cnt, int state_info)
 				uniq_node_ptr = node_ptr;
 			}
 		} else {
-			tmp_buf = _dump_node(node_ptr, hl, state_info);
+			tmp_buf = _dump_node(node_ptr, hl, update_time);
 		}
 		if (cnt > 0)
 			xstrcat(buf, "#");
@@ -195,7 +184,7 @@ static char *	_dump_all_nodes(int *node_cnt, int state_info)
 	}
 
 	if (hl) {
-		tmp_buf = _dump_node(uniq_node_ptr, hl, state_info);
+		tmp_buf = _dump_node(uniq_node_ptr, hl, update_time);
 		hostlist_destroy(hl);
 		if (cnt > 0)
 			xstrcat(buf, "#");
@@ -213,7 +202,7 @@ static char *	_dump_all_nodes(int *node_cnt, int state_info)
  *     >0 otherwise
  */
 static int	_same_info(struct node_record *node1_ptr, 
-			   struct node_record *node2_ptr, int state_info)
+			   struct node_record *node2_ptr, time_t update_time)
 {
 	int i;
 
@@ -224,7 +213,7 @@ static int	_same_info(struct node_record *node1_ptr,
 		return 1;
 	if (_str_cmp(node1_ptr->reason, node2_ptr->reason))
 		return 2;
-	if (state_info == SLURM_INFO_STATE)
+	if (update_time > last_node_update)
 		return 0;
 
 	if (slurmctld_conf.fast_schedule) {
@@ -246,7 +235,7 @@ static int	_same_info(struct node_record *node1_ptr,
 		return 7;
 	if (_str_cmp(node1_ptr->os, node2_ptr->os))
 		return 8;
-	if (state_info == SLURM_INFO_VOLITILE)
+	if (update_time > 0)
 		return 0;
 
 	if (slurmctld_conf.fast_schedule) {
@@ -271,7 +260,7 @@ static int	_same_info(struct node_record *node1_ptr,
 }
 
 static char *	_dump_node(struct node_record *node_ptr, hostlist_t hl, 
-			   int state_info)
+			   time_t update_time)
 {
 	char tmp[16*1024], *buf = NULL;
 	int i;
@@ -280,7 +269,6 @@ static char *	_dump_node(struct node_record *node_ptr, hostlist_t hl,
 	if (!node_ptr)
 		return NULL;
 
-	/* SLURM_INFO_STATE or SLURM_INFO_VOLITILE or SLURM_INFO_ALL */
 	if (hl) {
 		hostlist_sort(hl);
 		hostlist_uniq(hl);
@@ -298,11 +286,9 @@ static char *	_dump_node(struct node_record *node_ptr, hostlist_t hl,
 		xstrcat(buf, tmp);
 	}
 	
-	if (state_info == SLURM_INFO_STATE)
+	if (update_time > last_node_update)
 		return buf;
 
-
-	/* SLURM_INFO_VOLITILE or SLURM_INFO_ALL */
 	if (slurmctld_conf.fast_schedule) {
 		/* config from slurm.conf */
 		cpu_cnt = node_ptr->config_ptr->cpus;
@@ -331,11 +317,9 @@ static char *	_dump_node(struct node_record *node_ptr, hostlist_t hl,
 		xstrcat(buf, tmp);
 	}
 
-	if (state_info == SLURM_INFO_VOLITILE)
+	if (update_time > 0)
 		return buf;
 
-
-	/* SLURM_INFO_ALL only */
 	if (slurmctld_conf.fast_schedule) {
 		/* config from slurm.conf */
 		snprintf(tmp, sizeof(tmp),
-- 
GitLab