Skip to content
Snippets Groups Projects
Commit 2c32b1ed authored by Moe Jette's avatar Moe Jette
Browse files

re-arrange some logic for clarity, same functionality

parent 1a0b8e2c
No related branches found
No related tags found
No related merge requests found
...@@ -1102,12 +1102,11 @@ step_create(job_step_create_request_msg_t *step_specs, ...@@ -1102,12 +1102,11 @@ step_create(job_step_create_request_msg_t *step_specs,
(strlen(step_specs->ckpt_path) > MAX_STR_LEN))) (strlen(step_specs->ckpt_path) > MAX_STR_LEN)))
return ESLURM_PATHNAME_TOO_LONG; return ESLURM_PATHNAME_TOO_LONG;
/* we can figure out the cpus_per_task here by reversing what happens /* determine cpus_per_task value by reversing what srun does */
* in srun, record argument in slurm v1.4 */ if (step_specs->num_tasks < 1)
return ESLURM_BAD_TASK_COUNT;
if (step_specs->cpu_count == 0) if (step_specs->cpu_count == 0)
cpus_per_task = 0; cpus_per_task = 0;
else if (step_specs->num_tasks < 1)
cpus_per_task = 1;
else { else {
cpus_per_task = step_specs->cpu_count / step_specs->num_tasks; cpus_per_task = step_specs->cpu_count / step_specs->num_tasks;
if (cpus_per_task < 1) if (cpus_per_task < 1)
...@@ -1141,8 +1140,7 @@ step_create(job_step_create_request_msg_t *step_specs, ...@@ -1141,8 +1140,7 @@ step_create(job_step_create_request_msg_t *step_specs,
step_specs->num_tasks = node_count; step_specs->num_tasks = node_count;
} }
if ((step_specs->num_tasks < 1) if (step_specs->num_tasks > (node_count*MAX_TASKS_PER_NODE)) {
|| (step_specs->num_tasks > (node_count*MAX_TASKS_PER_NODE))) {
error("step has invalid task count: %u", error("step has invalid task count: %u",
step_specs->num_tasks); step_specs->num_tasks);
bit_free(nodeset); bit_free(nodeset);
......
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