Skip to content
Snippets Groups Projects
Commit 698575a2 authored by Danny Auble's avatar Danny Auble
Browse files

ok, sinfo now does cross cluster

parent bdb51ea6
No related branches found
No related tags found
No related merge requests found
......@@ -136,12 +136,24 @@ extern void parse_command_line(int argc, char *argv[])
params.all_flag = true;
break;
case (int)'b':
if(working_cluster_rec) {
if(working_cluster_rec->flags & CLUSTER_FLAG_BG)
params.bg_flag = true;
else {
error("must be on a BG system to use "
"--bg option");
exit(1);
}
} else {
#ifdef HAVE_BG
params.bg_flag = true;
#else
error("must be on a BG system to use --bg option");
error("Must be on a BG system to use --bg option, "
"if using --cluster option put the --bg option "
"after the --cluster option.");
exit(1);
#endif
}
break;
case (int)'d':
params.dead_nodes = true;
......@@ -241,11 +253,20 @@ extern void parse_command_line(int argc, char *argv[])
if ( params.format == NULL ) {
if ( params.summarize ) {
if(working_cluster_rec) {
if(working_cluster_rec->flags & CLUSTER_FLAG_BG)
params.format =
"%9P %.5a %.10l %.32F %N";
else
params.format =
"%9P %.5a %.10l %.16F %N";
} else {
#ifdef HAVE_BG
params.format = "%9P %.5a %.10l %.32F %N";
params.format = "%9P %.5a %.10l %.32F %N";
#else
params.format = "%9P %.5a %.10l %.16F %N";
params.format = "%9P %.5a %.10l %.16F %N";
#endif
}
} else if ( params.node_flag ) {
params.node_field_flag = true; /* compute size later */
params.format = params.long_output ?
......
......@@ -332,21 +332,47 @@ int _print_cpus_aiot(sinfo_data_t * sinfo_data, int width,
char tmpo[8];
char tmpt[8];
if (sinfo_data) {
if(working_cluster_rec) {
if(working_cluster_rec->flags & CLUSTER_FLAG_BG) {
convert_num_unit((float)sinfo_data->cpus_alloc,
tmpa, sizeof(tmpa), UNIT_NONE);
convert_num_unit((float)sinfo_data->cpus_idle,
tmpi, sizeof(tmpi), UNIT_NONE);
convert_num_unit((float)sinfo_data->cpus_other,
tmpo, sizeof(tmpo), UNIT_NONE);
convert_num_unit((float)sinfo_data->cpus_total,
tmpt, sizeof(tmpt), UNIT_NONE);
} else {
snprintf(tmpa, sizeof(tmpa), "%u",
sinfo_data->cpus_alloc);
snprintf(tmpi, sizeof(tmpi), "%u",
sinfo_data->cpus_idle);
snprintf(tmpo, sizeof(tmpo), "%u",
sinfo_data->cpus_other);
snprintf(tmpt, sizeof(tmpt), "%u",
sinfo_data->cpus_total);
}
} else {
#ifdef HAVE_BG
convert_num_unit((float)sinfo_data->cpus_alloc,
tmpa, sizeof(tmpa), UNIT_NONE);
convert_num_unit((float)sinfo_data->cpus_idle,
tmpi, sizeof(tmpi), UNIT_NONE);
convert_num_unit((float)sinfo_data->cpus_other,
tmpo, sizeof(tmpo), UNIT_NONE);
convert_num_unit((float)sinfo_data->cpus_total,
tmpt, sizeof(tmpt), UNIT_NONE);
convert_num_unit((float)sinfo_data->cpus_alloc,
tmpa, sizeof(tmpa), UNIT_NONE);
convert_num_unit((float)sinfo_data->cpus_idle,
tmpi, sizeof(tmpi), UNIT_NONE);
convert_num_unit((float)sinfo_data->cpus_other,
tmpo, sizeof(tmpo), UNIT_NONE);
convert_num_unit((float)sinfo_data->cpus_total,
tmpt, sizeof(tmpt), UNIT_NONE);
#else
sprintf(tmpa, "%u", sinfo_data->cpus_alloc);
sprintf(tmpi, "%u", sinfo_data->cpus_idle);
sprintf(tmpo, "%u", sinfo_data->cpus_other);
sprintf(tmpt, "%u", sinfo_data->cpus_total);
snprintf(tmpa, sizeof(tmpa), "%u",
sinfo_data->cpus_alloc);
snprintf(tmpi, sizeof(tmpi), "%u",
sinfo_data->cpus_idle);
snprintf(tmpo, sizeof(tmpo), "%u",
sinfo_data->cpus_other);
snprintf(tmpt, sizeof(tmpt), "%u",
sinfo_data->cpus_total);
#endif
}
snprintf(id, FORMAT_STRING_SIZE, "%s/%s/%s/%s",
tmpa, tmpi, tmpo, tmpt);
_print_str(id, width, right_justify, true);
......@@ -556,11 +582,16 @@ int _print_node_list(sinfo_data_t * sinfo_data, int width,
sizeof(tmp), tmp);
_print_str(tmp, width, right_justify, true);
} else {
char *title = "NODELIST";
if(working_cluster_rec) {
if(working_cluster_rec->flags & CLUSTER_FLAG_BG)
title = "BP_LIST";
} else {
#ifdef HAVE_BG
_print_str("BP_LIST", width, right_justify, false);
#else
_print_str("NODELIST", width, right_justify, false);
title = "BP_LIST";
#endif
}
_print_str(title, width, right_justify, false);
}
if (suffix)
......@@ -574,12 +605,22 @@ int _print_nodes_t(sinfo_data_t * sinfo_data, int width,
char id[FORMAT_STRING_SIZE];
char tmp[8];
if (sinfo_data) {
if(working_cluster_rec) {
if(working_cluster_rec->flags & CLUSTER_FLAG_BG)
convert_num_unit((float)sinfo_data->nodes_total,
tmp, sizeof(tmp), UNIT_NONE);
else
snprintf(tmp, sizeof(tmp), "%d",
sinfo_data->nodes_total);
} else {
#ifdef HAVE_BG
convert_num_unit((float)sinfo_data->nodes_total, tmp,
sizeof(tmp), UNIT_NONE);
convert_num_unit((float)sinfo_data->nodes_total, tmp,
sizeof(tmp), UNIT_NONE);
#else
snprintf(tmp, sizeof(tmp), "%d", sinfo_data->nodes_total);
snprintf(tmp, sizeof(tmp), "%d",
sinfo_data->nodes_total);
#endif
}
snprintf(id, FORMAT_STRING_SIZE, "%s", tmp);
_print_str(id, width, right_justify, true);
} else
......@@ -597,15 +638,31 @@ int _print_nodes_ai(sinfo_data_t * sinfo_data, int width,
char tmpa[8];
char tmpi[8];
if (sinfo_data) {
if(working_cluster_rec) {
if(working_cluster_rec->flags & CLUSTER_FLAG_BG) {
convert_num_unit((float)sinfo_data->nodes_alloc,
tmpa, sizeof(tmpa), UNIT_NONE);
convert_num_unit((float)sinfo_data->nodes_idle,
tmpi, sizeof(tmpi), UNIT_NONE);
} else {
snprintf(tmpa, sizeof(tmpa), "%d",
sinfo_data->nodes_alloc);
snprintf(tmpi, sizeof(tmpi), "%d",
sinfo_data->nodes_idle);
}
} else {
#ifdef HAVE_BG
convert_num_unit((float)sinfo_data->nodes_alloc,
convert_num_unit((float)sinfo_data->nodes_alloc,
tmpa, sizeof(tmpa), UNIT_NONE);
convert_num_unit((float)sinfo_data->nodes_idle,
tmpi, sizeof(tmpi), UNIT_NONE);
convert_num_unit((float)sinfo_data->nodes_idle,
tmpi, sizeof(tmpi), UNIT_NONE);
#else
snprintf(tmpa, sizeof(tmpa), "%d", sinfo_data->nodes_alloc);
snprintf(tmpi, sizeof(tmpi), "%d", sinfo_data->nodes_idle);
snprintf(tmpa, sizeof(tmpa), "%d",
sinfo_data->nodes_alloc);
snprintf(tmpi, sizeof(tmpi), "%d",
sinfo_data->nodes_idle);
#endif
}
snprintf(id, FORMAT_STRING_SIZE, "%s/%s",
tmpa, tmpi);
_print_str(id, width, right_justify, true);
......@@ -626,22 +683,47 @@ int _print_nodes_aiot(sinfo_data_t * sinfo_data, int width,
char tmpo[8];
char tmpt[8];
if (sinfo_data) {
if(working_cluster_rec) {
if(working_cluster_rec->flags & CLUSTER_FLAG_BG) {
convert_num_unit((float)sinfo_data->nodes_alloc,
tmpa, sizeof(tmpa), UNIT_NONE);
convert_num_unit((float)sinfo_data->nodes_idle,
tmpi, sizeof(tmpi), UNIT_NONE);
convert_num_unit((float)sinfo_data->nodes_other,
tmpo, sizeof(tmpo), UNIT_NONE);
convert_num_unit((float)sinfo_data->nodes_total,
tmpt, sizeof(tmpt), UNIT_NONE);
} else {
snprintf(tmpa, sizeof(tmpa), "%u",
sinfo_data->nodes_alloc);
snprintf(tmpi, sizeof(tmpi), "%u",
sinfo_data->nodes_idle);
snprintf(tmpo, sizeof(tmpo), "%u",
sinfo_data->nodes_other);
snprintf(tmpt, sizeof(tmpt), "%u",
sinfo_data->nodes_total);
}
} else {
#ifdef HAVE_BG
convert_num_unit((float)sinfo_data->nodes_alloc,
tmpa, sizeof(tmpa), UNIT_NONE);
convert_num_unit((float)sinfo_data->nodes_idle,
tmpi, sizeof(tmpi), UNIT_NONE);
convert_num_unit((float)sinfo_data->nodes_other,
tmpo, sizeof(tmpo), UNIT_NONE);
convert_num_unit((float)sinfo_data->nodes_total,
tmpt, sizeof(tmpt), UNIT_NONE);
convert_num_unit((float)sinfo_data->nodes_alloc,
tmpa, sizeof(tmpa), UNIT_NONE);
convert_num_unit((float)sinfo_data->nodes_idle,
tmpi, sizeof(tmpi), UNIT_NONE);
convert_num_unit((float)sinfo_data->nodes_other,
tmpo, sizeof(tmpo), UNIT_NONE);
convert_num_unit((float)sinfo_data->nodes_total,
tmpt, sizeof(tmpt), UNIT_NONE);
#else
snprintf(tmpa, sizeof(tmpa), "%u", sinfo_data->nodes_alloc);
snprintf(tmpi, sizeof(tmpi), "%u", sinfo_data->nodes_idle);
snprintf(tmpo, sizeof(tmpo), "%u", sinfo_data->nodes_other);
snprintf(tmpt, sizeof(tmpt), "%u", sinfo_data->nodes_total);
snprintf(tmpa, sizeof(tmpa), "%u",
sinfo_data->nodes_alloc);
snprintf(tmpi, sizeof(tmpi), "%u",
sinfo_data->nodes_idle);
snprintf(tmpo, sizeof(tmpo), "%u",
sinfo_data->nodes_other);
snprintf(tmpt, sizeof(tmpt), "%u",
sinfo_data->nodes_total);
#endif
}
snprintf(id, FORMAT_STRING_SIZE, "%s/%s/%s/%s",
tmpa, tmpi, tmpo, tmpt);
_print_str(id, width, right_justify, true);
......
......@@ -47,10 +47,8 @@
#include "src/sinfo/sinfo.h"
#include "src/sinfo/print.h"
#ifdef HAVE_BG
# include "src/plugins/select/bluegene/wrap_rm_api.h"
# include "src/plugins/select/bluegene/plugin/bluegene.h"
#endif
#include "src/plugins/select/bluegene/wrap_rm_api.h"
#include "src/plugins/select/bluegene/plugin/bluegene.h"
/********************
* Global Variables *
......@@ -162,8 +160,25 @@ static char *_node_use_str(int node_use)
static char *_part_state_str(int state)
{
static char tmp[16];
#ifdef HAVE_BG
/* This is needs to happen cross cluster. Since the enums
* changed. We don't handle BUSY or REBOOTING though, these
* states are extremely rare so it isn't that big of a deal.
*/
#ifdef HAVE_BGL
if(working_cluster_rec) {
if(!(working_cluster_rec->flags & CLUSTER_FLAG_BGL)) {
if(state == RM_PARTITION_BUSY)
state = RM_PARTITION_READY;
}
}
#else
if(working_cluster_rec) {
if(working_cluster_rec->flags & CLUSTER_FLAG_BGL) {
if(state == RM_PARTITION_REBOOTING)
state = RM_PARTITION_READY;
}
}
#endif
switch (state) {
#ifdef HAVE_BGL
case RM_PARTITION_BUSY:
......@@ -183,7 +198,6 @@ static char *_part_state_str(int state)
case RM_PARTITION_READY:
return "READY";
}
#endif
snprintf(tmp, sizeof(tmp), "%d", state);
return tmp;
......@@ -235,9 +249,8 @@ _query_server(partition_info_msg_t ** part_pptr,
{
static partition_info_msg_t *old_part_ptr = NULL, *new_part_ptr;
static node_info_msg_t *old_node_ptr = NULL, *new_node_ptr;
#ifdef HAVE_BG
static block_info_msg_t *old_bg_ptr = NULL, *new_bg_ptr;
#endif
int error_code;
uint16_t show_flags = 0;
......@@ -286,19 +299,41 @@ _query_server(partition_info_msg_t ** part_pptr,
old_node_ptr = new_node_ptr;
*node_pptr = new_node_ptr;
#ifdef HAVE_BG
if (old_bg_ptr) {
error_code = slurm_load_block_info(old_bg_ptr->last_update,
&new_bg_ptr);
if (error_code == SLURM_SUCCESS)
slurm_free_block_info_msg(&old_bg_ptr);
else if (slurm_get_errno() == SLURM_NO_CHANGE_IN_DATA) {
error_code = SLURM_SUCCESS;
new_bg_ptr = old_bg_ptr;
if(working_cluster_rec) {
if(working_cluster_rec->flags & CLUSTER_FLAG_BG) {
if (old_bg_ptr) {
error_code = slurm_load_block_info(
old_bg_ptr->last_update,
&new_bg_ptr);
if (error_code == SLURM_SUCCESS)
slurm_free_block_info_msg(&old_bg_ptr);
else if (slurm_get_errno() ==
SLURM_NO_CHANGE_IN_DATA) {
error_code = SLURM_SUCCESS;
new_bg_ptr = old_bg_ptr;
}
} else {
error_code = slurm_load_block_info(
(time_t) NULL, &new_bg_ptr);
}
}
} else {
error_code = slurm_load_block_info((time_t) NULL,
&new_bg_ptr);
#ifdef HAVE_BG
if (old_bg_ptr) {
error_code = slurm_load_block_info(
old_bg_ptr->last_update,
&new_bg_ptr);
if (error_code == SLURM_SUCCESS)
slurm_free_block_info_msg(&old_bg_ptr);
else if (slurm_get_errno() == SLURM_NO_CHANGE_IN_DATA) {
error_code = SLURM_SUCCESS;
new_bg_ptr = old_bg_ptr;
}
} else {
error_code = slurm_load_block_info((time_t) NULL,
&new_bg_ptr);
}
#endif
}
if (error_code) {
slurm_perror("slurm_load_block");
......@@ -306,7 +341,6 @@ _query_server(partition_info_msg_t ** part_pptr,
}
old_bg_ptr = new_bg_ptr;
*block_pptr = new_bg_ptr;
#endif
return SLURM_SUCCESS;
}
......@@ -707,58 +741,118 @@ static void _update_sinfo(sinfo_data_t *sinfo_ptr, node_info_t *node_ptr,
SELECT_NODEDATA_SUBCNT,
NODE_STATE_ERROR,
&error_cpus);
#ifdef HAVE_BG
if(error_cpus) {
xfree(node_ptr->reason);
node_ptr->reason = xstrdup("Block(s) in error state");
sinfo_ptr->reason = node_ptr->reason;
sinfo_ptr->reason_time= node_ptr->reason_time;
sinfo_ptr->reason_uid = node_ptr->reason_uid;
}
if(!params.match_flags.state_flag && (used_cpus || error_cpus)) {
/* We only get one shot at this (because all states
are combined together), so we need to make
sure we get all the subgrps accounted. (So use
g_node_scaling for safe measure) */
total_nodes = g_node_scaling;
sinfo_ptr->nodes_alloc += used_cpus;
sinfo_ptr->nodes_other += error_cpus;
sinfo_ptr->nodes_idle +=
(total_nodes - (used_cpus + error_cpus));
used_cpus *= single_node_cpus;
error_cpus *= single_node_cpus;
} else {
/* process only for this subgrp and then return */
total_cpus = total_nodes * single_node_cpus;
if(working_cluster_rec) {
if(working_cluster_rec->flags & CLUSTER_FLAG_BG) {
if(error_cpus) {
xfree(node_ptr->reason);
node_ptr->reason = xstrdup("Block(s) in error state");
sinfo_ptr->reason = node_ptr->reason;
sinfo_ptr->reason_time= node_ptr->reason_time;
sinfo_ptr->reason_uid = node_ptr->reason_uid;
}
if(!params.match_flags.state_flag
&& (used_cpus || error_cpus)) {
/* We only get one shot at this (because all states
are combined together), so we need to make
sure we get all the subgrps accounted. (So use
g_node_scaling for safe measure) */
total_nodes = g_node_scaling;
sinfo_ptr->nodes_alloc += used_cpus;
sinfo_ptr->nodes_other += error_cpus;
sinfo_ptr->nodes_idle +=
(total_nodes - (used_cpus + error_cpus));
used_cpus *= single_node_cpus;
error_cpus *= single_node_cpus;
} else {
/* process only for this subgrp and then return */
total_cpus = total_nodes * single_node_cpus;
if ((base_state == NODE_STATE_ALLOCATED)
|| (node_ptr->node_state
& NODE_STATE_COMPLETING)) {
sinfo_ptr->nodes_alloc += total_nodes;
sinfo_ptr->cpus_alloc += total_cpus;
} else if (IS_NODE_DRAIN(node_ptr) ||
(base_state == NODE_STATE_DOWN)) {
sinfo_ptr->nodes_other += total_nodes;
sinfo_ptr->cpus_other += total_cpus;
} else {
sinfo_ptr->nodes_idle += total_nodes;
sinfo_ptr->cpus_idle += total_cpus;
}
if ((base_state == NODE_STATE_ALLOCATED)
|| (node_ptr->node_state & NODE_STATE_COMPLETING)) {
sinfo_ptr->nodes_alloc += total_nodes;
sinfo_ptr->cpus_alloc += total_cpus;
} else if (IS_NODE_DRAIN(node_ptr) ||
(base_state == NODE_STATE_DOWN)) {
sinfo_ptr->nodes_other += total_nodes;
sinfo_ptr->cpus_other += total_cpus;
sinfo_ptr->nodes_total += total_nodes;
sinfo_ptr->cpus_total += total_cpus;
return;
}
} else {
sinfo_ptr->nodes_idle += total_nodes;
sinfo_ptr->cpus_idle += total_cpus;
if ((base_state == NODE_STATE_ALLOCATED) ||
IS_NODE_COMPLETING(node_ptr))
sinfo_ptr->nodes_alloc += total_nodes;
else if (IS_NODE_DRAIN(node_ptr)
|| (base_state == NODE_STATE_DOWN))
sinfo_ptr->nodes_other += total_nodes;
else
sinfo_ptr->nodes_idle += total_nodes;
}
} else {
#ifdef HAVE_BG
if(error_cpus) {
xfree(node_ptr->reason);
node_ptr->reason = xstrdup("Block(s) in error state");
sinfo_ptr->reason = node_ptr->reason;
sinfo_ptr->reason_time= node_ptr->reason_time;
sinfo_ptr->reason_uid = node_ptr->reason_uid;
}
if(!params.match_flags.state_flag
&& (used_cpus || error_cpus)) {
/* We only get one shot at this (because all states
are combined together), so we need to make
sure we get all the subgrps accounted. (So use
g_node_scaling for safe measure) */
total_nodes = g_node_scaling;
sinfo_ptr->nodes_alloc += used_cpus;
sinfo_ptr->nodes_other += error_cpus;
sinfo_ptr->nodes_idle +=
(total_nodes - (used_cpus + error_cpus));
used_cpus *= single_node_cpus;
error_cpus *= single_node_cpus;
} else {
/* process only for this subgrp and then return */
total_cpus = total_nodes * single_node_cpus;
if ((base_state == NODE_STATE_ALLOCATED)
|| (node_ptr->node_state & NODE_STATE_COMPLETING)) {
sinfo_ptr->nodes_alloc += total_nodes;
sinfo_ptr->cpus_alloc += total_cpus;
} else if (IS_NODE_DRAIN(node_ptr) ||
(base_state == NODE_STATE_DOWN)) {
sinfo_ptr->nodes_other += total_nodes;
sinfo_ptr->cpus_other += total_cpus;
} else {
sinfo_ptr->nodes_idle += total_nodes;
sinfo_ptr->cpus_idle += total_cpus;
}
sinfo_ptr->nodes_total += total_nodes;
sinfo_ptr->cpus_total += total_cpus;
sinfo_ptr->nodes_total += total_nodes;
sinfo_ptr->cpus_total += total_cpus;
return;
}
return;
}
#else
if ((base_state == NODE_STATE_ALLOCATED) ||
IS_NODE_COMPLETING(node_ptr))
sinfo_ptr->nodes_alloc += total_nodes;
else if (IS_NODE_DRAIN(node_ptr) || (base_state == NODE_STATE_DOWN))
sinfo_ptr->nodes_other += total_nodes;
else
sinfo_ptr->nodes_idle += total_nodes;
if ((base_state == NODE_STATE_ALLOCATED) ||
IS_NODE_COMPLETING(node_ptr))
sinfo_ptr->nodes_alloc += total_nodes;
else if (IS_NODE_DRAIN(node_ptr)
|| (base_state == NODE_STATE_DOWN))
sinfo_ptr->nodes_other += total_nodes;
else
sinfo_ptr->nodes_idle += total_nodes;
#endif
}
sinfo_ptr->nodes_total += total_nodes;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment