/* Function for full information about a Burst Buffer */ extern void specific_info_bb(popup_info_t *popup_win) { int bb_error_code = SLURM_SUCCESS; static burst_buffer_info_msg_t *bb_info_ptr = NULL; specific_info_t *spec_info = popup_win->spec_info; char error_char[100]; GtkWidget *label = NULL; GtkTreeView *tree_view = NULL; List bb_list = NULL; List send_bb_list = NULL; sview_bb_info_t *sview_bb_info_ptr = NULL; int i=-1; ListIterator itr = NULL; if (!spec_info->display_widget) { setup_popup_info(popup_win, display_data_bb, SORTID_CNT); } if (spec_info->display_widget && popup_win->toggled) { gtk_widget_destroy(spec_info->display_widget); spec_info->display_widget = NULL; goto display_it; } if ((bb_error_code = get_new_info_bb(&bb_info_ptr, popup_win->force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { if (!spec_info->display_widget || spec_info->view == ERROR_VIEW) goto display_it; } else if (bb_error_code != SLURM_SUCCESS) { if (spec_info->view == ERROR_VIEW) goto end_it; spec_info->view = ERROR_VIEW; if (spec_info->display_widget) gtk_widget_destroy(spec_info->display_widget); sprintf(error_char, "get_new_info_bb: %s", slurm_strerror(slurm_get_errno())); label = gtk_label_new(error_char); gtk_table_attach_defaults(popup_win->table, label, 0, 1, 0, 1); gtk_widget_show(label); spec_info->display_widget = gtk_widget_ref(label); goto end_it; } display_it: bb_list = _create_bb_info_list(bb_info_ptr); if (!bb_list) return; if (spec_info->view == ERROR_VIEW && spec_info->display_widget) { gtk_widget_destroy(spec_info->display_widget); spec_info->display_widget = NULL; } if (spec_info->type != INFO_PAGE && !spec_info->display_widget) { tree_view = create_treeview(local_display_data, &popup_win->grid_button_list); gtk_tree_selection_set_mode( gtk_tree_view_get_selection(tree_view), GTK_SELECTION_MULTIPLE); spec_info->display_widget = gtk_widget_ref(GTK_WIDGET(tree_view)); gtk_table_attach_defaults(popup_win->table, GTK_WIDGET(tree_view), 0, 1, 0, 1); /* since this function sets the model of the tree_view * to the treestore we don't really care about * the return value */ create_treestore(tree_view, popup_win->display_data, SORTID_CNT, SORTID_NAME, SORTID_COLOR); } setup_popup_grid_list(popup_win); spec_info->view = INFO_VIEW; if (spec_info->type == INFO_PAGE) { _display_info_bb(bb_list, popup_win); goto end_it; } /* just linking to another list, don't free the inside, just the list */ send_bb_list = list_create(NULL); itr = list_iterator_create(bb_list); i = -1; /* Set up additional menu options(ie the right click menu stuff) */ while ((sview_bb_info_ptr = list_next(itr))) { i++; /* Since we will not use any of these pages we will */ /* leave them blank */ switch(spec_info->type) { case PART_PAGE: case BLOCK_PAGE: case NODE_PAGE: case JOB_PAGE: case RESV_PAGE: default: g_print("Unknown type %d\n", spec_info->type); continue; } list_push(send_bb_list, sview_bb_info_ptr); } list_iterator_destroy(itr); post_setup_popup_grid_list(popup_win); _update_info_bb(send_bb_list, GTK_TREE_VIEW(spec_info->display_widget)); FREE_NULL_LIST(send_bb_list); end_it: popup_win->toggled = 0; popup_win->force_refresh = 0; return; }
extern void specific_info_resv(popup_info_t *popup_win) { int resv_error_code = SLURM_SUCCESS; static reserve_info_msg_t *resv_info_ptr = NULL; static reserve_info_t *resv_ptr = NULL; specific_info_t *spec_info = popup_win->spec_info; sview_search_info_t *search_info = spec_info->search_info; char error_char[100]; GtkWidget *label = NULL; GtkTreeView *tree_view = NULL; List resv_list = NULL; List send_resv_list = NULL; sview_resv_info_t *sview_resv_info_ptr = NULL; int j=0, i=-1; hostset_t hostset = NULL; ListIterator itr = NULL; if (!spec_info->display_widget) { setup_popup_info(popup_win, display_data_resv, SORTID_CNT); } if (spec_info->display_widget && popup_win->toggled) { gtk_widget_destroy(spec_info->display_widget); spec_info->display_widget = NULL; goto display_it; } if ((resv_error_code = get_new_info_resv(&resv_info_ptr, popup_win->force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { if (!spec_info->display_widget || spec_info->view == ERROR_VIEW) goto display_it; } else if (resv_error_code != SLURM_SUCCESS) { if (spec_info->view == ERROR_VIEW) goto end_it; spec_info->view = ERROR_VIEW; if (spec_info->display_widget) gtk_widget_destroy(spec_info->display_widget); sprintf(error_char, "get_new_info_resv: %s", slurm_strerror(slurm_get_errno())); label = gtk_label_new(error_char); gtk_table_attach_defaults(popup_win->table, label, 0, 1, 0, 1); gtk_widget_show(label); spec_info->display_widget = gtk_widget_ref(label); goto end_it; } display_it: resv_list = _create_resv_info_list(resv_info_ptr); if (!resv_list) return; if (spec_info->view == ERROR_VIEW && spec_info->display_widget) { gtk_widget_destroy(spec_info->display_widget); spec_info->display_widget = NULL; } if (spec_info->type != INFO_PAGE && !spec_info->display_widget) { tree_view = create_treeview(local_display_data, &popup_win->grid_button_list); gtk_tree_selection_set_mode( gtk_tree_view_get_selection(tree_view), GTK_SELECTION_MULTIPLE); spec_info->display_widget = gtk_widget_ref(GTK_WIDGET(tree_view)); gtk_table_attach_defaults(popup_win->table, GTK_WIDGET(tree_view), 0, 1, 0, 1); /* since this function sets the model of the tree_view to the treestore we don't really care about the return value */ create_treestore(tree_view, popup_win->display_data, SORTID_CNT, SORTID_TIME_START, SORTID_COLOR); } setup_popup_grid_list(popup_win); spec_info->view = INFO_VIEW; if (spec_info->type == INFO_PAGE) { _display_info_resv(resv_list, popup_win); goto end_it; } /* just linking to another list, don't free the inside, just the list */ send_resv_list = list_create(NULL); itr = list_iterator_create(resv_list); i = -1; while ((sview_resv_info_ptr = list_next(itr))) { i++; resv_ptr = sview_resv_info_ptr->resv_ptr; switch(spec_info->type) { case PART_PAGE: case BLOCK_PAGE: case NODE_PAGE: if (!resv_ptr->node_list) continue; if (!(hostset = hostset_create( search_info->gchar_data))) continue; if (!hostset_intersects(hostset, resv_ptr->node_list)) { hostset_destroy(hostset); continue; } hostset_destroy(hostset); break; case JOB_PAGE: if (strcmp(resv_ptr->name, search_info->gchar_data)) continue; break; case RESV_PAGE: switch(search_info->search_type) { case SEARCH_RESERVATION_NAME: if (!search_info->gchar_data) continue; if (strcmp(resv_ptr->name, search_info->gchar_data)) continue; break; default: continue; } break; default: g_print("Unknown type %d\n", spec_info->type); continue; } list_push(send_resv_list, sview_resv_info_ptr); j=0; while (resv_ptr->node_inx[j] >= 0) { change_grid_color( popup_win->grid_button_list, resv_ptr->node_inx[j], resv_ptr->node_inx[j+1], sview_resv_info_ptr->color_inx, true, 0); j += 2; } } list_iterator_destroy(itr); post_setup_popup_grid_list(popup_win); _update_info_resv(send_resv_list, GTK_TREE_VIEW(spec_info->display_widget)); FREE_NULL_LIST(send_resv_list); end_it: popup_win->toggled = 0; popup_win->force_refresh = 0; return; }
extern void specific_info_block(popup_info_t *popup_win) { int part_error_code = SLURM_SUCCESS; int block_error_code = SLURM_SUCCESS; static partition_info_msg_t *part_info_ptr = NULL; static block_info_msg_t *block_info_ptr = NULL; specific_info_t *spec_info = popup_win->spec_info; sview_search_info_t *search_info = spec_info->search_info; char error_char[100]; GtkWidget *label = NULL; GtkTreeView *tree_view = NULL; List block_list = NULL; List send_block_list = NULL; sview_block_info_t *block_ptr = NULL; int j=0, i=-1; hostset_t hostset = NULL; ListIterator itr = NULL; if (!spec_info->display_widget) { setup_popup_info(popup_win, display_data_block, SORTID_CNT); } if (spec_info->display_widget && popup_win->toggled) { gtk_widget_destroy(spec_info->display_widget); spec_info->display_widget = NULL; goto display_it; } if ((part_error_code = get_new_info_part(&part_info_ptr, popup_win->force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { } else if (part_error_code != SLURM_SUCCESS) { if (spec_info->view == ERROR_VIEW) goto end_it; spec_info->view = ERROR_VIEW; if (spec_info->display_widget) gtk_widget_destroy(spec_info->display_widget); sprintf(error_char, "slurm_load_partitions: %s", slurm_strerror(slurm_get_errno())); label = gtk_label_new(error_char); gtk_table_attach_defaults(popup_win->table, label, 0, 1, 0, 1); gtk_widget_show(label); spec_info->display_widget = gtk_widget_ref(label); goto end_it; } if ((block_error_code = get_new_info_block(&block_info_ptr, popup_win->force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { if ((!spec_info->display_widget || spec_info->view == ERROR_VIEW) || (part_error_code != SLURM_NO_CHANGE_IN_DATA)) { goto display_it; } } else if (block_error_code != SLURM_SUCCESS) { if (spec_info->view == ERROR_VIEW) goto end_it; spec_info->view = ERROR_VIEW; if (spec_info->display_widget) gtk_widget_destroy(spec_info->display_widget); sprintf(error_char, "slurm_load_block: %s", slurm_strerror(slurm_get_errno())); label = gtk_label_new(error_char); gtk_table_attach_defaults(popup_win->table, label, 0, 1, 0, 1); gtk_widget_show(label); spec_info->display_widget = gtk_widget_ref(label); goto end_it; } display_it: block_list = _create_block_list(part_info_ptr, block_info_ptr); if (!block_list) return; if (spec_info->view == ERROR_VIEW && spec_info->display_widget) { gtk_widget_destroy(spec_info->display_widget); spec_info->display_widget = NULL; } if (spec_info->type != INFO_PAGE && !spec_info->display_widget) { tree_view = create_treeview(local_display_data, &popup_win->grid_button_list); gtk_tree_selection_set_mode( gtk_tree_view_get_selection(tree_view), GTK_SELECTION_MULTIPLE); spec_info->display_widget = gtk_widget_ref(GTK_WIDGET(tree_view)); gtk_table_attach_defaults(popup_win->table, GTK_WIDGET(tree_view), 0, 1, 0, 1); /* since this function sets the model of the tree_view to the treestore we don't really care about the return value */ create_treestore(tree_view, popup_win->display_data, SORTID_CNT, SORTID_BLOCK, SORTID_COLOR); } setup_popup_grid_list(popup_win); spec_info->view = INFO_VIEW; if (spec_info->type == INFO_PAGE) { _display_info_block(block_list, popup_win); goto end_it; } /* just linking to another list, don't free the inside, just the list */ send_block_list = list_create(NULL); itr = list_iterator_create(block_list); i = -1; while ((block_ptr = list_next(itr))) { /* we want to over ride any subgrp in error state */ enum node_states state = NODE_STATE_UNKNOWN; char *name = NULL; i++; switch(spec_info->type) { case PART_PAGE: if (xstrcmp(block_ptr->slurm_part_name, search_info->gchar_data)) continue; break; case RESV_PAGE: case NODE_PAGE: if (!block_ptr->mp_str) continue; if (!(hostset = hostset_create( search_info->gchar_data))) continue; name = block_ptr->mp_str; if (block_ptr->small_block) { int j=0; /* strip off the ionodes part */ while (name[j]) { if (name[j] == '[') { name[j] = '\0'; break; } j++; } } if (!hostset_intersects(hostset, name)) { hostset_destroy(hostset); continue; } hostset_destroy(hostset); break; case BLOCK_PAGE: switch(search_info->search_type) { case SEARCH_BLOCK_NAME: if (!search_info->gchar_data) continue; if (xstrcmp(block_ptr->bg_block_name, search_info->gchar_data)) continue; break; case SEARCH_BLOCK_SIZE: if (search_info->int_data == NO_VAL) continue; if (block_ptr->cnode_cnt != search_info->int_data) continue; break; case SEARCH_BLOCK_STATE: if (search_info->int_data == NO_VAL) continue; if (block_ptr->state != search_info->int_data) continue; break; default: continue; break; } break; case JOB_PAGE: if (xstrcmp(block_ptr->bg_block_name, search_info->gchar_data)) continue; break; default: g_print("Unknown type %d\n", spec_info->type); continue; } list_push(send_block_list, block_ptr); if (block_ptr->state & BG_BLOCK_ERROR_FLAG) state = NODE_STATE_ERROR; else if (list_count(block_ptr->job_list)) state = NODE_STATE_ALLOCATED; else state = NODE_STATE_IDLE; j=0; while (block_ptr->mp_inx[j] >= 0) { change_grid_color( popup_win->grid_button_list, block_ptr->mp_inx[j], block_ptr->mp_inx[j+1], block_ptr->color_inx, true, state); j += 2; } } list_iterator_destroy(itr); post_setup_popup_grid_list(popup_win); _update_info_block(send_block_list, GTK_TREE_VIEW(spec_info->display_widget)); FREE_NULL_LIST(send_block_list); end_it: popup_win->toggled = 0; popup_win->force_refresh = 0; return; }