diff --git a/NEWS b/NEWS index f8859a481ed16375420701dc8777d457d106ab8f..b9c8b48b7f95fbe7161930ebd080b4c96a8822a6 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,9 @@ documents those changes that are of interest to users and admins. * Changes in SLURM 1.2.0-pre4 ============================= + -- added node_inx to job_step_info_t to get the node indecies for mapping out + steps in a job by nodes. + -- sview grid added * Changes in SLURM 1.2.0-pre3 ============================= diff --git a/slurm/slurm.h.in b/slurm/slurm.h.in index 3cfcc8024db1d04948228af04b9819275ce37228..e19e216f27ea0363a82e9f45321a4f1a7709ee83 100644 --- a/slurm/slurm.h.in +++ b/slurm/slurm.h.in @@ -16,7 +16,7 @@ * any later version. * * In addition, as a special exception, the copyright holders give permission - * to link the code of portions of this program with the OpenSSL library under + * to link the code of portions of this program with the OpenSSL library under * certain conditions as described in each individual source file, and * distribute linked combinations including the two. You must obey the GNU * General Public License in all respects for all of the code used other than @@ -598,6 +598,9 @@ typedef struct { char *nodes; /* list of nodes allocated to job_step */ char *name; /* name of job step */ char *network; /* network specs for job step */ + int *node_inx; /* list index pairs into node_table for *nodes: + * start_range_1, end_range_1, + * start_range_2, .., -1 */ } job_step_info_t; typedef struct job_step_info_response_msg { diff --git a/src/common/list.c b/src/common/list.c index 93d686b3c15a242e075bd9cb553b83015aed9478..c55c69ce61bc98ad8177d1edf9ccc9b0e0b4e26e 100644 --- a/src/common/list.c +++ b/src/common/list.c @@ -15,7 +15,7 @@ * any later version. * * In addition, as a special exception, the copyright holders give permission - * to link the code of portions of this program with the OpenSSL library under + * to link the code of portions of this program with the OpenSSL library under * certain conditions as described in each individual source file, and * distribute linked combinations including the two. You must obey the GNU * General Public License in all respects for all of the code used other than diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c index 941b0d7a2f4b8652f3f94478fa2c22fcbebdb2c6..7c5c33d201c8437d59cc5e07da844bfdd8798235 100644 --- a/src/common/slurm_protocol_pack.c +++ b/src/common/slurm_protocol_pack.c @@ -1761,24 +1761,24 @@ unpack_error: * IN/OUT buffer - destination of the pack, contains pointers that are * automatically updated */ -void -pack_job_step_info_members(uint32_t job_id, uint16_t step_id, - uint32_t user_id, uint32_t num_tasks, - time_t start_time, char *partition, - char *nodes, char *name, char *network, - Buf buffer) -{ - pack32((uint32_t)job_id, buffer); - pack16((uint16_t)step_id, buffer); - pack32((uint32_t)user_id, buffer); - pack32((uint32_t)num_tasks, buffer); - - pack_time(start_time, buffer); - packstr(partition, buffer); - packstr(nodes, buffer); - packstr(name, buffer); - packstr(network, buffer); -} +/* void */ +/* pack_job_step_info_members(uint32_t job_id, uint16_t step_id, */ +/* uint32_t user_id, uint32_t num_tasks, */ +/* time_t start_time, char *partition, */ +/* char *nodes, char *name, char *network, */ +/* Buf buffer) */ +/* { */ +/* pack32((uint32_t)job_id, buffer); */ +/* pack16((uint16_t)step_id, buffer); */ +/* pack32((uint32_t)user_id, buffer); */ +/* pack32((uint32_t)num_tasks, buffer); */ + +/* pack_time(start_time, buffer); */ +/* packstr(partition, buffer); */ +/* packstr(nodes, buffer); */ +/* packstr(name, buffer); */ +/* packstr(network, buffer); */ +/* } */ /* pack_job_step_info * packs a slurm job steps info @@ -1786,17 +1786,17 @@ pack_job_step_info_members(uint32_t job_id, uint16_t step_id, * IN/OUT buffer - destination of the pack, contains pointers that are * automatically updated */ -void -pack_job_step_info(job_step_info_t * step, Buf buffer) -{ - pack_job_step_info_members(step->job_id, - step->step_id, - step->user_id, - step->num_tasks, - step->start_time, - step->partition, step->nodes, - step->name, step->network, buffer); -} +/* void */ +/* pack_job_step_info(job_step_info_t * step, Buf buffer) */ +/* { */ +/* pack_job_step_info_members(step->job_id, */ +/* step->step_id, */ +/* step->user_id, */ +/* step->num_tasks, */ +/* step->start_time, */ +/* step->partition, step->nodes, */ +/* step->name, step->network, buffer); */ +/* } */ /* _unpack_job_step_info_members * unpacks a set of slurm job step info for one job step @@ -1808,6 +1808,7 @@ static int _unpack_job_step_info_members(job_step_info_t * step, Buf buffer) { uint16_t uint16_tmp = 0; + char *node_inx_str; safe_unpack32(&step->job_id, buffer); safe_unpack16(&step->step_id, buffer); @@ -1819,7 +1820,14 @@ _unpack_job_step_info_members(job_step_info_t * step, Buf buffer) safe_unpackstr_xmalloc(&step->nodes, &uint16_tmp, buffer); safe_unpackstr_xmalloc(&step->name, &uint16_tmp, buffer); safe_unpackstr_xmalloc(&step->network, &uint16_tmp, buffer); - + safe_unpackstr_xmalloc(&node_inx_str, &uint16_tmp, buffer); + if (node_inx_str == NULL) + step->node_inx = bitfmt2int(""); + else { + step->node_inx = bitfmt2int(node_inx_str); + xfree(node_inx_str); + } + return SLURM_SUCCESS; unpack_error: @@ -1827,6 +1835,7 @@ unpack_error: xfree(step->nodes); xfree(step->name); xfree(step->network); + xfree(step->node_inx); return SLURM_ERROR; } diff --git a/src/common/slurm_protocol_pack.h b/src/common/slurm_protocol_pack.h index 162684e1b87b1b761506f22fde836fd20c5b27c9..f8315942dbf115305ab54f8371b5a96d7d158565 100644 --- a/src/common/slurm_protocol_pack.h +++ b/src/common/slurm_protocol_pack.h @@ -125,7 +125,7 @@ extern int unpack_msg ( slurm_msg_t * msgi , Buf buffer ); * IN/OUT buffer - destination of the pack, contains pointers that are * automatically updated */ -void pack_job_step_info ( job_step_info_t* step, Buf buffer ); +/* void pack_job_step_info ( job_step_info_t* step, Buf buffer ); */ /* pack_job_step_info_members * pack selected fields of the description of a job into a buffer @@ -133,9 +133,9 @@ void pack_job_step_info ( job_step_info_t* step, Buf buffer ); * IN/OUT buffer - destination of the pack, contains pointers that are * automatically updated */ -void pack_job_step_info_members( uint32_t job_id, uint16_t step_id, - uint32_t user_id, uint32_t num_tasks, time_t start_time, - char *partition, char *nodes, char *name, char *network, - Buf buffer ); +/* void pack_job_step_info_members( uint32_t job_id, uint16_t step_id, */ +/* uint32_t user_id, uint32_t num_tasks, time_t start_time, */ +/* char *partition, char *nodes, char *name, char *network, */ +/* Buf buffer ); */ #endif diff --git a/src/plugins/select/bluegene/block_allocator/block_allocator.c b/src/plugins/select/bluegene/block_allocator/block_allocator.c index 7d8ea7858a34ab2a2bf49f2cac2ca1d9078dd263..c922b819c40e9e79c5f036cbb3d790eb40e49321 100644 --- a/src/plugins/select/bluegene/block_allocator/block_allocator.c +++ b/src/plugins/select/bluegene/block_allocator/block_allocator.c @@ -16,7 +16,7 @@ * any later version. * * In addition, as a special exception, the copyright holders give permission - * to link the code of portions of this program with the OpenSSL library under + * to link the code of portions of this program with the OpenSSL library under * certain conditions as described in each individual source file, and * distribute linked combinations including the two. You must obey the GNU * General Public License in all respects for all of the code used other than diff --git a/src/plugins/select/bluegene/block_allocator/block_allocator.h b/src/plugins/select/bluegene/block_allocator/block_allocator.h index e48bc4b20afbbac40104731d4829edc6856e1341..6f6c1630371344d18b099e3576c11ede2c62b578 100644 --- a/src/plugins/select/bluegene/block_allocator/block_allocator.h +++ b/src/plugins/select/bluegene/block_allocator/block_allocator.h @@ -15,7 +15,7 @@ * any later version. * * In addition, as a special exception, the copyright holders give permission - * to link the code of portions of this program with the OpenSSL library under + * to link the code of portions of this program with the OpenSSL library under * certain conditions as described in each individual source file, and * distribute linked combinations including the two. You must obey the GNU * General Public License in all respects for all of the code used other than diff --git a/src/plugins/select/bluegene/plugin/select_bluegene.c b/src/plugins/select/bluegene/plugin/select_bluegene.c index 94d50aa42563bc44f238ea1bbc1c73cc9784b824..c3568e9ae9ec8ab9288b38fc732811288e59482e 100644 --- a/src/plugins/select/bluegene/plugin/select_bluegene.c +++ b/src/plugins/select/bluegene/plugin/select_bluegene.c @@ -17,7 +17,7 @@ * any later version. * * In addition, as a special exception, the copyright holders give permission - * to link the code of portions of this program with the OpenSSL library under + * to link the code of portions of this program with the OpenSSL library under * certain conditions as described in each individual source file, and * distribute linked combinations including the two. You must obey the GNU * General Public License in all respects for all of the code used other than diff --git a/src/slurmctld/step_mgr.c b/src/slurmctld/step_mgr.c index 30c8796c8574f28fb78f8ae5e0fa70880750e19d..509547081c0822cdb2152224d05209f5bc46fccf 100644 --- a/src/slurmctld/step_mgr.c +++ b/src/slurmctld/step_mgr.c @@ -837,14 +837,18 @@ static void _pack_ctld_job_step_info(struct step_record *step, Buf buffer) task_cnt = step->job_ptr->num_procs; node_list = step->job_ptr->nodes; } - pack_job_step_info_members(step->job_ptr->job_id, - step->step_id, - step->job_ptr->user_id, - task_cnt, - step->start_time, - step->job_ptr->partition, - node_list, - step->name, step->network, buffer); + pack32((uint32_t)step->job_ptr->job_id, buffer); + pack16((uint16_t)step->step_id, buffer); + pack32((uint32_t)step->job_ptr->user_id, buffer); + pack32((uint32_t)task_cnt, buffer); + + pack_time(step->start_time, buffer); + packstr(step->job_ptr->partition, buffer); + packstr(node_list, buffer); + packstr(step->name, buffer); + packstr(step->network, buffer); + pack_bit_fmt(step->step_node_bitmap, buffer); + } /* diff --git a/src/smap/job_functions.c b/src/smap/job_functions.c index 0c0a1b637784e58760df4814664599420e258aff..ed0baec6d4a278c448a530e9a9d7d03cb61a13fe 100644 --- a/src/smap/job_functions.c +++ b/src/smap/job_functions.c @@ -16,7 +16,7 @@ * any later version. * * In addition, as a special exception, the copyright holders give permission - * to link the code of portions of this program with the OpenSSL library under + * to link the code of portions of this program with the OpenSSL library under * certain conditions as described in each individual source file, and * distribute linked combinations including the two. You must obey the GNU * General Public License in all respects for all of the code used other than diff --git a/src/smap/partition_functions.c b/src/smap/partition_functions.c index 914f5e057cb9645bc77de8b3722898d5d91f47b0..a0d60c115b56df72c848ed2c8cd23a3ca87582f4 100644 --- a/src/smap/partition_functions.c +++ b/src/smap/partition_functions.c @@ -17,7 +17,7 @@ * any later version. * * In addition, as a special exception, the copyright holders give permission - * to link the code of portions of this program with the OpenSSL library under + * to link the code of portions of this program with the OpenSSL library under * certain conditions as described in each individual source file, and * distribute linked combinations including the two. You must obey the GNU * General Public License in all respects for all of the code used other than diff --git a/src/smap/smap.c b/src/smap/smap.c index 75a03dd6821adafce473b29a482bf9e49db0374e..b5d52844b19674ef3c9cf18bcffe3b1ab7a72b40 100644 --- a/src/smap/smap.c +++ b/src/smap/smap.c @@ -17,7 +17,7 @@ * any later version. * * In addition, as a special exception, the copyright holders give permission - * to link the code of portions of this program with the OpenSSL library under + * to link the code of portions of this program with the OpenSSL library under * certain conditions as described in each individual source file, and * distribute linked combinations including the two. You must obey the GNU * General Public License in all respects for all of the code used other than diff --git a/src/sview/grid.c b/src/sview/grid.c index 8b1aec95d52adab6cb60ee1bd9367fe0d904bd51..b9bce47626f88d57c8c221313742e8ed0c96390c 100644 --- a/src/sview/grid.c +++ b/src/sview/grid.c @@ -52,29 +52,16 @@ GStaticMutex blinking_mutex = G_STATIC_MUTEX_INIT; static void _open_node(GtkWidget *widget, GdkEventButton *event, grid_button_t *grid_button) { - int error_code = SLURM_SUCCESS; - node_info_msg_t *node_info_ptr = NULL; - node_info_t *node_ptr = NULL; GError *error = NULL; char title[100]; ListIterator itr = NULL; popup_info_t *popup_win = NULL; - if((error_code = get_new_info_node(&node_info_ptr, force_refresh)) - == SLURM_NO_CHANGE_IN_DATA) { - goto update_it; - } - if (error_code != SLURM_SUCCESS) { - printf("slurm_load_node: %s\n", slurm_strerror(error_code)); - return; - } -update_it: - node_ptr = &node_info_ptr->node_array[grid_button->inx]; #ifdef HAVE_BG snprintf(title, 100, - "Info about base partition %s", node_ptr->name); + "Info about base partition %s", grid_button->node_name); #else - snprintf(title, 100, "Info about node %s", node_ptr->name); + snprintf(title, 100, "Info about node %s", grid_button->node_name); #endif itr = list_iterator_create(popup_list); while((popup_win = list_next(itr))) { @@ -87,7 +74,7 @@ update_it: if(!popup_win) { popup_win = create_popup_info(INFO_PAGE, NODE_PAGE, title); - popup_win->spec_info->data = g_strdup(node_ptr->name); + popup_win->spec_info->data = g_strdup(grid_button->node_name); if (!g_thread_create((gpointer)popup_thr, popup_win, FALSE, &error)) { @@ -431,22 +418,33 @@ extern void put_buttons_in_table(GtkTable *table, List button_list) gtk_widget_show_all(GTK_WIDGET(table)); } -extern int get_system_stats() +extern int get_system_stats(GtkTable *table) { int error_code = SLURM_SUCCESS; node_info_msg_t *node_info_ptr = NULL; List node_list = NULL; int changed = 1; + static GtkWidget *label = NULL; + char error_char[100]; + #ifdef HAVE_BG int y=0, z=0; #endif + if(label) + gtk_widget_destroy(label); + if((error_code = get_new_info_node(&node_info_ptr, force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { changed = 0; goto update_it; } - if (error_code != SLURM_SUCCESS) { - printf("slurm_load_node: %s\n", slurm_strerror(error_code)); + if (error_code != SLURM_SUCCESS) { + snprintf(error_char, 100, "slurm_load_node: %s\n", + slurm_strerror(error_code)); + label = gtk_label_new(error_char); + gtk_table_attach_defaults(table, label, 0, 1, 0, 1); + gtk_widget_show(label); + return SLURM_ERROR; } update_it: @@ -456,7 +454,7 @@ update_it: grid_button_list = list_create(destroy_grid_button); node_list = create_node_info_list(node_info_ptr, changed); setup_grid_table(main_grid_table, grid_button_list, node_list); - + gtk_widget_show_all(GTK_WIDGET(main_grid_table)); return SLURM_SUCCESS; } @@ -638,7 +636,6 @@ extern void sview_init_grid() return; } if (error_code != SLURM_SUCCESS) { - g_print("slurm_load_node: %s\n", slurm_strerror(error_code)); return; } if(!grid_button_list) { diff --git a/src/sview/sview.c b/src/sview/sview.c index 0ce5b85983b6275ecb586572dd1ba46423d7c627..8f4a130f1a281955496fe1618c515e4e6fee9894 100644 --- a/src/sview/sview.c +++ b/src/sview/sview.c @@ -48,6 +48,7 @@ typedef struct { sview_parameters_t params; int adding = 1; int fini = 0; +int grid_init = 0; bool toggled = FALSE; bool force_refresh = FALSE; List popup_list; @@ -60,6 +61,9 @@ GtkWidget *main_window = NULL; GtkWidget *grid_window = NULL; GtkTable *main_grid_table = NULL; GStaticMutex sview_mutex = G_STATIC_MUTEX_INIT; +GMutex *grid_mutex = NULL; +GCond *grid_cond = NULL; +GtkActionGroup *admin_action_group = NULL; display_data_t main_display_data[] = { {G_TYPE_NONE, JOB_PAGE, "Jobs", TRUE, -1, @@ -108,16 +112,31 @@ void *_page_thr(void *arg) int num = page->page_num; GtkTable *table = page->table; display_data_t *display_data = &main_display_data[num]; - xfree(page); static int thread_count = 0; + xfree(page); + + if(!grid_init) { + /* we need to signal any threads that are waiting */ + g_mutex_lock(grid_mutex); + g_cond_signal(grid_cond); + g_mutex_unlock(grid_mutex); + + /* wait for the grid to be inited */ + g_mutex_lock(grid_mutex); + g_cond_wait(grid_cond, grid_mutex); + g_mutex_unlock(grid_mutex); + + /* if the grid isn't there just return */ + if(!grid_init) + return NULL; + } gdk_threads_enter(); sview_reset_grid(); thread_count++; gdk_flush(); gdk_threads_leave(); - - while(page_running[num]) { + while(page_running[num]) { g_static_mutex_lock(&sview_mutex); gdk_threads_enter(); sview_init_grid(); @@ -146,6 +165,44 @@ void *_page_thr(void *arg) return NULL; } +void *_grid_init_thr(void *arg) +{ + guint page = 0; + GtkScrolledWindow *window = NULL; + GtkBin *bin = NULL; + GtkViewport *view = NULL; + GtkTable *table = NULL; + int rc = SLURM_SUCCESS; + + while(!grid_init) { + gdk_threads_enter(); + page = gtk_notebook_get_current_page( + GTK_NOTEBOOK(main_notebook)); + window = GTK_SCROLLED_WINDOW( + gtk_notebook_get_nth_page(GTK_NOTEBOOK(main_notebook), + page)); + bin = GTK_BIN(&window->container); + view = GTK_VIEWPORT(bin->child); + bin = GTK_BIN(&view->bin); + table = GTK_TABLE(bin->child); + /* set up the main grid */ + rc = get_system_stats(table); + gdk_flush(); + gdk_threads_leave(); + + if(rc != SLURM_SUCCESS) + sleep(global_sleep_time); + else + grid_init = 1; + + } + g_mutex_lock(grid_mutex); + g_cond_signal(grid_cond); + g_mutex_unlock(grid_mutex); + + return NULL; +} + static void _page_switched(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, @@ -159,18 +216,29 @@ static void _page_switched(GtkNotebook *notebook, GtkViewport *view = GTK_VIEWPORT(bin->child); GtkBin *bin2 = GTK_BIN(&view->bin); GtkTable *table = GTK_TABLE(bin2->child); - int i; + int i = 0; static int running=-1; page_thr_t *page_thr = NULL; GError *error = NULL; - + static int started_grid_init = 0; + /* make sure we aren't adding the page, and really asking for info */ if(adding) return; + else if(!grid_init && !started_grid_init) { + /* start the thread to make the grid only once */ + if (!g_thread_create(_grid_init_thr, notebook, FALSE, &error)) + { + g_printerr ("Failed to create grid init thread: %s\n", + error->message); + return; + } + started_grid_init = 1; + } if(running != -1) { page_running[running] = 0; - } + } for(i=0; i<PAGE_CNT; i++) { if(main_display_data[i].id == -1) @@ -209,6 +277,8 @@ static void _page_switched(GtkNotebook *notebook, static void _set_admin_mode(GtkToggleAction *action) { +// GtkAction *admin_action = NULL; + if(admin_mode) { admin_mode = FALSE; gtk_statusbar_pop(GTK_STATUSBAR(main_statusbar), @@ -220,6 +290,7 @@ static void _set_admin_mode(GtkToggleAction *action) "Admin mode activated! " "Think before you alter anything."); } + gtk_action_group_set_sensitive(admin_action_group, admin_mode); } static void _set_grid(GtkToggleAction *action) @@ -269,22 +340,27 @@ static gboolean _delete(GtkWidget *widget, /* Returns a menubar widget made from the above menu */ static GtkWidget *_get_menubar_menu(GtkWidget *window, GtkWidget *notebook) { - GtkActionGroup *action_group = NULL; GtkUIManager *ui_manager = NULL; GtkAccelGroup *accel_group = NULL; GError *error = NULL; + GtkActionGroup *action_group = NULL; /* Our menu*/ const char *ui_description = "<ui>" " <menubar name='main'>" + " <menu action='actions'>" + " <menuitem action='search'/>" + " <menuitem action='refresh'/>" + " <menuitem action='reconfig'/>" + " <separator/>" + " <menuitem action='exit'/>" + " </menu>" " <menu action='options'>" " <menuitem action='grid'/>" " <menuitem action='interval'/>" - " <menuitem action='refresh'/>" " <separator/>" " <menuitem action='admin'/>" - " <menuitem action='reconfig'/>" " <separator/>" " <menu action='tab_pos'>" " <menuitem action='tab_top'/>" @@ -292,46 +368,44 @@ static GtkWidget *_get_menubar_menu(GtkWidget *window, GtkWidget *notebook) " <menuitem action='tab_left'/>" " <menuitem action='tab_right'/>" " </menu>" - " <separator/>" - " <menuitem action='exit'/>" " </menu>" " <menu action='displays'>" - " <menuitem action='search'/>" - " <separator/>" " <menuitem action='config'/>" - " <menuitem action='daemons'/>" " </menu>" " <menu action='help'>" " <menuitem action='about'/>" + " <menuitem action='manual'/>" " </menu>" " </menubar>" "</ui>"; GtkActionEntry entries[] = { - {"options", NULL, "_Options"}, - {"displays", NULL, "_Query"}, - {"tab_pos", NULL, "_Tab Pos"}, - {"interval", NULL, "Set _Refresh Interval", - "<control>r", "Change Refresh Interval", + {"actions", NULL, "_Actions", NULL, "<alt>a"}, + {"options", NULL, "_Options", NULL, "<alt>o"}, + {"displays", NULL, "_Query", NULL, "<alt>q"}, + {"tab_pos", NULL, "_Tab Pos", NULL, "<alt>t"}, + {"interval", GTK_STOCK_REFRESH, "Set Refresh _Interval", + "<control>i", "Change Refresh Interval", G_CALLBACK(change_refresh_popup)}, - {"refresh", NULL, "Refresh", + {"refresh", GTK_STOCK_REFRESH, "Refresh", "F5", "Refreshes page", G_CALLBACK(refresh_main)}, - {"reconfig", NULL, "_SLURM Reconfigure", - "<control>s", "Reconfigures System", - G_CALLBACK(slurm_reconfigure)}, - {"config", NULL, "Config _Info", - "<control>i", "Displays info from slurm.conf file", + {"config", NULL, "_Config Info", + "<control>c", "Displays info from slurm.conf file", G_CALLBACK(create_config_popup)}, - {"daemons", NULL, "_Daemons", - "<control>d", "Displays Daemons running on node", - G_CALLBACK(create_daemon_popup)}, {"search", NULL, "Search", "<control>f", "Search through SLURM", G_CALLBACK(create_search_popup)}, - {"exit", NULL, "E_xit", + {"exit", GTK_STOCK_CLOSE, "E_xit", "<control>x", "Exits Program", G_CALLBACK(_delete)}, - {"help", NULL, "_Help"}, - {"about", NULL, "_About"} + {"help", NULL, "_Help", NULL, "<alt>h"}, + {"about", GTK_STOCK_HELP, "_About", NULL, "<control>a"}, + {"manual", NULL, "_Manual", NULL, "<control>m"} + }; + + GtkActionEntry admin_entries[] = { + {"reconfig", NULL, "SLURM _Reconfigure", + "<control>r", "Reconfigures System", + G_CALLBACK(slurm_reconfigure)}, }; GtkRadioActionEntry radio_entries[] = { @@ -355,7 +429,6 @@ static GtkWidget *_get_menubar_menu(GtkWidget *window, GtkWidget *notebook) G_CALLBACK(_set_admin_mode), FALSE} }; - /* Make an accelerator group (shortcut keys) */ action_group = gtk_action_group_new ("MenuActions"); @@ -367,9 +440,16 @@ static GtkWidget *_get_menubar_menu(GtkWidget *window, GtkWidget *notebook) gtk_action_group_add_toggle_actions(action_group, toggle_entries, G_N_ELEMENTS(toggle_entries), NULL); + admin_action_group = gtk_action_group_new ("MenuActions"); + gtk_action_group_add_actions(admin_action_group, admin_entries, + G_N_ELEMENTS(admin_entries), + window); + gtk_action_group_set_sensitive(admin_action_group, FALSE); + ui_manager = gtk_ui_manager_new(); gtk_ui_manager_insert_action_group(ui_manager, action_group, 0); - + gtk_ui_manager_insert_action_group(ui_manager, admin_action_group, 1); + accel_group = gtk_ui_manager_get_accel_group(ui_manager); gtk_window_add_accel_group(GTK_WINDOW(window), accel_group); @@ -418,16 +498,16 @@ int main(int argc, char *argv[]) /* GtkWidget *button = NULL; */ GtkBin *bin = NULL; GtkViewport *view = NULL; - int i=0; - _init_pages(); g_thread_init(NULL); gdk_threads_init(); gdk_threads_enter(); /* Initialize GTK */ gtk_init (&argc, &argv); + grid_mutex = g_mutex_new(); + grid_cond = g_cond_new(); /* make sure the system is up */ grid_window = GTK_WIDGET(create_scrolled_window()); bin = GTK_BIN(>K_SCROLLED_WINDOW(grid_window)->container); @@ -435,12 +515,10 @@ int main(int argc, char *argv[]) bin = GTK_BIN(&view->bin); main_grid_table = GTK_TABLE(bin->child); gtk_table_set_homogeneous(main_grid_table, TRUE); - while(get_system_stats() != SLURM_SUCCESS) - sleep(10); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(grid_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - + #ifdef HAVE_BG gtk_widget_set_size_request(grid_window, 164, -1); #endif @@ -466,17 +544,6 @@ int main(int argc, char *argv[]) menubar = _get_menubar_menu(main_window, main_notebook); gtk_table_attach_defaults(GTK_TABLE(table), menubar, 0, 1, 0, 1); - /* create search button */ -/* button = gtk_button_new_with_label("Search"); */ -/* g_signal_connect(G_OBJECT(button), */ -/* "pressed", */ -/* G_CALLBACK(create_search_popup), */ -/* main_window); */ - -/* gtk_table_attach(GTK_TABLE(table), button, 1, 2, 0, 1, */ -/* GTK_SHRINK, GTK_EXPAND | GTK_FILL, */ -/* 0, 0); */ - gtk_notebook_popup_enable(GTK_NOTEBOOK(main_notebook)); gtk_notebook_set_scrollable(GTK_NOTEBOOK(main_notebook), TRUE); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(main_notebook), GTK_POS_TOP); @@ -508,6 +575,8 @@ int main(int argc, char *argv[]) create_page(GTK_NOTEBOOK(main_notebook), &main_display_data[i]); } + + /* tell signal we are done adding */ adding = 0; popup_list = list_create(destroy_popup_info); @@ -516,7 +585,6 @@ int main(int argc, char *argv[]) /* Finished! */ gtk_main (); gdk_threads_leave(); - return 0; } diff --git a/src/sview/sview.h b/src/sview/sview.h index cefff694b95912a34929fe0775dc1e5e3539d9b0..66d1af376a4725574a81bb8a8b39444ae4de8441 100644 --- a/src/sview/sview.h +++ b/src/sview/sview.h @@ -240,7 +240,7 @@ extern char *change_grid_color(List button_list, int start_inx, int end_inx, extern void get_button_list_from_main(List *button_list, int start, int end, int color_inx); extern void put_buttons_in_table(GtkTable *table, List button_list); -extern int get_system_stats(); +extern int get_system_stats(GtkTable *table); extern int setup_grid_table(GtkTable *table, List button_list, List node_list); extern void sview_init_grid(); extern void sview_reset_grid();