From d1199d9d1cfd62fdf8d0dae402074455df4df540 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Mon, 18 Jul 2005 21:25:04 +0000
Subject: [PATCH] Permit srun to specify jobid on allocation request (needed
 for AIX/poe restart).

---
 src/srun/allocate.c |  2 ++
 src/srun/srun.c     | 30 +++++++++++++++---------------
 2 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/src/srun/allocate.c b/src/srun/allocate.c
index 11f3146bbac..13a7b815ae5 100644
--- a/src/srun/allocate.c
+++ b/src/srun/allocate.c
@@ -381,6 +381,8 @@ job_desc_msg_create_from_opts (char *script)
 
 	if (opt.hold)
 		j->priority     = 0;
+	if (opt.jobid != NO_VAL)
+		j->job_id	= opt.jobid;
 
 #if SYSTEM_DIMENSIONS
 	if (opt.geometry[0] > 0) {
diff --git a/src/srun/srun.c b/src/srun/srun.c
index 4532dfe94f4..a6eb97ad098 100644
--- a/src/srun/srun.c
+++ b/src/srun/srun.c
@@ -167,21 +167,6 @@ int srun(int ac, char **av)
 		job = job_create_noalloc(); 
 		_switch_standalone(job);
 
-	} else if ( (resp = existing_allocation()) ) {
-		if (opt.allocate) {
-			error("job %u already has an allocation", 
-			      resp->job_id);
-			exit(1);
-		}
-		if (job_resp_hack_for_step(resp))	/* FIXME */
-			exit(1);
-		job = job_create_allocation(resp); 
-		job->old_job = true;
-		sig_setup_sigmask();
-		if (create_job_step(job) < 0)
-			exit(1);
-		slurm_free_resource_allocation_response_msg(resp);
-
 	} else if (opt.allocate) {
 		sig_setup_sigmask();
 		if ( !(resp = allocate_nodes()) ) 
@@ -205,6 +190,21 @@ int srun(int ac, char **av)
 		xfree(env);
 		exit (exitcode);
 
+	} else if ( (resp = existing_allocation()) ) {
+		if (opt.allocate) {
+			error("job %u already has an allocation",
+				resp->job_id);
+			exit(1);
+		}
+		if (job_resp_hack_for_step(resp))	/* FIXME */
+			exit(1);
+		job = job_create_allocation(resp);
+		job->old_job = true;
+		sig_setup_sigmask();
+		if (create_job_step(job) < 0)
+			exit(1);
+		slurm_free_resource_allocation_response_msg(resp);
+		
 	} else if (mode == MODE_ATTACH) {
 		reattach();
 		exit (0);
-- 
GitLab