static void _free_node_info(void) { if (job_node_ptr) { slurm_free_node_info_msg(job_node_ptr); job_node_ptr = NULL; } }
/* Load current node table information into *node_buffer_pptr */ extern int scontrol_load_nodes (node_info_msg_t ** node_buffer_pptr, uint16_t show_flags) { int error_code; static int last_show_flags = 0xffff; node_info_msg_t *node_info_ptr = NULL; if (old_node_info_ptr) { if (last_show_flags != show_flags) old_node_info_ptr->last_update = (time_t) 0; error_code = slurm_load_node (old_node_info_ptr->last_update, &node_info_ptr, show_flags); if (error_code == SLURM_SUCCESS) slurm_free_node_info_msg (old_node_info_ptr); else if (slurm_get_errno () == SLURM_NO_CHANGE_IN_DATA) { node_info_ptr = old_node_info_ptr; error_code = SLURM_SUCCESS; if (quiet_flag == -1) printf ("slurm_load_node no change in data\n"); } } else error_code = slurm_load_node ((time_t) NULL, &node_info_ptr, show_flags); if (error_code == SLURM_SUCCESS) { old_node_info_ptr = node_info_ptr; last_show_flags = show_flags; *node_buffer_pptr = node_info_ptr; } return error_code; }
int print_jobs_array(job_info_t * jobs, int size, List format) { int i; List l; node_info_msg_t *ni = NULL; l = list_create(NULL); if (!params.no_header) print_job_from_format(NULL, format); /* Filter out the jobs of interest */ for (i = 0; i < size; i++) { if (_filter_job(&jobs[i])) continue; if (_merge_job_array(l, &jobs[i])) continue; list_append(l, (void *) &jobs[i]); } sort_jobs_by_start_time (l); if (ni) slurm_free_node_info_msg (ni); sort_job_list (l); /* Print the jobs of interest */ list_for_each (l, (ListForF) print_job_from_format, (void *) format); list_destroy (l); return SLURM_SUCCESS; }
// Get bar summaries for cluster nodes void ClusterMenu::get_lines() { // First we set the time of this update last_update = std::chrono::steady_clock::now(); // Call SLURM API to write node information to pointer // Free pointer memory first if it has been previously set if (node_info_buffer_ptr != NULL) { slurm_free_node_info_msg(node_info_buffer_ptr); } slurm_load_node ((time_t) NULL, &node_info_buffer_ptr, SHOW_ALL); // Create a NodeContainer struct and populate with node information node_container.populate_nodes_from_slurm(node_info_buffer_ptr); // Call API function, pass job_info_ptr as reference (double pointer); flags must be SHOW_DETAIL to get job allocations // Free pointer memory first if it has been previously set if (job_info_buffer_ptr != NULL) { slurm_free_job_info_msg(job_info_buffer_ptr); } slurm_load_jobs((time_t) NULL, &job_info_buffer_ptr, SHOW_DETAIL); // Populate nodes with job allocations node_container.populate_job_allocations_from_slurm(job_info_buffer_ptr); // Get line content lines = node_container.get_node_bar_summary(32); // Record largest line for later use in horizontal scrolling get_longest_line(); }
static void _free_node_info(void) { #if 0 slurm_mutex_lock(&job_node_info_lock); if (job_node_ptr) { slurm_free_node_info_msg(job_node_ptr); job_node_ptr = NULL; } slurm_mutex_unlock(&job_node_info_lock); #endif }
/* 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); 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; }
bitstr_t *get_requested_node_bitmap(void) { static bitstr_t *bitmap = NULL; static node_info_msg_t *old_node_ptr = NULL, *new_node_ptr; int error_code; int i = 0; node_info_t *node_ptr = NULL; if (!params.hl) return NULL; if (old_node_ptr) { error_code = slurm_load_node(old_node_ptr->last_update, &new_node_ptr, SHOW_ALL); if (error_code == SLURM_SUCCESS) slurm_free_node_info_msg(old_node_ptr); else if (slurm_get_errno() == SLURM_NO_CHANGE_IN_DATA) return bitmap; } else { error_code = slurm_load_node((time_t) NULL, &new_node_ptr, SHOW_ALL); } if (bitmap) FREE_NULL_BITMAP(bitmap); if (error_code) { slurm_perror("slurm_load_node"); return NULL; } old_node_ptr = new_node_ptr; bitmap = bit_alloc(old_node_ptr->record_count); for (i = 0; i < old_node_ptr->record_count; i++) { node_ptr = &(old_node_ptr->node_array[i]); if (hostlist_find(params.hl, node_ptr->name) != -1) bit_set(bitmap, i); } return bitmap; }
/* * scontrol_print_completing - print jobs in completing state and * associated nodes in COMPLETING or DOWN state */ extern void scontrol_print_completing (void) { int error_code, i; job_info_msg_t *job_info_msg; job_info_t *job_info; node_info_msg_t *node_info_msg; uint16_t show_flags = 0; error_code = scontrol_load_job (&job_info_msg, 0); if (error_code) { exit_code = 1; if (quiet_flag != 1) slurm_perror ("slurm_load_jobs error"); return; } /* Must load all nodes including hidden for cross-index * from job's node_inx to node table to work */ /*if (all_flag) Always set this flag */ show_flags |= SHOW_ALL; if (federation_flag) show_flags |= SHOW_FEDERATION; if (local_flag) show_flags |= SHOW_LOCAL; error_code = scontrol_load_nodes(&node_info_msg, show_flags); if (error_code) { exit_code = 1; if (quiet_flag != 1) slurm_perror ("slurm_load_nodes error"); return; } /* Scan the jobs for completing state */ job_info = job_info_msg->job_array; for (i = 0; i < job_info_msg->record_count; i++) { if (job_info[i].job_state & JOB_COMPLETING) scontrol_print_completing_job(&job_info[i], node_info_msg); } slurm_free_node_info_msg(node_info_msg); }
int main() { // Initialise container for all node information NodeContainer node_container; // Declare a pointer to which the SLURM API writes node information node_info_msg_t * node_info_buffer_ptr = NULL; // Call SLURM API to write node information to pointer slurm_load_node((time_t) NULL, &node_info_buffer_ptr, SHOW_ALL); // Create a NodeContainer struct and populate with node information node_container.populate_nodes_from_slurm(node_info_buffer_ptr); // Declare a pointer to which the SLURM API writes job information job_info_msg_t * job_info_buffer_ptr = NULL; // Call API function, pass job_info_ptr as reference (double pointer); flags must be SHOW_DETAIL to get job allocations slurm_load_jobs((time_t) NULL, &job_info_buffer_ptr, SHOW_DETAIL); // Populate nodes with job allocations node_container.populate_job_allocations_from_slurm(job_info_buffer_ptr); // Get lines for output std::vector<std::string> lines = node_container.get_node_bar_summary(32); // Print output for (std::vector<std::string>::iterator it = lines.begin(); it != lines.end(); ++it) { printf("%s\n", it->c_str()); } // Clean up and nicely deallocated memory for SLURM pointers slurm_free_node_info_msg(node_info_buffer_ptr); slurm_free_job_info_msg(job_info_buffer_ptr); }
// Destructor, not sure calling the slurm_free* functios are necessary ClusterMenu::~ClusterMenu() { // Free pointer memory slurm_free_node_info_msg(node_info_buffer_ptr); slurm_free_job_info_msg(job_info_buffer_ptr); }
int main() { //=========================================================================================== // Declarations //=========================================================================================== int i,j; int i2,j2; job_info_msg_t *job_ptr; partition_info_msg_t *prt_ptr = NULL; node_info_msg_t *node_ptr = NULL; int err = SLURM_SUCCESS; err = slurm_load_partitions((time_t) NULL, &prt_ptr, 0); err = slurm_load_node((time_t) NULL, &node_ptr, 0); err = slurm_load_jobs((time_t) NULL, &job_ptr, 0); Linked_List_Node* job_llist; struct json_object *partition = json_object_new_object(); struct json_object *node = json_object_new_object(); //=========================================================================================== // Filling hash tables //=========================================================================================== j2 = 0; i2 = 0; //fill node_job hash if (job_ptr->record_count > 0) { for (i = 0; i < job_ptr->record_count; i++) { j2=0; while( job_ptr->job_array[i].node_inx[j2] >= 0){ i2 = 0; for(i2 = job_ptr->job_array[i].node_inx[j2];i2 <= job_ptr->job_array[i].node_inx[j2+1];i2++) { node_job_put(node_ptr->node_array[i2].name,job_ptr -> job_array[i]); } j2+=2; } } } //============================================================================================ // Creating Output in Json //============================================================================================ // create json int total_node_unknown = 0; int total_node_down = 0; int total_node_idle = 0; int total_node_allocated = 0; int current_node_unknown; int current_node_down; int current_node_idle; int current_node_allocated; int current_job_running; int current_job_waiting; int current_job_stopped; if(prt_ptr -> record_count > 0){ for (i = 0; i < prt_ptr->record_count; i++) { current_node_unknown = 0; current_node_down = 0; current_node_idle = 0; current_node_allocated = 0; current_job_running = 0; current_job_waiting = 0; current_job_stopped = 0; int j2=0; while( prt_ptr->partition_array[i].node_inx[j2] >= 0){ int i2 = 0; for(i2 = prt_ptr->partition_array[i].node_inx[j2];i2 <= prt_ptr->partition_array[i].node_inx[j2+1];i2++) { if(node_ptr->node_array[i2].node_state == 5 || node_ptr->node_array[i2].node_state == 3){ total_node_allocated++; current_node_allocated++;} else if(node_ptr->node_array[i2].node_state == 1){ total_node_down++; current_node_down++;} else if(node_ptr->node_array[i2].node_state == 2 || node_ptr->node_array[i2].node_state == 6){ total_node_idle++; current_node_idle++;} else { total_node_unknown++; current_node_unknown++;} job_llist = node_job_get(node_ptr->node_array[i2].name); //get job name while( job_llist != NULL){ if(job_llist->value_job.job_state == 2 || job_llist->value_job.job_state == 8 || job_llist->value_job.job_state == 0) current_job_waiting++; else if(job_llist->value_job.job_state == 1) current_job_running++; else current_job_stopped++; job_llist = job_llist->next; } } j2+=2; } json_object_object_add(node, "Allocated", json_object_new_int(current_node_allocated)); json_object_object_add(node, "Down", json_object_new_int(current_node_down)); json_object_object_add(node, "Idle", json_object_new_int(current_node_idle)); json_object_object_add(node, "Unknown", json_object_new_int(current_node_unknown)); json_object_object_add(node, "Running", json_object_new_int(current_job_running)); json_object_object_add(node, "Wating", json_object_new_int(current_job_waiting)); json_object_object_add(node, "Stopped", json_object_new_int(current_job_stopped)); json_object_object_add(partition, prt_ptr->partition_array[i].name , node); } } node = json_object_new_object(); json_object_object_add(node, "Unknown", json_object_new_int(total_node_unknown)); json_object_object_add(node, "Down", json_object_new_int(total_node_down)); json_object_object_add(node, "Idle", json_object_new_int(total_node_idle)); json_object_object_add(node, "Allocated", json_object_new_int(total_node_allocated)); json_object_object_add(partition, "General", node); printf("Content-type: text/html\n\n%s",json_object_to_json_string(partition)); slurm_free_partition_info_msg(prt_ptr); slurm_free_node_info_msg(node_ptr); return 1; }
extern void _change_cluster_main(GtkComboBox *combo, gpointer extra) { GtkTreeModel *model; display_data_t *display_data; GtkTreeIter iter; slurmdb_cluster_rec_t *cluster_rec = NULL; char *tmp, *ui_description; GError *error = NULL; GtkWidget *node_tab = NULL; int rc; bool got_grid = 0; if (!gtk_combo_box_get_active_iter(combo, &iter)) { g_print("nothing selected\n"); return; } model = gtk_combo_box_get_model(combo); if (!model) { g_print("nothing selected\n"); return; } gtk_tree_model_get(model, &iter, 1, &cluster_rec, -1); if (!cluster_rec) { g_print("no cluster_rec pointer here!"); return; } /* From testing it doesn't appear you can get here without a legitimate change, so there isn't a need to check if we are going back to the same cluster we were just at. */ /* if (working_cluster_rec) { */ /* if (!xstrcmp(cluster_rec->name, working_cluster_rec->name)) */ /* return; */ /* } */ /* free old info under last cluster */ slurm_free_block_info_msg(g_block_info_ptr); g_block_info_ptr = NULL; slurm_free_front_end_info_msg(g_front_end_info_ptr); g_front_end_info_ptr = NULL; slurm_free_burst_buffer_info_msg(g_bb_info_ptr); g_bb_info_ptr = NULL; slurm_free_job_info_msg(g_job_info_ptr); g_job_info_ptr = NULL; slurm_free_node_info_msg(g_node_info_ptr); g_node_info_ptr = NULL; slurm_free_partition_info_msg(g_part_info_ptr); g_part_info_ptr = NULL; slurm_free_reservation_info_msg(g_resv_info_ptr); g_resv_info_ptr = NULL; slurm_free_ctl_conf(g_ctl_info_ptr); g_ctl_info_ptr = NULL; slurm_free_job_step_info_response_msg(g_step_info_ptr); g_step_info_ptr = NULL; slurm_free_topo_info_msg(g_topo_info_msg_ptr); g_topo_info_msg_ptr = NULL; /* set up working_cluster_rec */ if (cluster_dims > 1) { /* reset from a multi-dim cluster */ working_sview_config.grid_x_width = default_sview_config.grid_x_width; working_sview_config.grid_hori = default_sview_config.grid_hori; working_sview_config.grid_vert = default_sview_config.grid_vert; } gtk_table_set_col_spacings(main_grid_table, 0); gtk_table_set_row_spacings(main_grid_table, 0); if (!orig_cluster_name) orig_cluster_name = slurm_get_cluster_name(); if (!xstrcmp(cluster_rec->name, orig_cluster_name)) working_cluster_rec = NULL; else working_cluster_rec = cluster_rec; cluster_dims = slurmdb_setup_cluster_dims(); cluster_flags = slurmdb_setup_cluster_flags(); display_data = main_display_data; while (display_data++) { if (display_data->id == -1) break; if (cluster_flags & CLUSTER_FLAG_BG) { switch(display_data->id) { case BLOCK_PAGE: display_data->show = true; break; case NODE_PAGE: display_data->name = "Midplanes"; break; default: break; } } else { switch(display_data->id) { case BLOCK_PAGE: display_data->show = false; break; case NODE_PAGE: display_data->name = "Nodes"; break; default: break; } } } /* set up menu */ ui_description = _get_ui_description(); gtk_ui_manager_remove_ui(g_ui_manager, g_menu_id); if (!(g_menu_id = gtk_ui_manager_add_ui_from_string( g_ui_manager, ui_description, -1, &error))) { xfree(ui_description); g_error("building menus failed: %s", error->message); g_error_free (error); exit (0); } xfree(ui_description); /* make changes for each object */ cluster_change_block(); cluster_change_front_end(); cluster_change_resv(); cluster_change_part(); cluster_change_job(); cluster_change_node(); cluster_change_bb(); /* destroy old stuff */ if (grid_button_list) { FREE_NULL_LIST(grid_button_list); got_grid = 1; } select_g_ba_fini(); /* sorry popups can't survive a cluster change */ if (popup_list) list_flush(popup_list); if (signal_params_list) list_flush(signal_params_list); if (signal_params_list) list_flush(signal_params_list); if (g_switch_nodes_maps) free_switch_nodes_maps(g_switch_nodes_maps); /* change the node tab name if needed */ node_tab = gtk_notebook_get_nth_page( GTK_NOTEBOOK(main_notebook), NODE_PAGE); node_tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(main_notebook), node_tab); #ifdef GTK2_USE_GET_FOCUS /* ok, now we have a table which we have set up to contain an * event_box which contains the label we are interested. We * setup this label to be the focus child of the table, so all * we have to do is grab that and we are set. */ node_tab = gtk_container_get_focus_child(GTK_CONTAINER(node_tab)); #else /* See above comment. Since gtk_container_get_focus_child * doesn't exist yet we will just traverse the children until * we find the label widget and then break. */ { int i = 0; GList *children = gtk_container_get_children( GTK_CONTAINER(node_tab)); while ((node_tab = g_list_nth_data(children, i++))) { int j = 0; GList *children2 = gtk_container_get_children( GTK_CONTAINER(node_tab)); while ((node_tab = g_list_nth_data(children2, j++))) { if (GTK_IS_LABEL(node_tab)) break; } g_list_free(children2); if (node_tab) break; } g_list_free(children); } #endif if (node_tab) gtk_label_set_text(GTK_LABEL(node_tab), main_display_data[NODE_PAGE].name); /* The name in the visible tabs is easier since it is really just a button with a label on it. */ if (default_sview_config.page_check_widget[NODE_PAGE]) { gtk_button_set_label(GTK_BUTTON(default_sview_config. page_check_widget[NODE_PAGE]), main_display_data[NODE_PAGE].name); } /* reinit */ rc = get_system_stats(main_grid_table); if (rc == SLURM_SUCCESS) { /* It turns out if we didn't have the grid (cluster not responding) before the new grid doesn't get set up correctly. Redoing the system_stats fixes it. There is probably a better way of doing this, but it doesn't happen very often and isn't that bad to handle every once in a while. */ if (!got_grid) { /* I know we just did this before, but it needs to be done again here. */ FREE_NULL_LIST(grid_button_list); get_system_stats(main_grid_table); } refresh_main(NULL, NULL); } tmp = g_strdup_printf("Cluster changed to %s", cluster_rec->name); display_edit_note(tmp); g_free(tmp); }
int main(int argc, char **argv) { log_options_t opts = LOG_OPTS_STDERR_ONLY; node_info_msg_t *node_info_ptr = NULL; node_info_msg_t *new_node_ptr = NULL; int error_code; int height = 40; int width = 100; int startx = 0; int starty = 0; int end = 0; int i; int rc; slurm_conf_init(NULL); log_init(xbasename(argv[0]), opts, SYSLOG_FACILITY_DAEMON, NULL); parse_command_line(argc, argv); if (params.verbose) { opts.stderr_level += params.verbose; log_alter(opts, SYSLOG_FACILITY_USER, NULL); } if (params.cluster_dims == 4) { min_screen_width = 92; } else if (params.cluster_dims == 3) min_screen_width = 92; /* no need for this if you are resolving */ while (slurm_load_node((time_t) NULL, &new_node_ptr, SHOW_ALL)) { if (params.resolve || (params.display == COMMANDS)) { new_node_ptr = NULL; break; /* just continue */ } error_code = slurm_get_errno(); printf("slurm_load_node: %s\n", slurm_strerror(error_code)); if (params.iterate == 0) exit(1); sleep(10); /* keep trying to reconnect */ } select_g_ba_init(new_node_ptr, 0); if (dim_size == NULL) { dim_size = get_cluster_dims(new_node_ptr); if ((dim_size == NULL) || (dim_size[0] < 1)) fatal("Invalid system dimensions"); } _init_colors(); if (params.resolve) { char *ret_str = resolve_mp(params.resolve, new_node_ptr); if (ret_str) { printf("%s", ret_str); xfree(ret_str); } _smap_exit(0); /* Calls exit(), no return */ } if (!params.commandline) { int check_width = min_screen_width; initscr(); init_grid(new_node_ptr, COLS); signal(SIGWINCH, (void (*)(int))_resize_handler); if (params.cluster_dims == 4) { height = dim_size[2] * dim_size[3] + dim_size[2] + 3; width = (dim_size[1] + dim_size[3] + 1) * dim_size[0] + 2; check_width += width; } else if (params.cluster_dims == 3) { height = dim_size[1] * dim_size[2] + dim_size[1] + 3; width = dim_size[0] + dim_size[2] + 3; check_width += width; } else { height = 10; width = COLS; } if ((COLS < check_width) || (LINES < height)) { endwin(); error("Screen is too small make sure the screen " "is at least %dx%d\n" "Right now it is %dx%d\n", check_width, height, COLS, LINES); _smap_exit(1); /* Calls exit(), no return */ } raw(); keypad(stdscr, true); noecho(); cbreak(); curs_set(0); nodelay(stdscr, true); start_color(); _set_pairs(); grid_win = newwin(height, width, starty, startx); max_display = (getmaxy(grid_win) - 1) * (getmaxx(grid_win) - 1); if (params.cluster_dims == 4) { startx = width; width = COLS - width - 2; height = LINES; } else if (params.cluster_dims == 3) { startx = width; width = COLS - width - 2; height = LINES; } else { startx = 0; starty = height; height = LINES - height; } text_win = newwin(height, width, starty, startx); } while (!end) { if (!params.commandline) { _get_option(); redraw: clear_window(text_win); clear_window(grid_win); move(0, 0); update_grid(new_node_ptr); main_xcord = 1; main_ycord = 1; } if (!params.no_header) print_date(); clear_grid(); switch (params.display) { case JOBS: get_job(); break; case RESERVATIONS: get_reservation(); break; case SLURMPART: get_slurm_part(); break; case COMMANDS: #ifdef HAVE_BG wclear(text_win); get_command(); #else error("Must be on a real BG SYSTEM to " "run this command"); if (!params.commandline) endwin(); _smap_exit(1); /* Calls exit(), no return */ #endif break; case BGPART: if (params.cluster_flags & CLUSTER_FLAG_BG) get_bg_part(); else { error("Must be on a BG SYSTEM to " "run this command"); if (!params.commandline) endwin(); _smap_exit(1); /* Calls exit(), no return */ } break; } if (!params.commandline) { box(text_win, 0, 0); wnoutrefresh(text_win); print_grid(); box(grid_win, 0, 0); wnoutrefresh(grid_win); doupdate(); node_info_ptr = new_node_ptr; if (node_info_ptr) { error_code = slurm_load_node( node_info_ptr->last_update, &new_node_ptr, SHOW_ALL); if (error_code == SLURM_SUCCESS) slurm_free_node_info_msg( node_info_ptr); else if (slurm_get_errno() == SLURM_NO_CHANGE_IN_DATA) { error_code = SLURM_SUCCESS; new_node_ptr = node_info_ptr; } } else { error_code = slurm_load_node( (time_t) NULL, &new_node_ptr, SHOW_ALL); } if (error_code && (quiet_flag != 1)) { if (!params.commandline) { mvwprintw( text_win, main_ycord, 1, "slurm_load_node: %s", slurm_strerror( slurm_get_errno())); main_ycord++; } else { printf("slurm_load_node: %s", slurm_strerror( slurm_get_errno())); } } } if (params.iterate) { for (i = 0; i < params.iterate; i++) { sleep(1); if (!params.commandline) { if ((rc = _get_option()) == 1) goto redraw; else if (resize_screen) { resize_screen = 0; goto redraw; } } } } else break; } if (!params.commandline) { nodelay(stdscr, false); getch(); endwin(); } _smap_exit(0); /* Calls exit(), no return */ exit(0); /* Redundant, but eliminates compiler warning */ }
/* * _query_server - download the current server state * part_pptr IN/OUT - partition information message * node_pptr IN/OUT - node information message * block_pptr IN/OUT - BlueGene block data * reserv_pptr IN/OUT - reservation information message * clear_old IN - If set, then always replace old data, needed when going * between clusters. * RET zero or error code */ static int _query_server(partition_info_msg_t ** part_pptr, node_info_msg_t ** node_pptr, block_info_msg_t ** block_pptr, reserve_info_msg_t ** reserv_pptr, bool clear_old) { static partition_info_msg_t *old_part_ptr = NULL, *new_part_ptr; static node_info_msg_t *old_node_ptr = NULL, *new_node_ptr; static block_info_msg_t *old_bg_ptr = NULL, *new_bg_ptr; static reserve_info_msg_t *old_resv_ptr = NULL, *new_resv_ptr; int error_code; uint16_t show_flags = 0; int cc; node_info_t *node_ptr; if (params.all_flag) show_flags |= SHOW_ALL; if (old_part_ptr) { if (clear_old) old_part_ptr->last_update = 0; error_code = slurm_load_partitions(old_part_ptr->last_update, &new_part_ptr, show_flags); if (error_code == SLURM_SUCCESS) slurm_free_partition_info_msg(old_part_ptr); else if (slurm_get_errno() == SLURM_NO_CHANGE_IN_DATA) { error_code = SLURM_SUCCESS; new_part_ptr = old_part_ptr; } } else { error_code = slurm_load_partitions((time_t) NULL, &new_part_ptr, show_flags); } if (error_code) { slurm_perror("slurm_load_partitions"); return error_code; } old_part_ptr = new_part_ptr; *part_pptr = new_part_ptr; if (old_node_ptr) { if (clear_old) old_node_ptr->last_update = 0; if (params.node_name_single) { error_code = slurm_load_node_single(&new_node_ptr, params.nodes, show_flags); } else { error_code = slurm_load_node(old_node_ptr->last_update, &new_node_ptr, show_flags); } if (error_code == SLURM_SUCCESS) slurm_free_node_info_msg(old_node_ptr); else if (slurm_get_errno() == SLURM_NO_CHANGE_IN_DATA) { error_code = SLURM_SUCCESS; new_node_ptr = old_node_ptr; } } else if (params.node_name_single) { error_code = slurm_load_node_single(&new_node_ptr, params.nodes, show_flags); } else { error_code = slurm_load_node((time_t) NULL, &new_node_ptr, show_flags); } if (error_code) { slurm_perror("slurm_load_node"); return error_code; } old_node_ptr = new_node_ptr; *node_pptr = new_node_ptr; /* Set the node state as NODE_STATE_MIXED. */ for (cc = 0; cc < new_node_ptr->record_count; cc++) { node_ptr = &(new_node_ptr->node_array[cc]); if (IS_NODE_DRAIN(node_ptr)) { /* don't worry about mixed since the * whole node is being drained. */ } else { uint16_t alloc_cpus = 0, err_cpus = 0, idle_cpus; int single_node_cpus = (node_ptr->cpus / g_node_scaling); select_g_select_nodeinfo_get(node_ptr->select_nodeinfo, SELECT_NODEDATA_SUBCNT, NODE_STATE_ALLOCATED, &alloc_cpus); if (params.cluster_flags & CLUSTER_FLAG_BG) { if (!alloc_cpus && (IS_NODE_ALLOCATED(node_ptr) || IS_NODE_COMPLETING(node_ptr))) alloc_cpus = node_ptr->cpus; else alloc_cpus *= single_node_cpus; } idle_cpus = node_ptr->cpus - alloc_cpus; select_g_select_nodeinfo_get(node_ptr->select_nodeinfo, SELECT_NODEDATA_SUBCNT, NODE_STATE_ERROR, &err_cpus); if (params.cluster_flags & CLUSTER_FLAG_BG) err_cpus *= single_node_cpus; idle_cpus -= err_cpus; if ((alloc_cpus && err_cpus) || (idle_cpus && (idle_cpus != node_ptr->cpus))) { node_ptr->node_state &= NODE_STATE_FLAGS; node_ptr->node_state |= NODE_STATE_MIXED; } } } if (old_resv_ptr) { if (clear_old) old_resv_ptr->last_update = 0; error_code = slurm_load_reservations(old_resv_ptr->last_update, &new_resv_ptr); if (error_code == SLURM_SUCCESS) slurm_free_reservation_info_msg(old_resv_ptr); else if (slurm_get_errno() == SLURM_NO_CHANGE_IN_DATA) { error_code = SLURM_SUCCESS; new_resv_ptr = old_resv_ptr; } } else { error_code = slurm_load_reservations((time_t) NULL, &new_resv_ptr); } if (error_code) { slurm_perror("slurm_load_reservations"); return error_code; } old_resv_ptr = new_resv_ptr; *reserv_pptr = new_resv_ptr; if (!params.bg_flag) return SLURM_SUCCESS; if (params.cluster_flags & CLUSTER_FLAG_BG) { if (old_bg_ptr) { if (clear_old) old_bg_ptr->last_update = 0; error_code = slurm_load_block_info( old_bg_ptr->last_update, &new_bg_ptr, show_flags); 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, show_flags); } } if (error_code) { slurm_perror("slurm_load_block"); return error_code; } old_bg_ptr = new_bg_ptr; *block_pptr = new_bg_ptr; return SLURM_SUCCESS; }
/* * _query_server - download the current server state * part_pptr IN/OUT - partition information message * node_pptr IN/OUT - node information message * block_pptr IN/OUT - BlueGene block data * reserv_pptr IN/OUT - reservation information message * clear_old IN - If set, then always replace old data, needed when going * between clusters. * RET zero or error code */ static int _query_server(partition_info_msg_t ** part_pptr, node_info_msg_t ** node_pptr, block_info_msg_t ** block_pptr, reserve_info_msg_t ** reserv_pptr, bool clear_old) { static partition_info_msg_t *old_part_ptr = NULL, *new_part_ptr; static node_info_msg_t *old_node_ptr = NULL, *new_node_ptr; static block_info_msg_t *old_bg_ptr = NULL, *new_bg_ptr; static reserve_info_msg_t *old_resv_ptr = NULL, *new_resv_ptr; int error_code; uint16_t show_flags = 0; if (params.all_flag) show_flags |= SHOW_ALL; if (old_part_ptr) { if (clear_old) old_part_ptr->last_update = 0; error_code = slurm_load_partitions(old_part_ptr->last_update, &new_part_ptr, show_flags); if (error_code == SLURM_SUCCESS) slurm_free_partition_info_msg(old_part_ptr); else if (slurm_get_errno() == SLURM_NO_CHANGE_IN_DATA) { error_code = SLURM_SUCCESS; new_part_ptr = old_part_ptr; } } else { error_code = slurm_load_partitions((time_t) NULL, &new_part_ptr, show_flags); } if (error_code) { slurm_perror("slurm_load_partitions"); return error_code; } old_part_ptr = new_part_ptr; *part_pptr = new_part_ptr; if (old_node_ptr) { if (clear_old) old_node_ptr->last_update = 0; if (params.node_name_single) { error_code = slurm_load_node_single(&new_node_ptr, params.nodes, show_flags); } else { error_code = slurm_load_node(old_node_ptr->last_update, &new_node_ptr, show_flags); } if (error_code == SLURM_SUCCESS) slurm_free_node_info_msg(old_node_ptr); else if (slurm_get_errno() == SLURM_NO_CHANGE_IN_DATA) { error_code = SLURM_SUCCESS; new_node_ptr = old_node_ptr; } } else if (params.node_name_single) { error_code = slurm_load_node_single(&new_node_ptr, params.nodes, show_flags); } else { error_code = slurm_load_node((time_t) NULL, &new_node_ptr, show_flags); } if (error_code) { slurm_perror("slurm_load_node"); return error_code; } old_node_ptr = new_node_ptr; *node_pptr = new_node_ptr; if (old_resv_ptr) { if (clear_old) old_resv_ptr->last_update = 0; error_code = slurm_load_reservations(old_resv_ptr->last_update, &new_resv_ptr); if (error_code == SLURM_SUCCESS) slurm_free_reservation_info_msg(old_resv_ptr); else if (slurm_get_errno() == SLURM_NO_CHANGE_IN_DATA) { error_code = SLURM_SUCCESS; new_resv_ptr = old_resv_ptr; } } else { error_code = slurm_load_reservations((time_t) NULL, &new_resv_ptr); } if (error_code) { slurm_perror("slurm_load_reservations"); return error_code; } old_resv_ptr = new_resv_ptr; *reserv_pptr = new_resv_ptr; if (!params.bg_flag) return SLURM_SUCCESS; if (params.cluster_flags & CLUSTER_FLAG_BG) { if (old_bg_ptr) { if (clear_old) old_bg_ptr->last_update = 0; error_code = slurm_load_block_info( old_bg_ptr->last_update, &new_bg_ptr, show_flags); 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, show_flags); } } if (error_code) { slurm_perror("slurm_load_block"); return error_code; } old_bg_ptr = new_bg_ptr; *block_pptr = new_bg_ptr; return SLURM_SUCCESS; }
int get_batch_queues(bridge_batch_manager_t* p_batch_manager, bridge_batch_queue_t** p_p_batch_queues, int* p_batch_queues_nb, char* batch_queue_name) { int fstatus=-1; int i,j; int queue_nb=0; int stored_queue_nb=0; bridge_batch_queue_t* bn; partition_info_msg_t* ppim; partition_info_t* ppi; job_info_msg_t* pjim; job_info_t* pji; node_info_msg_t* pnim; node_info_t* pni; /* get slurm partition infos */ if (slurm_load_partitions(0,&ppim,SHOW_ALL) != 0) { DEBUG3_LOGGER("unable to get slurm partitions infos"); ppim=NULL; goto exit; } /* get nodes status */ if(slurm_load_node(0,&pnim,SHOW_ALL)) { DEBUG3_LOGGER("unable to get nodes informations"); slurm_free_partition_info_msg(ppim); pnim=NULL; goto exit; } /* get slurm job infos */ if (slurm_load_jobs(0,&pjim,SHOW_ALL) != 0) { DEBUG3_LOGGER("unable to get allocations informations"); slurm_free_partition_info_msg(ppim); slurm_free_node_info_msg(pnim); goto exit; } /* build/initialize storage structures */ queue_nb = ppim->record_count; if (*p_p_batch_queues != NULL) { if (*p_batch_queues_nb < queue_nb) queue_nb=*p_batch_queues_nb; } else { *p_p_batch_queues = (bridge_batch_queue_t*) malloc(queue_nb*(sizeof(bridge_batch_queue_t)+1)); if (*p_p_batch_queues == NULL) { *p_batch_queues_nb = 0; queue_nb = *p_batch_queues_nb; } else { *p_batch_queues_nb = queue_nb; } } stored_queue_nb=0; /* fill queue structures */ for (i=0; i<ppim->record_count && stored_queue_nb<queue_nb; i++) { /* get partition pointer */ ppi=ppim->partition_array+i; if (ppi->name == NULL) continue; /* queue name filter */ if (batch_queue_name != NULL && strcmp(batch_queue_name,ppi->name) != 0) continue; bn = &(*p_p_batch_queues)[stored_queue_nb]; /* put default values */ init_batch_queue(p_batch_manager,bn); /* queue Name */ bn->name=strdup(ppi->name); bn->default_queue = (uint32_t) ( ppi->flags | PART_FLAG_DEFAULT); bn->priority = (uint32_t) ppi->priority; /* queue activity */ if(ppi->state_up == PARTITION_UP) { bn->activity = BRIDGE_BATCH_QUEUE_ACTIVITY_ACTIVE ; bn->state = BRIDGE_BATCH_QUEUE_STATE_OPENED ; } else if (ppi->state_up == PARTITION_DRAIN) { bn->activity = BRIDGE_BATCH_QUEUE_ACTIVITY_ACTIVE ; bn->state = BRIDGE_BATCH_QUEUE_STATE_CLOSED ; } else if (ppi->state_up == PARTITION_DOWN) { bn->activity = BRIDGE_BATCH_QUEUE_ACTIVITY_INACTIVE ; bn->state = BRIDGE_BATCH_QUEUE_STATE_OPENED ; } else if (ppi->state_up == PARTITION_INACTIVE) { bn->activity = BRIDGE_BATCH_QUEUE_ACTIVITY_INACTIVE ; bn->state = BRIDGE_BATCH_QUEUE_STATE_CLOSED ; } else { bn->activity = BRIDGE_BATCH_QUEUE_ACTIVITY_UNKNOWN ; bn->state = BRIDGE_BATCH_QUEUE_STATE_UNKNOWN ; } /* max times */ if ( ppi->max_time != INFINITE ) bn->seq_time_max = (uint32_t) ppi->max_time * 60 ; else bn->seq_time_max = NO_LIMIT; bn->par_time_max = bn->seq_time_max ; /* slurm */ for ( j=0 ; j < pjim->record_count ; j++ ) { pji=pjim->job_array+j; if ( strcmp(pji->partition,ppi->name) != 0 ) continue; switch ( pji->job_state & JOB_STATE_BASE ) { case JOB_PENDING : bn->jobs_nb++; bn->pending_jobs_nb++; break; case JOB_RUNNING : bn->jobs_nb++; bn->running_jobs_nb++; break; case JOB_SUSPENDED : bn->jobs_nb++; bn->syssuspended_jobs_nb++; break; } } /* Slurm does not provide information about Min and Max cpus per * partition. So we use the following method : * * if partition->name ~= /.*_seq/ min=max=1 * otherwise, calculate it using MinNodes, MaxNodes and nodes * informations */ int done = 0 ; char * p; p = rindex(ppi->name,'_'); if ( p != NULL ) { if ( strcmp(p+1,"seq") == 0 ) { done = 1; bn->par_cores_nb_min = 1; bn->par_cores_nb_max = 1; } } if ( ! done ) { /* use partition nodes information to build the min and max */ /* number of cores (only min and max nodes number are provided */ /* by slurm so we have to build this information) */ uint32_t max_cpus_per_node=0; uint32_t min_cpus_per_node=-1; bridge_nodelist_t list1,list2; bridge_nodelist_init(&list1,NULL,0); bridge_nodelist_add_nodes(&list1,ppi->nodes); for ( j=0 ; j < pnim->record_count ; j++ ) { pni=pnim->node_array+j; bridge_nodelist_init(&list2,NULL,0); bridge_nodelist_add_nodes(&list2,pni->name); if(bridge_nodelist_intersects(&list1,&list2)==0) { bridge_nodelist_free_contents(&list2); continue; } if ( pni->cpus > max_cpus_per_node ) max_cpus_per_node = pni->cpus ; if ( pni->cpus < min_cpus_per_node ) min_cpus_per_node = pni->cpus ; bridge_nodelist_free_contents(&list2); } bridge_nodelist_free_contents(&list1); if ( max_cpus_per_node > 0 && ppi->max_nodes != INFINITE ) bn->par_cores_nb_max = max_cpus_per_node * ppi->max_nodes ; if ( min_cpus_per_node < (uint32_t) -1 && ppi->min_nodes > 1 ) bn->par_cores_nb_min = min_cpus_per_node * ppi->min_nodes ; } stored_queue_nb++; } fstatus=0; /* free slurm informations */ slurm_free_job_info_msg(pjim); slurm_free_node_info_msg(pnim); slurm_free_partition_info_msg(ppim); if(stored_queue_nb<queue_nb) { *p_p_batch_queues=(bridge_batch_queue_t*) realloc(*p_p_batch_queues, stored_queue_nb*(sizeof(bridge_batch_queue_t)+1)); if(*p_p_batch_queues==NULL) *p_batch_queues_nb=0; else *p_batch_queues_nb=stored_queue_nb; } exit: return fstatus; }
extern int configure_defaults(void) { GtkScrolledWindow *window = create_scrolled_window(); GtkWidget *popup = gtk_dialog_new_with_buttons( "Sview Defaults", GTK_WINDOW(main_window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, NULL); GtkWidget *label = gtk_dialog_add_button(GTK_DIALOG(popup), GTK_STOCK_OK, GTK_RESPONSE_OK); GtkBin *bin = NULL; GtkViewport *view = NULL; GtkTable *table = NULL; int i = 0, row = 0; char tmp_char[100]; char *tmp_char_ptr; display_data_t *display_data = display_data_defaults; sview_config_t tmp_config; int response = 0; int rc = SLURM_SUCCESS; uint32_t width = 150; uint32_t height = 700; apply_hidden_change = TRUE; memcpy(&tmp_config, &default_sview_config, sizeof(sview_config_t)); gtk_window_set_default(GTK_WINDOW(popup), label); gtk_dialog_add_button(GTK_DIALOG(popup), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); /* for(i=0;; i++) { if (main_popup_positioner[i].width == -1) break; if (strstr("Sview Defaults", main_popup_positioner[i].name)) { pos_x = main_popup_positioner[i].width; pos_y = main_popup_positioner[i].height; break; } } */ gtk_window_set_default_size(GTK_WINDOW(popup), width, height); snprintf(tmp_char, sizeof(tmp_char), "Default Settings for Sview"); label = gtk_label_new(tmp_char); gtk_scrolled_window_set_policy(window, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); bin = GTK_BIN(&window->container); view = GTK_VIEWPORT(bin->child); bin = GTK_BIN(&view->bin); table = GTK_TABLE(bin->child); gtk_table_resize(table, SORTID_CNT, 2); gtk_table_set_homogeneous(table, FALSE); for (i = 0; i < SORTID_CNT; i++) { while (display_data++) { if (display_data->id == -1) break; if (!display_data->name) continue; if (display_data->id != i) continue; _local_display_admin_edit( table, &tmp_config, &row, display_data); break; } display_data = display_data_defaults; } gtk_table_resize(table, row, 2); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(popup)->vbox), label, FALSE, FALSE, 0); if (window) gtk_box_pack_start(GTK_BOX(GTK_DIALOG(popup)->vbox), GTK_WIDGET(window), TRUE, TRUE, 0); gtk_widget_show_all(popup); response = gtk_dialog_run (GTK_DIALOG(popup)); if (response == GTK_RESPONSE_OK) { tmp_char_ptr = g_strdup_printf( "Defaults updated successfully"); if (global_edit_error) tmp_char_ptr = global_edit_error_msg; else if (!global_send_update_msg) tmp_char_ptr = g_strdup_printf( "No change detected."); else { int action = 0; gdk_window_set_cursor(main_window->window, in_process_cursor); if (tmp_config.ruled_treeview != working_sview_config.ruled_treeview) { /* get rid of each existing table */ cluster_change_block(); cluster_change_resv(); cluster_change_part(); cluster_change_job(); cluster_change_node(); cluster_change_front_end(); } else if (tmp_config.grid_topological != working_sview_config.grid_topological) { apply_hidden_change = FALSE; if (tmp_config.grid_topological) { default_sview_config.grid_topological = tmp_config.grid_topological; if (!g_switch_nodes_maps) rc = get_topo_conf(); if (rc != SLURM_SUCCESS) { /*denied*/ tmp_char_ptr = g_strdup_printf( "Valid topology not " "detected"); tmp_config.grid_topological = FALSE; goto denied_change; } } /*force fresh grid and * node state check * */ FREE_NULL_LIST(grid_button_list); slurm_free_node_info_msg(g_node_info_ptr); g_node_info_ptr = NULL; } /*apply change*/ memcpy(&default_sview_config, &tmp_config, sizeof(sview_config_t)); memcpy(&working_sview_config, &tmp_config, sizeof(sview_config_t)); /* set the current display to the default */ gtk_toggle_action_set_active( default_sview_config.action_admin, working_sview_config.admin_mode); gtk_toggle_action_set_active( default_sview_config.action_ruled, working_sview_config.ruled_treeview); gtk_toggle_action_set_active( default_sview_config.action_grid, working_sview_config.show_grid); gtk_toggle_action_set_active( default_sview_config.action_hidden, working_sview_config.show_hidden); apply_hidden_change = TRUE; gtk_toggle_action_set_active( default_sview_config.action_page_opts, working_sview_config.save_page_opts); #ifdef GTK2_USE_RADIO_SET /* Since this value isn't a simple 0->n we need to translate if we don't have the newer gtk. */ action = working_sview_config.tab_pos; #else /* If using older gtk we need to translate the tab position to that of the position in the radio list. */ action = _trans_tab_pos(working_sview_config.tab_pos); #endif sview_radio_action_set_current_value( default_sview_config.action_tab, action); for (i=0; i<PAGE_CNT; i++) { if (main_display_data[i].id == -1) break; if (!main_display_data[i].name || (i == TAB_PAGE)) continue; toggle_tab_visiblity(NULL, main_display_data+i); } get_system_stats(main_grid_table); /******************************************/ save_defaults(false); } denied_change: display_edit_note(tmp_char_ptr); g_free(tmp_char_ptr); } global_entry_changed = 0; gtk_widget_destroy(popup); if (main_window && main_window->window) gdk_window_set_cursor(main_window->window, NULL); return rc; }
int main(int argc, char *argv[]) { log_options_t opts = LOG_OPTS_STDERR_ONLY; node_info_msg_t *node_info_ptr = NULL; node_info_msg_t *new_node_ptr = NULL; int error_code; int height = 40; int width = 100; int startx = 0; int starty = 0; int end = 0; int i; int rc; int mapset = 0; log_init(xbasename(argv[0]), opts, SYSLOG_FACILITY_DAEMON, NULL); parse_command_line(argc, argv); if (params.verbose) { opts.stderr_level += params.verbose; log_alter(opts, SYSLOG_FACILITY_USER, NULL); } if (params.cluster_dims == 4) { min_screen_width = 92; } else if (params.cluster_dims == 3) min_screen_width = 92; while (slurm_load_node((time_t) NULL, &new_node_ptr, SHOW_ALL)) { error_code = slurm_get_errno(); printf("slurm_load_node: %s\n", slurm_strerror(error_code)); if (params.display == COMMANDS) { new_node_ptr = NULL; break; /* just continue */ } if (params.iterate == 0) _smap_exit(1); /* Calls exit(), no return */ sleep(10); /* keep trying to reconnect */ } _init_colors(); select_g_ba_init(new_node_ptr, 0); init_grid(new_node_ptr); if (params.resolve) { #if defined HAVE_BG_FILES && defined HAVE_BG_L_P #if 1 error("this doesn't work in the current 2.3 code. FIXME"); #else if (!have_db2) { printf("Required libraries can not be found " "to access the Bluegene system.\nPlease " "set your LD_LIBRARY_PATH correctly to " "point to them.\n"); goto part_fini; } if (!mapset) mapset = 1; if (params.resolve[0] != 'R') { i = strlen(params.resolve); i -= 3; if (i < 0) { printf("No real block was entered\n"); goto part_fini; } char *rack_mid = find_bp_rack_mid(params.resolve+i); if (rack_mid) { printf("X=%c Y=%c Z=%c resolves to %s\n", params.resolve[0+i], params.resolve[1+i], params.resolve[2+i], rack_mid); } else { printf("X=%c Y=%c Z=%c has no resolve\n", params.resolve[0+i], params.resolve[1+i], params.resolve[2+i]); } } else { uint16_t *coord = find_bp_loc(params.resolve); if (coord) { printf("%s resolves to X=%d Y=%d Z=%d\n", params.resolve, coord[0], coord[1], coord[2]); } else { printf("%s has no resolve.\n", params.resolve); } } part_fini: #endif #else printf("Must be physically on a BlueGene system for support " "of resolve option.\n"); #endif _smap_exit(0); /* Calls exit(), no return */ } if (!params.commandline) { int check_width = min_screen_width; signal(SIGWINCH, (void (*)(int))_resize_handler); initscr(); if (params.cluster_dims == 4) { height = dim_size[2] * dim_size[3] + dim_size[2] + 3; width = (dim_size[1] + dim_size[3] + 1) * dim_size[0] + 2; check_width += width; } else if (params.cluster_dims == 3) { height = dim_size[1] * dim_size[2] + dim_size[1] + 3; width = dim_size[0] + dim_size[2] + 3; check_width += width; } else { height = 10; width = COLS; } if ((COLS < check_width) || (LINES < height)) { endwin(); error("Screen is too small make sure the screen " "is at least %dx%d\n" "Right now it is %dx%d\n", check_width, height, COLS, LINES); _smap_exit(1); /* Calls exit(), no return */ } raw(); keypad(stdscr, TRUE); noecho(); cbreak(); curs_set(0); nodelay(stdscr, TRUE); start_color(); _set_pairs(); grid_win = newwin(height, width, starty, startx); max_display = grid_win->_maxy * grid_win->_maxx; if (params.cluster_dims == 4) { startx = width; COLS -= 2; width = COLS - width; height = LINES; } else if (params.cluster_dims == 3) { startx = width; COLS -= 2; width = COLS - width; height = LINES; } else { startx = 0; starty = height; height = LINES - height; } text_win = newwin(height, width, starty, startx); } while (!end) { if (!params.commandline) { _get_option(); redraw: clear_window(text_win); clear_window(grid_win); move(0, 0); main_xcord = 1; main_ycord = 1; } if (!params.no_header) print_date(); clear_grid(); switch (params.display) { case JOBS: get_job(); break; case RESERVATIONS: get_reservation(); break; case SLURMPART: get_slurm_part(); break; case COMMANDS: if (params.cluster_flags & CLUSTER_FLAG_BG) { if (!mapset) { mapset = 1; wclear(text_win); } get_command(); } else { error("Must be on a BG SYSTEM to " "run this command"); if (!params.commandline) endwin(); _smap_exit(1); /* Calls exit(), no return */ } break; case BGPART: if (params.cluster_flags & CLUSTER_FLAG_BG) get_bg_part(); else { error("Must be on a BG SYSTEM to " "run this command"); if (!params.commandline) endwin(); _smap_exit(1); /* Calls exit(), no return */ } break; } if (!params.commandline) { box(text_win, 0, 0); wnoutrefresh(text_win); print_grid(); box(grid_win, 0, 0); wnoutrefresh(grid_win); doupdate(); node_info_ptr = new_node_ptr; if (node_info_ptr) { error_code = slurm_load_node( node_info_ptr->last_update, &new_node_ptr, SHOW_ALL); if (error_code == SLURM_SUCCESS) slurm_free_node_info_msg( node_info_ptr); else if (slurm_get_errno() == SLURM_NO_CHANGE_IN_DATA) { error_code = SLURM_SUCCESS; new_node_ptr = node_info_ptr; } } else { error_code = slurm_load_node( (time_t) NULL, &new_node_ptr, SHOW_ALL); } if (error_code && (quiet_flag != 1)) { if (!params.commandline) { mvwprintw( text_win, main_ycord, 1, "slurm_load_node: %s", slurm_strerror( slurm_get_errno())); main_ycord++; } else { printf("slurm_load_node: %s", slurm_strerror( slurm_get_errno())); } } } if (params.iterate) { for (i = 0; i < params.iterate; i++) { sleep(1); if (!params.commandline) { if ((rc = _get_option()) == 1) goto redraw; else if (resize_screen) { resize_screen = 0; goto redraw; } } } } else break; } if (!params.commandline) { nodelay(stdscr, FALSE); getch(); endwin(); } _smap_exit(0); /* Calls exit(), no return */ exit(0); /* Redundant, but eliminates compiler warning */ }