From 81a2335a0d795b15677e86c002b0b3e053d0850a Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Thu, 23 Mar 2006 21:59:59 +0000
Subject: [PATCH] srun to print jobid and jobid_set parameters used when run in
 verbose mode. clear jobid from batch request unless explicitly set on command
 line   (don't use SLURM_JOBID env var). permits submitting new batch job from
   within an existing job allocation.

---
 src/srun/opt.c  | 2 ++
 src/srun/srun.c | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/srun/opt.c b/src/srun/opt.c
index 90426a00d5f..b4b493d93f8 100644
--- a/src/srun/opt.c
+++ b/src/srun/opt.c
@@ -1876,6 +1876,8 @@ static void _opt_list()
 		info("nodes          : %d %s", opt.min_nodes,
 			opt.nodes_set ? "(set)" : "(default)");
 	}
+	info("jobid          : %u %s", opt.jobid, 
+		opt.jobid_set ? "(set)" : "(default)");
 	info("partition      : %s",
 		opt.partition == NULL ? "default" : opt.partition);
 	info("job name       : `%s'", opt.job_name);
diff --git a/src/srun/srun.c b/src/srun/srun.c
index e8308739a37..b4ba6a12931 100644
--- a/src/srun/srun.c
+++ b/src/srun/srun.c
@@ -460,8 +460,8 @@ _run_batch_job(void)
 
 	/* Do not re-use existing job id from environment variable
 	 * when submitting new job from within a running job */
-	if (opt.jobid_set != NO_VAL)
-		req->job_id = (uint32_t)opt.jobid;
+	if (!opt.jobid_set)
+		req->job_id = NO_VAL;
 
 	retries = 0;
 	while (  (retries < MAX_RETRIES)
-- 
GitLab