From 2c32b1ed0764093e7f3a113a1e6ecda4e1fba7ad Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Wed, 12 Nov 2008 19:09:21 +0000 Subject: [PATCH] re-arrange some logic for clarity, same functionality --- src/slurmctld/step_mgr.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/slurmctld/step_mgr.c b/src/slurmctld/step_mgr.c index 37c1aa64495..ad86aaf2a15 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); -- GitLab