diff --git a/src/squeue/print.c b/src/squeue/print.c index bc4332ae34bba7afa3afbcf4b4f36672cc4b2444..ce123d85725663738b264b11a2f26bc5dbbd7eb4 100644 --- a/src/squeue/print.c +++ b/src/squeue/print.c @@ -751,7 +751,6 @@ int _print_job_num_nodes(job_info_t * job, int width, bool right_justify, static int _get_node_cnt(job_info_t * job) { int node_cnt = 0, round; - uint16_t base_job_state = job->job_state & (~JOB_COMPLETING); /* For PENDING jobs, return the maximum of the requested nodelist, * requested maximum number of nodes, or requested CPUs rounded @@ -763,7 +762,7 @@ static int _get_node_cnt(job_info_t * job) * allocated to this job. */ - if (base_job_state == JOB_PENDING) { + if (IS_JOB_PENDING(job)) { node_cnt = _nodes_in_list(job->req_nodes); node_cnt = MAX(node_cnt, job->num_nodes); round = job->num_cpus + params.max_cpus - 1; diff --git a/src/sview/job_info.c b/src/sview/job_info.c index 270eac1016c99d04c499633e4d593e28f28909f5..cd995183d56ba1223e0cf798767ea684c69234cc 100644 --- a/src/sview/job_info.c +++ b/src/sview/job_info.c @@ -1211,7 +1211,17 @@ static int _get_node_cnt(job_info_t * job) { int node_cnt = 0; - if (IS_JOB_PENDING(job) || IS_JOB_COMPLETING(job)) { + /* For PENDING jobs, return the maximum of the requested nodelist, + * requested maximum number of nodes, or requested CPUs rounded + * to nearest node. + * + * For COMPLETING jobs, the job->nodes nodelist has already been + * altered to list only the nodes still in the comp state, and + * thus we count only those nodes toward the total nodes still + * allocated to this job. + */ + + if (IS_JOB_PENDING(job)) { node_cnt = _nodes_in_list(job->req_nodes); node_cnt = MAX(node_cnt, job->num_nodes); } else