~ubuntu-branches/ubuntu/vivid/slurm-llnl/vivid

« back to all changes in this revision

Viewing changes to src/sview/block_info.c

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2009-09-24 23:28:15 UTC
  • mfrom: (1.1.11 upstream) (3.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090924232815-enh65jn32q1ebg07
Tags: 2.0.5-1
* New upstream release 
* Changed dependecy from lib-mysqlclient15 to lib-mysqlclient 
* Added Default-Start for runlevel 2 and 4 and $remote_fs requirement in
  init.d scripts (Closes: #541252)
* Postinst checks for wrong runlevels 2 and 4 links
* Upgraded to standard version 3.8.3
* Add lintian overrides for missing slurm-llnl-configurator.html in doc
  base registration
* modified postrm scripts to ignore pkill return value in order to avoid
  postrm failure when no slurm process is running
* Checking for slurmctld.pid before cancelling running and pending
  jobs during package removal 

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
8
8
 *  Written by Danny Auble <da@llnl.gov>
9
9
 * 
10
 
 *  LLNL-CODE-402394.
 
10
 *  CODE-OCEC-09-009. All rights reserved.
11
11
 *  
12
12
 *  This file is part of SLURM, a resource management program.
13
 
 *  For details, see <http://www.llnl.gov/linux/slurm/>.
 
13
 *  For details, see <https://computing.llnl.gov/linux/slurm/>.
 
14
 *  Please also read the included file: DISCLAIMER.
14
15
 *  
15
16
 *  SLURM is free software; you can redistribute it and/or modify it under
16
17
 *  the terms of the GNU General Public License as published by the Free
76
77
#ifdef HAVE_BGL
77
78
        SORTID_USE,
78
79
#endif
 
80
        SORTID_NODE_INX,
79
81
        SORTID_USER,
80
82
        SORTID_CNT
81
83
};
117
119
#endif
118
120
        {G_TYPE_STRING, SORTID_MLOADERIMAGE, "Mloader Image",
119
121
         FALSE, EDIT_NONE, refresh_block, create_model_block, admin_edit_block},
 
122
        {G_TYPE_POINTER, SORTID_NODE_INX,  NULL, FALSE, EDIT_NONE, 
 
123
         refresh_resv, create_model_resv, admin_edit_resv},
120
124
        {G_TYPE_INT, SORTID_UPDATED, NULL, FALSE, EDIT_NONE, refresh_block,
121
125
         create_model_block, admin_edit_block},
122
126
        {G_TYPE_NONE, -1, NULL, FALSE, EDIT_NONE}
133
137
        {G_TYPE_STRING, PART_PAGE, "Partition", TRUE, BLOCK_PAGE},
134
138
        {G_TYPE_STRING, NODE_PAGE, "Base Partitions", TRUE, BLOCK_PAGE},
135
139
        {G_TYPE_STRING, SUBMIT_PAGE, "Job Submit", FALSE, BLOCK_PAGE},
 
140
        {G_TYPE_STRING, RESV_PAGE, "Reservation", TRUE, BLOCK_PAGE},
136
141
        {G_TYPE_NONE, -1, NULL, FALSE, EDIT_NONE}
137
142
};
138
143
 
336
341
        gtk_tree_store_set(treestore, iter, SORTID_NODELIST,
337
342
                           block_ptr->nodes, -1);
338
343
 
 
344
        gtk_tree_store_set(treestore, iter, 
 
345
                           SORTID_NODE_INX, block_ptr->bp_inx, -1);
 
346
 
339
347
#ifdef HAVE_BGL
340
348
        gtk_tree_store_set(treestore, iter, SORTID_BLRTSIMAGE,
341
349
                           block_ptr->blrtsimage, -1);
444
452
        remove_old(model, SORTID_UPDATED);
445
453
}
446
454
 
 
455
static int _sview_block_sort_aval_dec(sview_block_info_t* rec_a,
 
456
                                      sview_block_info_t* rec_b)
 
457
{
 
458
        int size_a = rec_a->node_cnt;
 
459
        int size_b = rec_b->node_cnt;
 
460
 
 
461
        if (size_a > size_b)
 
462
                return -1;
 
463
        else if (size_a < size_b)
 
464
                return 1;
 
465
 
 
466
        if(rec_a->nodes && rec_b->nodes) {
 
467
                size_a = strcmp(rec_a->nodes, rec_b->nodes);
 
468
                if (size_a > 0)
 
469
                        return -1;
 
470
                else if (size_a < 0)
 
471
                        return 1;
 
472
        }
 
473
        return 0;
 
474
}
 
475
 
447
476
static List _create_block_list(partition_info_msg_t *part_info_ptr,
448
477
                               node_select_info_msg_t *node_select_ptr,
449
478
                               int changed)
457
486
        if(!changed && block_list) {
458
487
                return block_list;
459
488
        }
460
 
        
 
489
 
461
490
        if(block_list) {
462
491
                list_destroy(block_list);
463
492
        }
518
547
                                break;
519
548
                        }
520
549
                }
521
 
                if(block_ptr->bg_conn_type == SELECT_SMALL)
 
550
                if(block_ptr->bg_conn_type >= SELECT_SMALL)
522
551
                        block_ptr->size = 0;
523
552
 
524
553
                list_append(block_list, block_ptr);
525
554
        }
526
555
        
 
556
        list_sort(block_list,
 
557
                  (ListCmpF)_sview_block_sort_aval_dec);
 
558
 
 
559
 
527
560
        return block_list;
528
561
}
529
562
 
566
599
                                change_grid_color(
567
600
                                        popup_win->grid_button_list,
568
601
                                        block_ptr->bp_inx[j],
569
 
                                        block_ptr->bp_inx[j+1], i);
 
602
                                        block_ptr->bp_inx[j+1], i, true);
570
603
                                j += 2;
571
604
                        }
572
605
                        _layout_block_record(treeview, block_ptr, update);
627
660
        static bool changed = 0;
628
661
                
629
662
        if(!force && ((now - last) < global_sleep_time)) {
 
663
                if(*node_select_ptr != bg_info_ptr)
 
664
                        error_code = SLURM_SUCCESS;
630
665
                *node_select_ptr = bg_info_ptr;
631
666
                if(changed) 
632
667
                        return SLURM_SUCCESS;
651
686
        }
652
687
 
653
688
        bg_info_ptr = new_bg_ptr;
 
689
 
 
690
        if(*node_select_ptr != bg_info_ptr) 
 
691
                error_code = SLURM_SUCCESS;
 
692
        
654
693
        *node_select_ptr = new_bg_ptr;
655
694
#endif
656
695
        return error_code;
839
878
 
840
879
        if((block_error_code = get_new_info_node_select(&node_select_ptr, 
841
880
                                                        force_refresh))
842
 
           == SLURM_NO_CHANGE_IN_DATA) { 
 
881
           == SLURM_NO_CHANGE_IN_DATA) {
843
882
                if((!display_widget || view == ERROR_VIEW) 
844
 
                   || (part_error_code != SLURM_NO_CHANGE_IN_DATA))
 
883
                   || (part_error_code != SLURM_NO_CHANGE_IN_DATA)) {
845
884
                        goto display_it;
 
885
                }
846
886
                changed = 0;
847
887
        } else if (block_error_code != SLURM_SUCCESS) {
848
888
                if(view == ERROR_VIEW)
879
919
                                                  bp_inx[j],
880
920
                                                  sview_block_info_ptr->
881
921
                                                  bp_inx[j+1],
882
 
                                                  i);
 
922
                                                  i, true);
883
923
                        j += 2;
884
924
                }
885
925
                i++;
926
966
        int changed = 1;
927
967
        sview_block_info_t *block_ptr = NULL;
928
968
        int j=0, i=-1;
929
 
        char *host = NULL, *host2 = NULL;
930
 
        hostlist_t hostlist = NULL;
931
 
        int found = 0;
 
969
        hostset_t hostset = NULL;
932
970
        ListIterator itr = NULL;
933
971
        
934
972
        if(!spec_info->display_widget) {
1015
1053
                                 popup_win->display_data, SORTID_CNT);
1016
1054
        }
1017
1055
 
1018
 
        if(!popup_win->grid_button_list) {
1019
 
                popup_win->grid_button_list = copy_main_button_list();
1020
 
                put_buttons_in_table(popup_win->grid_table,
1021
 
                                     popup_win->grid_button_list);
1022
 
        }
 
1056
        setup_popup_grid_list(popup_win);
 
1057
 
1023
1058
        spec_info->view = INFO_VIEW;
1024
1059
        if(spec_info->type == INFO_PAGE) {
1025
1060
                _display_info_block(block_list, popup_win);
1039
1074
                                  search_info->gchar_data)) 
1040
1075
                                continue;
1041
1076
                        break;
 
1077
                case RESV_PAGE:
1042
1078
                case NODE_PAGE:
1043
1079
                        if(!block_ptr->nodes)
1044
1080
                                continue;
1045
1081
                        
1046
 
                        hostlist = hostlist_create(search_info->gchar_data);
1047
 
                        host = hostlist_shift(hostlist);
1048
 
                        hostlist_destroy(hostlist);
1049
 
                        if(!host) 
1050
 
                                continue;
1051
 
 
1052
 
                        hostlist = hostlist_create(block_ptr->nodes);
1053
 
                        found = 0;
1054
 
                        while((host2 = hostlist_shift(hostlist))) { 
1055
 
                                if(!strcmp(host, host2)) {
1056
 
                                        free(host2);
1057
 
                                        found = 1;
1058
 
                                        break; 
1059
 
                                }
1060
 
                                free(host2);
 
1082
                        if(!(hostset = hostset_create(search_info->gchar_data)))
 
1083
                                continue;
 
1084
                        if(!hostset_intersects(hostset, block_ptr->nodes)) {
 
1085
                                hostset_destroy(hostset);
 
1086
                                continue;
1061
1087
                        }
1062
 
                        hostlist_destroy(hostlist);
1063
 
                        if(!found)
1064
 
                                continue;
 
1088
                        hostset_destroy(hostset);                               
1065
1089
                        break;
1066
1090
                case BLOCK_PAGE:
1067
1091
                        switch(search_info->search_type) {
1107
1131
                        change_grid_color(
1108
1132
                                popup_win->grid_button_list,
1109
1133
                                block_ptr->bp_inx[j],
1110
 
                                block_ptr->bp_inx[j+1], i);
 
1134
                                block_ptr->bp_inx[j+1], i, false);
1111
1135
                        j += 2;
1112
1136
                }
1113
1137
        }
1130
1154
        popup_info_t *popup_win = (popup_info_t *)arg;
1131
1155
        switch(type) {
1132
1156
        case TAB_CLICKED:
1133
 
                make_fields_menu(menu, display_data_block, SORTID_CNT);
 
1157
                make_fields_menu(NULL, menu, display_data_block, SORTID_CNT);
1134
1158
                break;
1135
1159
        case ROW_CLICKED:
1136
1160
                make_options_menu(tree_view, path, menu, options_data_block);
1137
1161
                break;
1138
1162
        case POPUP_CLICKED:
1139
 
                make_popup_fields_menu(popup_win, menu);
 
1163
                make_fields_menu(popup_win, menu,
 
1164
                                 popup_win->display_data, SORTID_CNT);
1140
1165
                break;
1141
1166
        default:
1142
1167
                g_error("UNKNOWN type %d given to set_fields\n", type);
1153
1178
        int i=0;
1154
1179
 
1155
1180
        gtk_tree_model_get(model, iter, SORTID_BLOCK, &name, -1);
 
1181
 
1156
1182
        switch(id) {
1157
1183
        case JOB_PAGE:
1158
1184
                snprintf(title, 100, "Jobs(s) in block %s", name);
1160
1186
        case PART_PAGE:
1161
1187
                snprintf(title, 100, "Partition(s) containing block %s", name);
1162
1188
                break;
 
1189
        case RESV_PAGE:
 
1190
                snprintf(title, 100, "Reservations(s) containing block %s",
 
1191
                         name);
 
1192
                break;
1163
1193
        case NODE_PAGE:
1164
1194
                snprintf(title, 100, "Base Partition(s) in block %s", name);
1165
1195
                break;
1192
1222
                gtk_window_present(GTK_WINDOW(popup_win->popup));
1193
1223
                return;
1194
1224
        }
 
1225
 
 
1226
        /* Pass the model and the structs from the iter so we can always get
 
1227
           the current node_inx.
 
1228
        */
 
1229
        popup_win->model = model;
 
1230
        popup_win->iter = *iter;
 
1231
        popup_win->node_inx_id = SORTID_NODE_INX;
 
1232
 
1195
1233
        switch(id) {
1196
1234
        case JOB_PAGE:
1197
1235
                popup_win->spec_info->search_info->gchar_data = name;
1201
1239
                gtk_tree_model_get(model, iter, SORTID_PARTITION, &name, -1);
1202
1240
                popup_win->spec_info->search_info->gchar_data = name;
1203
1241
                break;
 
1242
        case RESV_PAGE: 
1204
1243
        case NODE_PAGE: 
1205
1244
                g_free(name);
1206
1245
                gtk_tree_model_get(model, iter, SORTID_NODELIST, &name, -1);