From ab2dea3a7ea0a401ba3e6a272f5c88e4d4c47ead Mon Sep 17 00:00:00 2001 From: Morris Jette <jette@schedmd.com> Date: Tue, 17 Jul 2012 14:51:37 -0700 Subject: [PATCH] In sview, only report count of requested nodes if job is pending. This corresponds to commit dd2dce542d6b75930d63839ac15bd92dfaac719b from Mark Grondona's work in squeue, but applied to the sview command. --- src/squeue/print.c | 3 +-- src/sview/job_info.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/squeue/print.c b/src/squeue/print.c index bc4332ae34b..ce123d85725 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 270eac1016c..cd995183d56 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 -- GitLab