From d10ead311e3fa1395c27a0a048d97cdc99db9e43 Mon Sep 17 00:00:00 2001 From: Danny Auble <da@schedmd.com> Date: Wed, 5 Nov 2014 16:02:31 -0800 Subject: [PATCH] Remove code that tried to figure out node counts in pending jobs in various tools. This was fixed in 14.11, so this code should be all no-op there, but just to be safe we removed it here. --- src/api/job_info.c | 9 ------- src/smap/job_functions.c | 55 +--------------------------------------- src/squeue/print.c | 48 ++--------------------------------- src/sview/job_info.c | 43 +++---------------------------- 4 files changed, 7 insertions(+), 148 deletions(-) diff --git a/src/api/job_info.c b/src/api/job_info.c index 7db6e0b1a27..111c262ea04 100644 --- a/src/api/job_info.c +++ b/src/api/job_info.c @@ -652,15 +652,6 @@ line6: max_nodes = min_nodes; } else if (IS_JOB_PENDING(job_ptr)) { min_nodes = job_ptr->num_nodes; - if ((min_nodes == 1) && (job_ptr->num_cpus > 1) - && job_ptr->ntasks_per_node - && (job_ptr->ntasks_per_node != (uint16_t) NO_VAL)) { - int node_cnt2 = job_ptr->num_cpus; - node_cnt2 = (node_cnt2 + job_ptr->ntasks_per_node - 1) - / job_ptr->ntasks_per_node; - if (min_nodes < node_cnt2) - min_nodes = node_cnt2; - } max_nodes = job_ptr->max_nodes; if (max_nodes && (max_nodes < min_nodes)) min_nodes = max_nodes; diff --git a/src/smap/job_functions.c b/src/smap/job_functions.c index 4e6cb2979f9..43f08d2abaf 100644 --- a/src/smap/job_functions.c +++ b/src/smap/job_functions.c @@ -43,9 +43,6 @@ #include "src/common/parse_time.h" #include "src/smap/smap.h" -static int _get_node_cnt(job_info_t * job); -static int _max_cpus_per_node(void); -static int _nodes_in_list(char *node_list); static void _print_header_job(void); static int _print_text_job(job_info_t * job_ptr); @@ -308,7 +305,7 @@ static int _print_text_job(job_info_t * job_ptr) node_cnt = job_ptr->num_nodes; if ((node_cnt == 0) || (node_cnt == NO_VAL)) - node_cnt = _get_node_cnt(job_ptr); + node_cnt = job_ptr->num_nodes; if (params.cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)node_cnt, tmp_cnt, @@ -450,53 +447,3 @@ static int _print_text_job(job_info_t * job_ptr) return printed; } - -static int _get_node_cnt(job_info_t * job) -{ - int node_cnt = 0, round; - bool completing = job->job_state & JOB_COMPLETING; - uint16_t base_job_state = job->job_state & (~JOB_COMPLETING); - static int max_cpus = 0; - - if (base_job_state == JOB_PENDING || completing) { - if (max_cpus == 0) - max_cpus = _max_cpus_per_node(); - - node_cnt = _nodes_in_list(job->req_nodes); - node_cnt = MAX(node_cnt, job->num_nodes); - round = job->num_cpus + max_cpus - 1; - round /= max_cpus; /* round up */ - node_cnt = MAX(node_cnt, round); - } else - node_cnt = _nodes_in_list(job->nodes); - return node_cnt; -} - -static int _nodes_in_list(char *node_list) -{ - hostset_t host_set = hostset_create(node_list); - int count = hostset_count(host_set); - hostset_destroy(host_set); - return count; -} - -/* Return the maximum number of processors for any node in the cluster */ -static int _max_cpus_per_node(void) -{ - int error_code, max_cpus = 1; - node_info_msg_t *node_info_ptr = NULL; - - error_code = slurm_load_node ((time_t) NULL, &node_info_ptr, - params.all_flag ? 1 : 0); - if (error_code == SLURM_SUCCESS) { - int i; - node_info_t *node_ptr = node_info_ptr->node_array; - for (i=0; i<node_info_ptr->record_count; i++) { - max_cpus = MAX(max_cpus, node_ptr[i].cpus); - } - slurm_free_node_info_msg (node_info_ptr); - } - - return max_cpus; -} - diff --git a/src/squeue/print.c b/src/squeue/print.c index 33b0e39faf7..24407ddc463 100644 --- a/src/squeue/print.c +++ b/src/squeue/print.c @@ -61,9 +61,7 @@ static int _filter_job(job_info_t * job); static int _filter_job_part(char *part_name); static int _filter_step(job_step_info_t * step); -static int _get_node_cnt(job_info_t * job); static void _job_list_del(void *x); -static int _nodes_in_list(char *node_list); static uint32_t _part_get_prio(char *part_name); static void _part_state_free(void); static void _part_state_load(void); @@ -951,7 +949,7 @@ int _print_job_num_nodes(job_info_t * job, int width, bool right_justify, &node_cnt); if ((node_cnt == 0) || (node_cnt == NO_VAL)) - node_cnt = _get_node_cnt(job); + node_cnt = job->num_nodes; if (params.cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)node_cnt, tmp_char, @@ -966,40 +964,6 @@ int _print_job_num_nodes(job_info_t * job, int width, bool right_justify, return SLURM_SUCCESS; } -static int _get_node_cnt(job_info_t * job) -{ - int node_cnt = 0; - - /* 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); - if ((node_cnt == 1) && (job->num_cpus > 1) - && job->ntasks_per_node - && (job->ntasks_per_node != (uint16_t) NO_VAL)) { - int num_tasks = job->num_cpus; - if (job->cpus_per_task != (uint16_t) NO_VAL) - num_tasks /= job->cpus_per_task; - node_cnt = (num_tasks + 1) / job->ntasks_per_node; - if (node_cnt > num_tasks) - node_cnt = num_tasks; - else if (!node_cnt) - node_cnt = 1; - } - } else - node_cnt = _nodes_in_list(job->nodes); - return node_cnt; -} - int _print_job_num_sct(job_info_t * job, int width, bool right_justify, char* suffix) { @@ -1039,14 +1003,6 @@ int _print_job_num_sct(job_info_t * job, int width, bool right_justify, return SLURM_SUCCESS; } -static int _nodes_in_list(char *node_list) -{ - hostset_t host_set = hostset_create(node_list); - int count = hostset_count(host_set); - hostset_destroy(host_set); - return count; -} - int _print_job_shared(job_info_t * job, int width, bool right_justify, char* suffix) { @@ -1552,7 +1508,7 @@ int _print_job_max_nodes(job_info_t * job, int width, bool right_justify, else if (job->max_nodes != 0) _print_int(job->max_nodes, width, right_justify, true); else - _print_int(_get_node_cnt(job), width, right_justify, true); + _print_int(job->num_nodes, width, right_justify, true); if (suffix) printf("%s",suffix); diff --git a/src/sview/job_info.c b/src/sview/job_info.c index bf193736da7..d778b83a3b7 100644 --- a/src/sview/job_info.c +++ b/src/sview/job_info.c @@ -1286,40 +1286,6 @@ static int _nodes_in_list(char *node_list) return count; } -static int _get_node_cnt(job_info_t * job) -{ - int node_cnt = 0; - - /* 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); - if ((node_cnt == 1) && (job->num_cpus > 1) - && job->ntasks_per_node - && (job->ntasks_per_node != (uint16_t) NO_VAL)) { - int num_tasks = job->num_cpus; - if (job->cpus_per_task != (uint16_t) NO_VAL) - num_tasks /= job->cpus_per_task; - node_cnt = (num_tasks + 1) / job->ntasks_per_node; - if (node_cnt > num_tasks) - node_cnt = num_tasks; - else if (!node_cnt) - node_cnt = 1; - } - } else - node_cnt = _nodes_in_list(job->nodes); - return node_cnt; -} - /* this needs to be freed by xfree() */ static void _convert_char_to_job_and_step(const char *data, int *jobid, int *stepid) @@ -1778,7 +1744,7 @@ static void _layout_job_record(GtkTreeView *treeview, tmp_char, sizeof(tmp_char), UNIT_NONE); else snprintf(tmp_char, sizeof(tmp_char), "%u", - job_ptr->num_nodes); + sview_job_info_ptr->node_cnt); add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_job, @@ -3218,11 +3184,10 @@ static List _create_job_info_list(job_info_msg_t *job_info_ptr, xstrdup(job_ptr->nodes); } xfree(ionodes); - } else + } else { sview_job_info_ptr->nodes = xstrdup(job_ptr->nodes); - - if (!sview_job_info_ptr->node_cnt) - sview_job_info_ptr->node_cnt = _get_node_cnt(job_ptr); + sview_job_info_ptr->node_cnt = job_ptr->num_nodes; + } for (j = 0; j < step_info_ptr->job_step_count; j++) { step_ptr = &(step_info_ptr->job_steps[j]); -- GitLab