diff --git a/src/slurmctld/step_mgr.c b/src/slurmctld/step_mgr.c index 37c1aa64495e81f9dc8d29cce98bbc4470ebbd81..ad86aaf2a15ecd329948cb83e2c0bcb47f1df094 100644 --- a/src/slurmctld/step_mgr.c +++ b/src/slurmctld/step_mgr.c @@ -1102,12 +1102,11 @@ step_create(job_step_create_request_msg_t *step_specs, (strlen(step_specs->ckpt_path) > MAX_STR_LEN))) return ESLURM_PATHNAME_TOO_LONG; - /* we can figure out the cpus_per_task here by reversing what happens - * in srun, record argument in slurm v1.4 */ + /* determine cpus_per_task value by reversing what srun does */ + if (step_specs->num_tasks < 1) + return ESLURM_BAD_TASK_COUNT; if (step_specs->cpu_count == 0) cpus_per_task = 0; - else if (step_specs->num_tasks < 1) - cpus_per_task = 1; else { cpus_per_task = step_specs->cpu_count / step_specs->num_tasks; if (cpus_per_task < 1) @@ -1141,8 +1140,7 @@ step_create(job_step_create_request_msg_t *step_specs, step_specs->num_tasks = node_count; } - if ((step_specs->num_tasks < 1) - || (step_specs->num_tasks > (node_count*MAX_TASKS_PER_NODE))) { + if (step_specs->num_tasks > (node_count*MAX_TASKS_PER_NODE)) { error("step has invalid task count: %u", step_specs->num_tasks); bit_free(nodeset);