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

« back to all changes in this revision

Viewing changes to src/sview/job_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:
3
3
 *  mode of sview.
4
4
 *****************************************************************************
5
5
 *  Copyright (C) 2004-2007 The Regents of the University of California.
6
 
 *  Copyright (C) 2008 Lawrence Livermore National Security.
 
6
 *  Copyright (C) 2008-2009 Lawrence Livermore National Security.
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
62
63
        SORTID_ACTION,
63
64
        SORTID_ALLOC, 
64
65
        SORTID_ALLOC_NODE,
 
66
#ifdef HAVE_CRAY_XT
 
67
        SORTID_ALPS_RESV_ID,
 
68
#endif
65
69
        SORTID_BATCH,
66
70
#ifdef HAVE_BG
67
71
        SORTID_BLRTSIMAGE,
122
126
        SORTID_REASON,
123
127
        SORTID_REQ_NODELIST,
124
128
        SORTID_REQ_PROCS,
 
129
        SORTID_RESV_NAME,
125
130
#ifdef HAVE_BG
126
131
        SORTID_ROTATE,
127
132
#endif
138
143
        SORTID_TIME,
139
144
        SORTID_TIMELIMIT,
140
145
        SORTID_TMP_DISK,
141
 
        SORTID_WCKEY,
142
146
        SORTID_UPDATED,
143
147
        SORTID_USER, 
 
148
        SORTID_WCKEY,
 
149
        SORTID_NODE_INX, 
144
150
        SORTID_CNT
145
151
};
146
152
 
180
186
        {G_TYPE_STRING, SORTID_RAMDISKIMAGE, "Ramdisk Image",
181
187
         FALSE, EDIT_TEXTBOX, refresh_job, create_model_job, admin_edit_job},
182
188
#endif
 
189
#ifdef HAVE_CRAY_XT
 
190
        {G_TYPE_STRING, SORTID_ALPS_RESV_ID, "ALPS Resv ID", TRUE, EDIT_NONE, 
 
191
         refresh_job, create_model_job, admin_edit_job},
 
192
#endif
183
193
        {G_TYPE_STRING, SORTID_USER, "User", TRUE, EDIT_NONE, refresh_job,
184
194
         create_model_job, admin_edit_job},
185
195
        {G_TYPE_STRING, SORTID_GROUP, "Group", FALSE, EDIT_NONE, refresh_job,
242
252
         FALSE, EDIT_NONE, refresh_job, create_model_job, admin_edit_job},
243
253
        {G_TYPE_STRING, SORTID_REQ_PROCS, "Requested Procs", 
244
254
         FALSE, EDIT_TEXTBOX, refresh_job, create_model_job, admin_edit_job},
 
255
        {G_TYPE_STRING, SORTID_RESV_NAME, "Reservation Name",
 
256
         FALSE, EDIT_TEXTBOX, refresh_job, create_model_job, admin_edit_job},
245
257
        {G_TYPE_STRING, SORTID_MIN_NODES, "Min Nodes", 
246
258
         FALSE, EDIT_TEXTBOX, refresh_job, create_model_job, admin_edit_job},
247
259
        {G_TYPE_STRING, SORTID_MAX_NODES, "Max Nodes", 
272
284
         FALSE, EDIT_NONE, refresh_job, create_model_job, admin_edit_job},
273
285
        {G_TYPE_STRING, SORTID_ACCOUNT, "Account Charged", 
274
286
         FALSE, EDIT_NONE, refresh_job, create_model_job, admin_edit_job},
275
 
        {G_TYPE_STRING, SORTID_REASON, "Wait Reason", 
 
287
        {G_TYPE_STRING, SORTID_REASON, "Reason Waiting", 
276
288
         FALSE, EDIT_NONE, refresh_job, create_model_job, admin_edit_job},
277
289
        {G_TYPE_STRING, SORTID_FEATURES, "Features", 
278
290
         FALSE, EDIT_TEXTBOX, refresh_job, create_model_job, admin_edit_job},
290
302
         FALSE, EDIT_NONE, refresh_job, create_model_job, admin_edit_job},
291
303
        {G_TYPE_STRING, SORTID_COMMENT, "Comment", 
292
304
         FALSE, EDIT_NONE, refresh_job, create_model_job, admin_edit_job},
 
305
        {G_TYPE_POINTER, SORTID_NODE_INX,  NULL, FALSE, EDIT_NONE, 
 
306
         refresh_resv, create_model_resv, admin_edit_resv},
293
307
        {G_TYPE_INT, SORTID_UPDATED, NULL, FALSE, EDIT_NONE, refresh_job,
294
308
         create_model_job, admin_edit_job},
295
 
        {G_TYPE_NONE, EDIT_NONE, NULL, FALSE, EDIT_NONE}
 
309
        {G_TYPE_NONE, -1, NULL, FALSE, EDIT_NONE}
296
310
};
297
311
 
298
312
static display_data_t options_data_job[] = {
309
323
#else
310
324
        {G_TYPE_STRING, NODE_PAGE, "Nodes", TRUE, JOB_PAGE},
311
325
#endif
 
326
        {G_TYPE_STRING, RESV_PAGE, "Reservation", TRUE, JOB_PAGE},
312
327
        {G_TYPE_NONE, -1, NULL, FALSE, EDIT_NONE}
313
328
};
314
329
 
605
620
                        goto return_error;
606
621
                }
607
622
                job_msg->nice = NICE_OFFSET + temp_int;
608
 
                
609
623
                break;
610
624
        case SORTID_REQ_PROCS:
611
625
                temp_int = strtol(new_text, (char **)NULL, 10);
615
629
                        goto return_error;
616
630
                job_msg->num_procs = (uint32_t)temp_int;
617
631
                break;
 
632
        case SORTID_RESV_NAME:
 
633
                job_msg->reservation = xstrdup(new_text);
 
634
                type = "reservation name";
 
635
                break;
618
636
        case SORTID_MIN_NODES:
619
637
                temp_int = strtol(new_text, (char **)NULL, 10);
620
638
                
664
682
                type = "name";
665
683
                break;
666
684
        case SORTID_WCKEY:              
667
 
                xstrfmtcat(job_msg->name, "\"%s", new_text);
 
685
                job_msg->wckey = xstrdup(new_text);
668
686
                type = "wckey";
669
687
                break;
670
688
        case SORTID_SHARED:
671
 
                if (!strcasecmp(new_text, "yes")) {
 
689
                if (!strcasecmp(new_text, "yes")) 
672
690
                        job_msg->shared = 1;
673
 
                        
674
 
                } else {
 
691
                else 
675
692
                        job_msg->shared = 0;
676
693
                        
677
 
                }
678
694
                type = "shared";
679
695
                break;
680
696
        case SORTID_CONTIGUOUS:
681
 
                if (!strcasecmp(new_text, "yes")) {
 
697
                if (!strcasecmp(new_text, "yes")) 
682
698
                        job_msg->contiguous = 1;
683
 
                        
684
 
                } else {
 
699
                else 
685
700
                        job_msg->contiguous = 0;
686
701
                        
687
 
                }
688
702
                type = "contiguous";    
689
703
                break;
690
704
        case SORTID_REQ_NODELIST:               
1039
1053
                               sview_job_info_t *sview_job_info_ptr, 
1040
1054
                               int update)
1041
1055
{
1042
 
        char *nodes = NULL, *uname = NULL, *jname = NULL, *wckey = NULL;
 
1056
        char *nodes = NULL, *reason = NULL, *uname = NULL;
1043
1057
        char tmp_char[50];
1044
1058
        time_t now_time = time(NULL);
1045
1059
        job_info_t *job_ptr = sview_job_info_ptr->job_ptr;
1050
1064
        GtkTreeStore *treestore = 
1051
1065
                GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
1052
1066
 
1053
 
        if (job_ptr->name && job_ptr->name[0]) {
1054
 
                char *temp = NULL;
1055
 
                /* first set the jname to the job_ptr->name */
1056
 
                jname = xstrdup(job_ptr->name);
1057
 
                /* then grep for " since that is the delimiter for
1058
 
                   the wckey */
1059
 
                if((temp = strchr(jname, '\"'))) {
1060
 
                        /* if we have a wckey set the " to NULL to
1061
 
                         * end the jname */
1062
 
                        temp[0] = '\0';
1063
 
                        /* increment and copy the remainder */
1064
 
                        temp++;
1065
 
                        wckey = xstrdup(temp);
1066
 
                }
1067
 
        }
1068
 
        
1069
 
 
1070
1067
        if(!treestore)
1071
1068
                return;
1072
1069
        if(!job_ptr->nodes || !strcasecmp(job_ptr->nodes,"waiting...")) {
1156
1153
                                           sizeof(tmp_char), 
1157
1154
                                           SELECT_PRINT_BG_ID));
1158
1155
#endif
 
1156
#ifdef HAVE_CRAY_XT
 
1157
        add_display_treestore_line(update, treestore, &iter, 
 
1158
                                   find_col_name(display_data_job,
 
1159
                                                 SORTID_ALPS_RESV_ID), 
 
1160
                                   select_g_sprint_jobinfo(
 
1161
                                           job_ptr->select_jobinfo, 
 
1162
                                           tmp_char, 
 
1163
                                           sizeof(tmp_char), 
 
1164
                                           SELECT_PRINT_RESV_ID));
 
1165
#endif
1159
1166
        uname = uid_to_string((uid_t)job_ptr->user_id);
1160
1167
        add_display_treestore_line(update, treestore, &iter, 
1161
1168
                                   find_col_name(display_data_job,
1177
1184
        add_display_treestore_line(update, treestore, &iter, 
1178
1185
                                   find_col_name(display_data_job,
1179
1186
                                                 SORTID_NAME), 
1180
 
                                   jname);
 
1187
                                   job_ptr->name);
1181
1188
        
1182
1189
        add_display_treestore_line(update, treestore, &iter, 
1183
1190
                                   find_col_name(display_data_job,
1184
1191
                                                 SORTID_WCKEY), 
1185
 
                                   wckey);
 
1192
                                   job_ptr->wckey);
1186
1193
        
1187
1194
        sprintf(tmp_char, "%u", job_ptr->priority);
1188
1195
        add_display_treestore_line(update, treestore, &iter, 
1337
1344
                                           SELECT_PRINT_RAMDISK_IMAGE));
1338
1345
        
1339
1346
#endif
 
1347
#ifdef HAVE_CRAY_XT
 
1348
        add_display_treestore_line(update, treestore, &iter, 
 
1349
                                   find_col_name(display_data_job,
 
1350
                                                 SORTID_ALPS_RESV_ID), 
 
1351
                                   select_g_sprint_jobinfo(
 
1352
                                           job_ptr->select_jobinfo, 
 
1353
                                           tmp_char, 
 
1354
                                           sizeof(tmp_char), 
 
1355
                                           SELECT_PRINT_RESV_ID));
 
1356
#endif
1340
1357
 
1341
1358
        if(job_ptr->contiguous)
1342
1359
                sprintf(tmp_char, "yes");
1433
1450
                                                 SORTID_ACCOUNT),
1434
1451
                                   job_ptr->account);
1435
1452
 
 
1453
        if (job_ptr->state_desc)
 
1454
                reason = job_ptr->state_desc;
 
1455
        else
 
1456
                reason = job_reason_string(job_ptr->state_reason);
1436
1457
        add_display_treestore_line(update, treestore, &iter, 
1437
1458
                                   find_col_name(display_data_job,
1438
 
                                                 SORTID_REASON),
1439
 
                                   job_reason_string(job_ptr->state_reason));
 
1459
                                                 SORTID_REASON), reason);
1440
1460
 
1441
1461
        add_display_treestore_line(update, treestore, &iter, 
1442
1462
                                   find_col_name(display_data_job,
1447
1467
                                   find_col_name(display_data_job,
1448
1468
                                                 SORTID_COMMENT),
1449
1469
                                   job_ptr->comment);
1450
 
        xfree(jname);
1451
 
        xfree(wckey);
1452
1470
}
1453
1471
 
1454
1472
static void _update_job_record(sview_job_info_t *sview_job_info_ptr, 
1455
1473
                               GtkTreeStore *treestore,
1456
1474
                               GtkTreeIter *iter)
1457
1475
{
1458
 
        char *nodes = NULL, *uname = NULL, *jname = NULL, *wckey = NULL;
 
1476
        char *nodes = NULL, *reason = NULL, *uname = NULL;
1459
1477
        char tmp_char[50];
1460
1478
        time_t now_time = time(NULL);
1461
1479
        GtkTreeIter step_iter;
1464
1482
        struct group *group_info = NULL;
1465
1483
        uint16_t term_sig = 0;
1466
1484
     
1467
 
        if (job_ptr->name && job_ptr->name[0]) {
1468
 
                char *temp = NULL;
1469
 
                /* first set the jname to the job_ptr->name */
1470
 
                jname = xstrdup(job_ptr->name);
1471
 
                /* then grep for " since that is the delimiter for
1472
 
                   the wckey */
1473
 
                if((temp = strchr(jname, '\"'))) {
1474
 
                        /* if we have a wckey set the " to NULL to
1475
 
                         * end the jname */
1476
 
                        temp[0] = '\0';
1477
 
                        /* increment and copy the remainder */
1478
 
                        temp++;
1479
 
                        wckey = xstrdup(temp);
1480
 
                }
1481
 
        }
1482
 
        
1483
1485
        gtk_tree_store_set(treestore, iter, SORTID_UPDATED, 1, -1);
1484
1486
        if(!job_ptr->nodes || !strcasecmp(job_ptr->nodes,"waiting...")) {
1485
1487
                sprintf(tmp_char,"00:00:00");
1610
1612
                                   SELECT_PRINT_RAMDISK_IMAGE), -1);
1611
1613
        
1612
1614
#endif
 
1615
#ifdef HAVE_CRAY_XT
 
1616
        gtk_tree_store_set(treestore, iter, 
 
1617
                           SORTID_ALPS_RESV_ID, 
 
1618
                           select_g_sprint_jobinfo(
 
1619
                                   job_ptr->select_jobinfo, 
 
1620
                                   tmp_char, 
 
1621
                                   sizeof(tmp_char), 
 
1622
                                   SELECT_PRINT_RESV_ID), -1);
 
1623
#endif
1613
1624
        uname = uid_to_string((uid_t)job_ptr->user_id);
1614
1625
        gtk_tree_store_set(treestore, iter, 
1615
1626
                           SORTID_USER, uname, -1);
1626
1637
                           SORTID_GROUP, 
1627
1638
                           tmp_char, -1);
1628
1639
                
1629
 
        gtk_tree_store_set(treestore, iter, SORTID_NAME, jname, -1);
1630
 
        gtk_tree_store_set(treestore, iter, SORTID_WCKEY, wckey, -1);
 
1640
        gtk_tree_store_set(treestore, iter, SORTID_NAME, job_ptr->name, -1);
 
1641
        gtk_tree_store_set(treestore, iter, SORTID_WCKEY, job_ptr->wckey, -1);
1631
1642
        gtk_tree_store_set(treestore, iter, 
1632
1643
                           SORTID_STATE, 
1633
1644
                           job_state_string(job_ptr->job_state), -1);
1654
1665
                           SORTID_NUM_PROCS, tmp_char, -1);
1655
1666
        
1656
1667
        gtk_tree_store_set(treestore, iter, SORTID_NODELIST, nodes, -1);
 
1668
 
 
1669
        gtk_tree_store_set(treestore, iter, 
 
1670
                           SORTID_NODE_INX, job_ptr->node_inx, -1);
 
1671
 
1657
1672
        gtk_tree_store_set(treestore, iter, SORTID_REQ_NODELIST,
1658
1673
                           job_ptr->req_nodes, -1);
1659
1674
        gtk_tree_store_set(treestore, iter, SORTID_EXC_NODELIST,
1697
1712
        gtk_tree_store_set(treestore, iter,
1698
1713
                           SORTID_REQ_PROCS, tmp_char, -1);
1699
1714
 
 
1715
        gtk_tree_store_set(treestore, iter,
 
1716
                           SORTID_RESV_NAME, job_ptr->resv_name, -1);
 
1717
 
1700
1718
        sprintf(tmp_char, "%u", job_ptr->min_sockets);
1701
1719
        gtk_tree_store_set(treestore, iter,
1702
1720
                           SORTID_MIN_SOCKETS, tmp_char, -1);
1746
1764
 
1747
1765
        gtk_tree_store_set(treestore, iter,
1748
1766
                           SORTID_FEATURES, job_ptr->features, -1);
 
1767
        if (job_ptr->state_desc)
 
1768
                reason = job_ptr->state_desc;
 
1769
        else
 
1770
                reason = job_reason_string(job_ptr->state_reason);
1749
1771
        gtk_tree_store_set(treestore, iter,
1750
 
                           SORTID_REASON,
1751
 
                           job_reason_string(job_ptr->state_reason), -1);
 
1772
                           SORTID_REASON, reason, -1);
 
1773
 
1752
1774
        gtk_tree_store_set(treestore, iter,
1753
1775
                           SORTID_NETWORK, job_ptr->network, -1);
1754
1776
        gtk_tree_store_set(treestore, iter,
1765
1787
                _update_info_step(sview_job_info_ptr, 
1766
1788
                                  GTK_TREE_MODEL(treestore), NULL, iter);
1767
1789
                
1768
 
        xfree(jname);
1769
 
        xfree(wckey);
1770
1790
        return;
1771
1791
}
1772
1792
 
2125
2145
        }
2126
2146
}
2127
2147
 
 
2148
static int _sview_job_sort_aval_dec(sview_job_info_t* rec_a,
 
2149
                                    sview_job_info_t* rec_b)
 
2150
{
 
2151
        int size_a = rec_a->node_cnt;
 
2152
        int size_b = rec_b->node_cnt;
 
2153
 
 
2154
        if (size_a > size_b)
 
2155
                return -1;
 
2156
        else if (size_a < size_b)
 
2157
                return 1;
 
2158
 
 
2159
        if(rec_a->nodes && rec_b->nodes) {
 
2160
                size_a = strcmp(rec_a->nodes, rec_b->nodes);
 
2161
                if (size_a > 0)
 
2162
                        return -1;
 
2163
                else if (size_a < 0)
 
2164
                        return 1;
 
2165
        }
 
2166
        return 0;
 
2167
}
2128
2168
 
2129
2169
static List _create_job_info_list(job_info_msg_t *job_info_ptr,
2130
2170
                                  job_step_info_response_msg_t *step_info_ptr,
2217
2257
                                memcpy(step_ptr->node_inx, job_ptr->node_inx, 
2218
2258
                                       sizeof(int) * count);
2219
2259
#endif
2220
 
                                list_push(sview_job_info_ptr->step_list, 
2221
 
                                          step_ptr);
 
2260
                                list_append(sview_job_info_ptr->step_list, 
 
2261
                                            step_ptr);
2222
2262
                        }                       
2223
2263
                }
2224
2264
                list_append(odd_info_list, sview_job_info_ptr);
2231
2271
                }
2232
2272
                list_append(info_list, sview_job_info_ptr);
2233
2273
        }
 
2274
 
 
2275
 
 
2276
        list_sort(info_list,
 
2277
                  (ListCmpF)_sview_job_sort_aval_dec);
 
2278
 
 
2279
        list_sort(odd_info_list,
 
2280
                  (ListCmpF)_sview_job_sort_aval_dec);
 
2281
 
2234
2282
update_color:
2235
2283
        if(want_odd_states)
2236
2284
                return odd_info_list;
2249
2297
        GtkTreeView *treeview = NULL;
2250
2298
        int update = 0;
2251
2299
        int i = -1, j = 0;
2252
 
        int first_time = 0;
2253
2300
 
2254
2301
        if(spec_info->search_info->int_data == NO_VAL) {
2255
2302
        /*      info = xstrdup("No pointer given!"); */
2256
2303
                goto finished;
2257
2304
        }
2258
 
        if(!list_count(popup_win->grid_button_list)) 
2259
 
                first_time = 1;
2260
2305
 
2261
2306
need_refresh:
2262
2307
        if(!spec_info->display_widget) {
2283
2328
        } else if(spec_info->search_info->int_data2 == NO_VAL) {
2284
2329
                j=0;
2285
2330
                while(sview_job_info->job_ptr->node_inx[j] >= 0) {
2286
 
                        if(!first_time)
2287
2331
                                change_grid_color(
2288
2332
                                        popup_win->grid_button_list,
2289
2333
                                        sview_job_info->job_ptr->node_inx[j],
2290
2334
                                        sview_job_info->job_ptr->node_inx[j+1],
2291
 
                                        i);
2292
 
                        else
2293
 
                                get_button_list_from_main(
2294
 
                                        &popup_win->grid_button_list,
2295
 
                                        sview_job_info->job_ptr->node_inx[j],
2296
 
                                        sview_job_info->job_ptr->node_inx[j+1],
2297
 
                                        i);
 
2335
                                        i, true);
2298
2336
                        j += 2;
2299
2337
                }
2300
2338
                _layout_job_record(treeview, sview_job_info, update);
2308
2346
                           spec_info->search_info->int_data2) {
2309
2347
                                j=0;
2310
2348
                                while(step_ptr->node_inx[j] >= 0) {
2311
 
                                        if(!first_time) 
2312
 
                                                change_grid_color(
2313
 
                                                        popup_win->
2314
 
                                                        grid_button_list,
2315
 
                                                        step_ptr->node_inx[j],
2316
 
                                                        step_ptr->
2317
 
                                                        node_inx[j+1],
2318
 
                                                        i);
2319
 
                                        else
2320
 
                                                get_button_list_from_main(
2321
 
                                                        &popup_win->
2322
 
                                                        grid_button_list,
2323
 
                                                        step_ptr->node_inx[j],
2324
 
                                                        step_ptr->
2325
 
                                                        node_inx[j+1],
2326
 
                                                        i);
2327
 
 
 
2349
                                        change_grid_color(
 
2350
                                                popup_win->
 
2351
                                                grid_button_list,
 
2352
                                                step_ptr->node_inx[j],
 
2353
                                                step_ptr->
 
2354
                                                node_inx[j+1],
 
2355
                                                i, true);
2328
2356
                                        j += 2;
2329
2357
                                }
2330
2358
                                _layout_step_record(treeview, 
2365
2393
                        
2366
2394
                        goto need_refresh;
2367
2395
                }
2368
 
                
2369
 
                put_buttons_in_table(popup_win->grid_table,
2370
 
                                     popup_win->grid_button_list);
2371
2396
        }
2372
2397
        gtk_widget_show_all(spec_info->display_widget);
2373
2398
 
2396
2421
        static bool changed = 0;
2397
2422
                
2398
2423
        if(!force && ((now - last) < global_sleep_time)) {
2399
 
                error_code = SLURM_NO_CHANGE_IN_DATA;
 
2424
                if(*info_ptr != job_info_ptr) 
 
2425
                        error_code = SLURM_SUCCESS;
2400
2426
                *info_ptr = job_info_ptr;
2401
2427
                if(changed) 
2402
2428
                        return SLURM_SUCCESS;
2421
2447
                changed = 1;
2422
2448
        }
2423
2449
        job_info_ptr = new_job_ptr;
 
2450
 
 
2451
        if(*info_ptr != job_info_ptr) 
 
2452
                error_code = SLURM_SUCCESS;
 
2453
 
2424
2454
        *info_ptr = new_job_ptr;
2425
2455
        return error_code;
2426
2456
}
2434
2464
        int error_code = SLURM_NO_CHANGE_IN_DATA;
2435
2465
        time_t now = time(NULL);
2436
2466
        static time_t last;
 
2467
        static bool changed = 0;
2437
2468
                
2438
2469
        if(!force && ((now - last) < global_sleep_time)) {
2439
 
                error_code = SLURM_NO_CHANGE_IN_DATA;
 
2470
                if(*info_ptr != old_step_ptr) 
 
2471
                        error_code = SLURM_SUCCESS;
2440
2472
                *info_ptr = old_step_ptr;
 
2473
                if(changed) 
 
2474
                        return SLURM_SUCCESS;
2441
2475
                return error_code;
2442
2476
        }
2443
2477
        last = now;
2446
2480
                error_code = slurm_get_job_steps(old_step_ptr->last_update, 
2447
2481
                                                 0, 0, &new_step_ptr, 
2448
2482
                                                 show_flags);
2449
 
                if (error_code ==  SLURM_SUCCESS)
 
2483
                if (error_code == SLURM_SUCCESS) {
2450
2484
                        slurm_free_job_step_info_response_msg(old_step_ptr);
2451
 
                else if (slurm_get_errno () == SLURM_NO_CHANGE_IN_DATA) {
 
2485
                        changed = 1;
 
2486
                } else if (slurm_get_errno () == SLURM_NO_CHANGE_IN_DATA) {
2452
2487
                        error_code = SLURM_NO_CHANGE_IN_DATA;
2453
2488
                        new_step_ptr = old_step_ptr;
 
2489
                        changed = 0;
2454
2490
                }
2455
 
        } else
 
2491
        } else {
2456
2492
                error_code = slurm_get_job_steps((time_t) NULL, 0, 0, 
2457
2493
                                                 &new_step_ptr, show_flags);
 
2494
                changed = 1;
 
2495
        }
2458
2496
        old_step_ptr = new_step_ptr;
 
2497
 
 
2498
        if(*info_ptr != old_step_ptr) 
 
2499
                error_code = SLURM_SUCCESS;
 
2500
 
2459
2501
        *info_ptr = new_step_ptr;
2460
2502
        return error_code;
2461
2503
}
2727
2769
                                change_grid_color(grid_button_list,
2728
2770
                                                  job_ptr->node_inx[j],
2729
2771
                                                  job_ptr->node_inx[j+1],
2730
 
                                                  i);
 
2772
                                                  i, true);
2731
2773
                        j += 2;
2732
2774
                }
2733
2775
                i++;
2779
2821
        job_info_t *job_ptr = NULL;     
2780
2822
        ListIterator itr = NULL;
2781
2823
        char name[30], *uname = NULL;
2782
 
        char *host = NULL, *host2 = NULL;
2783
 
        hostlist_t hostlist = NULL;
2784
 
        int found = 0, name_diff;
 
2824
        hostset_t hostset = NULL;
 
2825
        int name_diff;
2785
2826
        
2786
2827
        if(!spec_info->display_widget)
2787
2828
                setup_popup_info(popup_win, display_data_job, SORTID_CNT);
2863
2904
                                 SORTID_CNT);
2864
2905
        }
2865
2906
 
2866
 
        if(popup_win->grid_button_list) {
2867
 
                list_destroy(popup_win->grid_button_list);
2868
 
        }              
2869
 
        
2870
 
#ifdef HAVE_3D
2871
 
        popup_win->grid_button_list = copy_main_button_list();
2872
 
#else
2873
 
        popup_win->grid_button_list = list_create(destroy_grid_button);
2874
 
#endif  
 
2907
        setup_popup_grid_list(popup_win);
2875
2908
 
2876
2909
        spec_info->view = INFO_VIEW;
2877
2910
        if(spec_info->type == INFO_PAGE) {
2944
2977
                                  job_ptr->partition))
2945
2978
                                continue;
2946
2979
                        break;
 
2980
                case RESV_PAGE:
 
2981
                        if(strcmp(search_info->gchar_data,
 
2982
                                  job_ptr->resv_name))
 
2983
                                continue;
 
2984
                        break;
2947
2985
                case BLOCK_PAGE:
2948
2986
                        select_g_sprint_jobinfo(
2949
2987
                                job_ptr->select_jobinfo, 
2957
2995
                        if(!job_ptr->nodes)
2958
2996
                                continue;
2959
2997
                        
2960
 
                        hostlist = hostlist_create(search_info->gchar_data);
2961
 
                        host = hostlist_shift(hostlist);
2962
 
                        hostlist_destroy(hostlist);
2963
 
                        if(!host)
2964
 
                                continue;
2965
 
                        
2966
 
                        hostlist = hostlist_create(job_ptr->nodes);
2967
 
                        found = 0;
2968
 
                        while((host2 = hostlist_shift(hostlist))) { 
2969
 
                                if(!strcmp(host, host2)) {
2970
 
                                        free(host2);
2971
 
                                        found = 1;
2972
 
                                        break; 
2973
 
                                }
2974
 
                                free(host2);
 
2998
                        if(!(hostset = hostset_create(search_info->gchar_data)))
 
2999
                                continue;
 
3000
                        if(!hostset_intersects(hostset, job_ptr->nodes)) {
 
3001
                                hostset_destroy(hostset);
 
3002
                                continue;
2975
3003
                        }
2976
 
                        hostlist_destroy(hostlist);
2977
 
                        if(!found)
2978
 
                                continue;
 
3004
                        hostset_destroy(hostset);                               
2979
3005
                        break;
2980
3006
                default:
2981
3007
                        continue;
2984
3010
                list_push(send_info_list, sview_job_info_ptr);
2985
3011
                j=0;
2986
3012
                while(job_ptr->node_inx[j] >= 0) {
2987
 
#ifdef HAVE_3D
2988
3013
                        change_grid_color(
2989
3014
                                popup_win->grid_button_list,
2990
3015
                                job_ptr->node_inx[j],
2991
 
                                job_ptr->node_inx[j+1], i);
2992
 
#else
2993
 
                        get_button_list_from_main(
2994
 
                                &popup_win->grid_button_list,
2995
 
                                job_ptr->node_inx[j],
2996
 
                                job_ptr->node_inx[j+1], i);
2997
 
#endif
 
3016
                                job_ptr->node_inx[j+1], i, false);
2998
3017
                        j += 2;
2999
3018
                }
3000
3019
        }
3001
3020
        list_iterator_destroy(itr);
3002
3021
 
3003
 
        put_buttons_in_table(popup_win->grid_table,
3004
 
                             popup_win->grid_button_list);
3005
 
 
3006
3022
        _update_info_job(send_info_list,
3007
3023
                         GTK_TREE_VIEW(spec_info->display_widget));
3008
3024
                        
3020
3036
        popup_info_t *popup_win = (popup_info_t *)arg;
3021
3037
        switch(type) {
3022
3038
        case TAB_CLICKED:
3023
 
                make_fields_menu(menu, display_data_job, SORTID_CNT);
 
3039
                make_fields_menu(NULL, menu, display_data_job, SORTID_CNT);
3024
3040
                break;
3025
3041
        case ROW_CLICKED:
3026
3042
                make_options_menu(tree_view, path, menu, options_data_job);
3027
3043
                break;
3028
3044
        case POPUP_CLICKED:
3029
 
                make_popup_fields_menu(popup_win, menu);
 
3045
                make_fields_menu(popup_win, menu,
 
3046
                                 popup_win->display_data, SORTID_CNT);
3030
3047
                break;
3031
3048
        default:
3032
3049
                g_error("UNKNOWN type %d given to set_fields\n", type);
3045
3062
 
3046
3063
        gtk_tree_model_get(model, iter, SORTID_JOBID, &jobid, -1);
3047
3064
        gtk_tree_model_get(model, iter, SORTID_ALLOC, &stepid, -1);
 
3065
 
3048
3066
        if(stepid)
3049
3067
                stepid = NO_VAL;
3050
3068
        else {
3060
3078
                        snprintf(title, 100, "Partition with job %d.%d",
3061
3079
                                 jobid, stepid);                        
3062
3080
                break;
 
3081
        case RESV_PAGE:
 
3082
                if(stepid == NO_VAL)
 
3083
                        snprintf(title, 100, "Reservation with job %d", jobid);
 
3084
                else
 
3085
                        snprintf(title, 100, "Reservation with job %d.%d",
 
3086
                                 jobid, stepid);                        
 
3087
                break;
3063
3088
        case NODE_PAGE:
3064
3089
                if(stepid == NO_VAL) {
3065
3090
#ifdef HAVE_BG
3124
3149
                return;
3125
3150
        }
3126
3151
        
 
3152
        /* Pass the model and the structs from the iter so we can always get
 
3153
           the current node_inx.
 
3154
        */
 
3155
        popup_win->model = model;
 
3156
        popup_win->iter = *iter;
 
3157
        popup_win->node_inx_id = SORTID_NODE_INX;
 
3158
 
3127
3159
        switch(id) {
3128
3160
        case NODE_PAGE:
3129
3161
                gtk_tree_model_get(model, iter, SORTID_NODELIST, &name, -1);
3133
3165
                gtk_tree_model_get(model, iter, SORTID_PARTITION, &name, -1);
3134
3166
                popup_win->spec_info->search_info->gchar_data = name;
3135
3167
                break;
 
3168
        case RESV_PAGE:
 
3169
                gtk_tree_model_get(model, iter, SORTID_RESV_NAME, &name, -1);
 
3170
                popup_win->spec_info->search_info->gchar_data = name;
 
3171
                break;
3136
3172
#ifdef HAVE_BG
3137
3173
        case BLOCK_PAGE: 
3138
3174
                gtk_tree_model_get(model, iter, SORTID_BLOCK, &name, -1);