Skip to content
Snippets Groups Projects
Commit 169d62c8 authored by Danny Auble's avatar Danny Auble
Browse files

fix to allow hostlists when they are requested instead of implying them

parent c42fe448
No related branches found
No related tags found
No related merge requests found
...@@ -238,15 +238,6 @@ int srun(int ac, char **av) ...@@ -238,15 +238,6 @@ int srun(int ac, char **av)
} else if ((resp = existing_allocation())) { } else if ((resp = existing_allocation())) {
job_id = resp->job_id; job_id = resp->job_id;
/* If opt.nodelist isn't set we initialize it from the
* allocation info, but only if the env variable SLURM_HOSTFILE
* ISN'T set, because SLURM_HOSTFILE isn't parsed until
* job_step_create_allocation is called (bad design, all env
* variable parsing should happen up front in opt.c with the
* rest of the option parsing).
*/
if (opt.nodelist == NULL && getenv("SLURM_HOSTFILE") == NULL)
opt.nodelist = xstrdup(resp->node_list);
slurm_free_resource_allocation_response_msg(resp); slurm_free_resource_allocation_response_msg(resp);
if (opt.allocate) { if (opt.allocate) {
error("job %u already has an allocation", error("job %u already has an allocation",
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* any later version. * any later version.
* *
* In addition, as a special exception, the copyright holders give permission * In addition, as a special exception, the copyright holders give permission
* to link the code of portions of this program with the OpenSSL library under * to link the code of portions of this program with the OpenSSL library under
* certain conditions as described in each individual source file, and * certain conditions as described in each individual source file, and
* distribute linked combinations including the two. You must obey the GNU * distribute linked combinations including the two. You must obey the GNU
* General Public License in all respects for all of the code used other than * General Public License in all respects for all of the code used other than
...@@ -163,13 +163,18 @@ job_step_create_allocation(uint32_t job_id) ...@@ -163,13 +163,18 @@ job_step_create_allocation(uint32_t job_id)
if(!opt.max_nodes) if(!opt.max_nodes)
opt.max_nodes = opt.min_nodes; opt.max_nodes = opt.min_nodes;
/* The reason we read in from the hostfile here is so if we don't
* need all the hostfile we only get what the user asked for
* (i.e. opt.max_nodes)
*/
if (opt.nodelist == NULL) { if (opt.nodelist == NULL) {
char *nodelist = NULL; char *nodelist = NULL;
char *hostfile = getenv("SLURM_HOSTFILE"); char *hostfile = getenv("SLURM_HOSTFILE");
if (hostfile != NULL) { if (hostfile != NULL) {
nodelist = slurm_read_hostfile(hostfile, opt.nprocs); nodelist = slurm_read_hostfile(hostfile,
opt.max_nodes);
if (nodelist == NULL) { if (nodelist == NULL) {
error("Failure getting NodeNames from " error("Failure getting NodeNames from "
"hostfile"); "hostfile");
...@@ -184,7 +189,7 @@ job_step_create_allocation(uint32_t job_id) ...@@ -184,7 +189,7 @@ job_step_create_allocation(uint32_t job_id)
} }
} }
ai->nodelist = opt.alloc_nodelist; ai->nodelist = opt.alloc_nodelist;
if (opt.exc_nodes) { if (opt.exc_nodes) {
hostlist_t exc_hl = hostlist_create(opt.exc_nodes); hostlist_t exc_hl = hostlist_create(opt.exc_nodes);
char *node_name = NULL; char *node_name = NULL;
...@@ -308,7 +313,7 @@ job_step_create_allocation(uint32_t job_id) ...@@ -308,7 +313,7 @@ job_step_create_allocation(uint32_t job_id)
hostlist_uniq(hl); hostlist_uniq(hl);
ai->nnodes = hostlist_count(hl); ai->nnodes = hostlist_count(hl);
hostlist_destroy(hl); hostlist_destroy(hl);
} else if((opt.max_nodes > 0) && (opt.max_nodes <ai->nnodes)) } else if((opt.max_nodes > 0) && (opt.max_nodes < ai->nnodes))
ai->nnodes = opt.max_nodes; ai->nnodes = opt.max_nodes;
/* /*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment