1
/*___INFO__MARK_BEGIN__*/
2
/*************************************************************************
4
* The Contents of this file are made available subject to the terms of
5
* the Sun Industry Standards Source License Version 1.2
7
* Sun Microsystems Inc., March, 2001
10
* Sun Industry Standards Source License Version 1.2
11
* =================================================
12
* The contents of this file are subject to the Sun Industry Standards
13
* Source License Version 1.2 (the "License"); You may not use this file
14
* except in compliance with the License. You may obtain a copy of the
15
* License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
17
* Software provided under this License is provided on an "AS IS" basis,
18
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
19
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
20
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
21
* See the License for the specific provisions governing your rights and
22
* obligations concerning the Software.
24
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
26
* Copyright: 2001 by Sun Microsystems, Inc.
28
* All Rights Reserved.
30
************************************************************************/
31
/*___INFO__MARK_END__*/
37
#include <Xm/ToggleB.h>
39
#include <Xmt/Create.h>
40
#include <Xmt/Layout.h>
41
#include <Xmt/Chooser.h>
42
#include <Xmt/Dialog.h>
43
#include <Xmt/Dialogs.h>
44
#include <Xmt/MsgLine.h>
45
#include <Xmt/InputField.h>
46
#include <Xmt/Procedures.h>
52
#include "qmon_rmon.h"
53
#include "qmon_cull.h"
54
#include "qmon_util.h"
55
#include "qmon_init.h"
56
#include "qmon_timer.h"
57
#include "qmon_comm.h"
58
#include "qmon_browser.h"
60
#include "qmon_qaction.h"
61
#include "qmon_appres.h"
63
#include "qmon_message.h"
64
#include "qmon_widgets.h"
65
#include "qmon_manop.h"
66
#include "qmon_project.h"
67
#include "qmon_ticket.h"
68
#include "qmon_qcustom.h"
69
#include "qmon_globals.h"
70
#include "sge_all_listsL.h"
71
#include "sge_dstring.h"
72
#include "sge_string.h"
73
#include "sge_support.h"
74
#include "sge_answer.h"
75
#include "sge_cqueue.h"
76
#include "sge_cqueue_qstat.h"
77
#include "sge_cqueue_qconf.h"
78
#include "sge_select_queue.h"
79
#include "sge_qinstance.h"
80
#include "sge_qinstance_state.h"
81
#include "sge_qinstance_type.h"
82
#include "load_correction.h"
83
#include "sge_parse_num_par.h"
84
#include "sge_complex_schedd.h"
85
#include "qstat_printing.h"
86
#include "sge_centry.h"
87
#include "sge_qstat.h"
89
#include "gdi/sge_gdi_ctx.h"
90
#include "gdi/sge_gdi.h"
92
extern sge_gdi_ctx_class_t *ctx;
95
static Widget qmon_cq = 0;
96
static Widget cq_cqfolder = 0;
97
static Widget cq_customize = 0;
98
static Widget cq_tree = 0;
99
static Widget cq_message = 0;
100
static Widget cluster_queue_settings = 0;
101
static Widget qinstance_settings = 0;
102
static Widget cq_add = 0;
103
static Widget cq_clone = 0;
104
static Widget cq_mod = 0;
105
static Widget cq_delete = 0;
106
static Widget cq_load = 0;
107
static Widget cq_suspend = 0;
108
static Widget cq_resume = 0;
109
static Widget cq_disable = 0;
110
static Widget cq_enable = 0;
111
static Widget cq_reschedule = 0;
112
static Widget cq_sick = 0;
113
static Widget cq_clear_error = 0;
114
static Widget cq_force = 0;
115
static Widget cq_explain_states = 0;
116
static Widget cq_explain = 0;
118
static Boolean dirty = False;
119
static Widget current_matrix = 0;
125
** use this descriptor only here
136
static lDescr qi_descr[] = {
137
{ QI_queue, lStringT, NULL },
138
{ QI_qtype, lStringT, NULL },
139
{ QI_used_total, lStringT, NULL },
140
{ QI_load_avg, lStringT, NULL },
141
{ QI_arch, lStringT, NULL },
142
{ QI_states, lStringT, NULL },
143
{ NoName, lEndT, NULL}};
149
static int qi_field_sort_by = QI_queue;
150
static int qi_field_sort_direction = SORT_ASCENDING;
154
/*-------------------------------------------------------------------------*/
155
static Widget qhost_settings = 0;
156
static void qmonCQUpdateQhostMatrix(void);
158
static void qmonCQPopdown(Widget w, XtPointer cld, XtPointer cad);
159
static Widget qmonCQCreate(Widget shell);
160
static void qmonQinstanceHandleEnterLeave(Widget w, XtPointer cld, XEvent *ev, Boolean *ctd);
161
static void qmonCQHandleEnterLeave(Widget w, XtPointer cld, XEvent *ev, Boolean *ctd);
162
static void qmonQinstanceShowBrowserInfo(dstring *info, lListElem *qep);
163
static String qmonCQShowBrowserInfo(lListElem *qep);
164
static void qmonCQDelete(Widget matrix, XtPointer cld, XtPointer cad);
165
static void qmonCQChangeState(Widget w, XtPointer cld, XtPointer cad);
166
static void qmonCQFolderChange(Widget w, XtPointer cld, XtPointer cad);
167
static void qmonCQUpdateCQMatrix(void);
168
static void qmonCQUpdateQIMatrix(void);
169
static void qmonCQModify(Widget w, XtPointer cld, XtPointer cad);
170
static void qmonQinstanceSetLoad(Widget matrix, const char *qiname);
171
static void qmonQinstanceShowLoad(Widget w, XtPointer cld, XtPointer cad);
172
static void qmonCQSick(Widget w, XtPointer cld, XtPointer cad);
173
static void qmonQinstanceExplain(Widget w, XtPointer cld, XtPointer cad);
175
static void qmonQinstanceSort(Widget w, XtPointer cld, XtPointer cad);
178
static void qmonQinstanceShowBrowserExplain(
182
lList *exechost_list,
183
u_long32 explain_bits);
184
/* static void qmonCQSetValues(ListTreeItem *item); */
187
static void qmonCQHighlight(Widget w, XtPointer cld, XtPointer cad);
188
static void qmonCQMenu(Widget w, XtPointer cld, XtPointer cad);
189
static void qmonCQActivate(Widget w, XtPointer cld, XtPointer cad);
190
static void qmonCQFindNode(Widget w, XtPointer cld, XtPointer cad);
191
static void qmonCQFindNextNode(Widget w, XtPointer cld, XtPointer cad);
192
static ListTreeItem* CullToTree(Widget tree, ListTreeItem *parent, lList *shac);
193
static void qmonCQUpdateTree(void);
197
static ListTreeItem* cq_add_aulng(Widget tree, ListTreeItem *parent,
198
lListElem *elem, int field_nm,
199
StringConst attribute_name);
200
static ListTreeItem* cq_add_abool(Widget tree, ListTreeItem *parent,
201
lListElem *elem, int field_nm,
202
StringConst attribute_name);
203
static ListTreeItem* cq_add_amem(Widget tree, ListTreeItem *parent,
204
lListElem *elem, int field_nm,
205
StringConst attribute_name);
206
static ListTreeItem* cq_add_atime(Widget tree, ListTreeItem *parent,
207
lListElem *elem, int field_nm,
208
StringConst attribute_name);
209
static ListTreeItem* cq_add_ainter(Widget tree, ListTreeItem *parent,
210
lListElem *elem, int field_nm,
211
StringConst attribute_name);
212
static ListTreeItem* cq_add_astr(Widget tree, ListTreeItem *parent,
213
lListElem *elem, int field_nm,
214
StringConst attribute_name);
215
static ListTreeItem* cq_add_astrlist(Widget tree, ListTreeItem *parent,
216
lListElem *elem, int field_nm,
217
StringConst attribute_name);
218
static ListTreeItem* cq_add_ausrlist(Widget tree, ListTreeItem *parent,
219
lListElem *elem, int field_nm,
220
StringConst attribute_name);
221
static ListTreeItem* cq_add_aprjlist(Widget tree, ListTreeItem *parent,
222
lListElem *elem, int field_nm,
223
StringConst attribute_name);
224
static ListTreeItem* cq_add_acelist(Widget tree, ListTreeItem *parent,
225
lListElem *elem, int field_nm,
226
StringConst attribute_name);
227
static ListTreeItem* cq_add_asolist(Widget tree, ListTreeItem *parent,
228
lListElem *elem, int field_nm,
229
StringConst attribute_name);
230
static ListTreeItem* cq_add_aqtlist(Widget tree, ListTreeItem *parent,
231
lListElem *elem, int field_nm,
232
StringConst attribute_name);
235
static void qmonCQStartUpdate(Widget w, XtPointer cld, XtPointer cad);
236
static void qmonCQStopUpdate(Widget w, XtPointer cld, XtPointer cad);
240
/*-------------------------------------------------------------------------*/
242
/*-------------------------------------------------------------------------*/
243
void qmonCQPopup(Widget w, XtPointer cld, XtPointer cad)
247
DENTER(GUI_LAYER, "qmonCQPopup");
254
/* set busy cursor */
255
XmtDisplayBusyCursor(w);
258
shell = XmtGetTopLevelShell(w);
259
qmon_cq = qmonCQCreate(shell);
260
XmtAddDeleteCallback(shell, XmDO_NOTHING,
261
qmonCQPopdown, NULL);
265
** show qhost_settings folder only if showHostTab == true
266
** this can be set in ~/Qmon file or changed in Q to default to true
268
if (!SHOW_HOST_TAB) {
269
XmTabDeleteFolder(cq_cqfolder, XtParent(qhost_settings));
273
** fill the displayed dialogues
275
qmonQCUReadPreferences();
276
qmonCQUpdate(qmon_cq, NULL, NULL);
277
XmTabSetTabWidget(cq_cqfolder, current_matrix, True);
279
xmui_manage(qmon_cq);
281
/* set default cursor */
282
XmtDisplayDefaultCursor(w);
288
/*-------------------------------------------------------------------------*/
290
/*-------------------------------------------------------------------------*/
291
static void qmonCQPopdown(Widget w, XtPointer cld, XtPointer cad)
294
DENTER(GUI_LAYER, "qmonCQPopdown");
296
XtUnmanageChild(qmon_cq);
301
/*-------------------------------------------------------------------------*/
302
static Widget qmonCQCreate(
305
Widget cq_layout, cq_close, cq_update, cq_main_link,
308
DENTER(GUI_LAYER, "qmonCQCreate");
310
cq_layout = XmtBuildQueryDialog( parent, "qmon_cq",
312
"cq_close", &cq_close,
313
"cq_force", &cq_force,
314
"cq_update", &cq_update,
316
"cq_clone", &cq_clone,
318
"cq_delete", &cq_delete,
319
"cq_suspend", &cq_suspend,
320
"cq_resume", &cq_resume,
321
"cq_disable", &cq_disable,
322
"cq_enable", &cq_enable,
323
"cq_reschedule", &cq_reschedule,
324
"cq_clear_error", &cq_clear_error,
328
"cq_customize", &cq_customize,
329
"cq_tickets", &cq_tickets,
330
"cq_main_link", &cq_main_link,
331
"cq_message", &cq_message,
332
"cluster_queue_settings", &cluster_queue_settings,
333
"qinstance_settings", &qinstance_settings,
334
"qhost_settings", &qhost_settings,
335
"cq_cqfolder", &cq_cqfolder,
336
"cq_explain", &cq_explain,
337
"cq_explain_states", &cq_explain_states,
340
current_matrix = cluster_queue_settings;
342
if (SHOW_HOST_TAB && AUTOMATIC_UPDATE_HOST_TAB) {
343
/* start the needed timers and the corresponding update routines */
344
XtAddCallback(XtParent(cq_layout), XmNpopupCallback,
345
qmonCQStartUpdate, NULL);
346
XtAddCallback(XtParent(cq_layout), XmNpopdownCallback,
347
qmonCQStopUpdate, NULL);
353
XtAddCallback(cq_main_link, XmNactivateCallback,
354
qmonMainControlRaise, NULL);
355
XtAddCallback(cq_close, XmNactivateCallback,
356
qmonCQPopdown, NULL);
357
XtAddCallback(cq_update, XmNactivateCallback,
359
XtAddCallback(cq_tickets, XmNactivateCallback,
360
qmonPopupTicketOverview, NULL);
363
XtAddCallback(cq_tree, XtNactivateCallback,
364
qmonCQActivate, NULL);
365
XtAddCallback(cq_tree, XtNhighlightCallback,
366
qmonCQHighlight, NULL);
367
XtAddCallback(cq_tree, XtNmenuCallback,
371
XtAddCallback(cq_add, XmNactivateCallback,
373
XtAddCallback(cq_clone, XmNactivateCallback,
374
qmonCQModify, (XtPointer)QC_CLONE);
375
XtAddCallback(cq_mod, XmNactivateCallback,
376
qmonCQModify, (XtPointer)QC_MODIFY);
377
XtAddCallback(cq_delete, XmNactivateCallback,
380
XtAddCallback(cq_suspend, XmNactivateCallback,
381
qmonCQChangeState, (XtPointer)QI_DO_SUSPEND);
382
XtAddCallback(cq_resume, XmNactivateCallback,
383
qmonCQChangeState, (XtPointer)QI_DO_UNSUSPEND);
384
XtAddCallback(cq_disable, XmNactivateCallback,
385
qmonCQChangeState, (XtPointer)QI_DO_DISABLE);
386
XtAddCallback(cq_enable, XmNactivateCallback,
387
qmonCQChangeState, (XtPointer)QI_DO_ENABLE);
388
XtAddCallback(cq_reschedule, XmNactivateCallback,
389
qmonCQChangeState, (XtPointer)QI_DO_RESCHEDULE);
390
XtAddCallback(cq_clear_error, XmNactivateCallback,
391
qmonCQChangeState, (XtPointer)QI_DO_CLEARERROR);
392
XtAddCallback(cq_load, XmNactivateCallback,
393
qmonQinstanceShowLoad, NULL);
394
XtAddCallback(cq_sick, XmNactivateCallback,
396
XtAddCallback(cq_explain, XmNactivateCallback,
397
qmonQinstanceExplain, NULL);
401
XtAddCallback(cq_cqfolder, XmNvalueChangedCallback,
402
qmonCQFolderChange, NULL);
404
XtAddCallback(qinstance_settings, XmNdefaultActionCallback,
405
qmonQinstanceShowLoad, NULL);
407
XtAddCallback(qinstance_settings, XmNlabelActivateCallback,
408
qmonQinstanceSort, NULL);
411
XtAddCallback(cq_customize, XmNactivateCallback,
414
XtAddEventHandler(qinstance_settings, PointerMotionMask,
415
False, qmonQinstanceHandleEnterLeave,
417
XtAddEventHandler(cluster_queue_settings, PointerMotionMask,
418
False, qmonCQHandleEnterLeave,
422
XtAddEventHandler(XtParent(cq_layout), StructureNotifyMask, False,
423
SetMinShellSize, NULL);
427
** register callback procedures
429
XmtRegisterCallbackProcedure("DeleteClusterQueue", qmonCQDelete, XtRWidget);
431
XtSetSensitive(cq_load, False);
432
XtSetSensitive(cq_explain_states, False);
433
XtSetSensitive(cq_explain, False);
441
/*-------------------------------------------------------------------------*/
442
void qmonCQUpdate( Widget w, XtPointer cld, XtPointer cad)
444
DENTER(GUI_LAYER, "qmonCQUpdate");
451
XmtDisplayBusyCursor(w);
452
if (current_matrix == cluster_queue_settings) {
453
qmonCQUpdateCQMatrix();
454
} else if (current_matrix == qinstance_settings) {
455
qmonCQUpdateQIMatrix();
456
} else if (current_matrix == qhost_settings) {
457
qmonCQUpdateQhostMatrix();
460
/* qmonCQUpdateTree(); */
462
XmtDisplayDefaultCursor(w);
468
static char search_for[256] = "";
469
static ListTreeMultiReturnStruct *matches;
471
/*-------------------------------------------------------------------------*/
472
static void qmonCQFindNode(Widget w, XtPointer cld, XtPointer cad)
474
Widget tree = (Widget)cld;
475
ListTreeItem *item = NULL;
479
DENTER(GUI_LAYER, "qmonCQFindNode");
485
status = XmtAskForString(w, "xmtAskForString", "@{Enter item name}", name, 256, NULL);
487
if (status && name[0] != '\0') {
488
item = ListTreeFindChildName(tree, ListTreeFirstItem(tree), name);
493
strncpy(search_for, name, 256);
496
** Highlight the new_node
498
ListTreeOpenNode(tree, item);
499
ListTreeMakeItemVisible(tree, item);
500
ListTreeHighlightItem(tree, item, True);
503
strcpy(search_for, "");
509
/*-------------------------------------------------------------------------*/
510
static void qmonCQFindNextNode(Widget w, XtPointer cld, XtPointer cad)
512
Widget tree = (Widget)cld;
513
static int count = 0;
514
ListTreeItem *current;
517
DENTER(GUI_LAYER, "qmonCQFindNode");
519
if (!matches && strcmp(search_for, "")) {
522
matches = ListTreeBuildSearchList(tree, ListTreeFirstItem(tree),search_for, 1);
526
for (i=0; i<matches->count; i++)
527
printf("matches->items[%d]->text: %s\n", i, matches->items[i]->text);
533
** Highlight the new_node
535
if (matches && matches->count > 1 && count < matches->count) {
540
current = matches->items[count];
541
DPRINTF(("current->text: %s, current->count = %d\n", current->text, current->count));
543
** open branch and highlight item
545
ListTreeOpenNode(tree, current);
546
ListTreeMakeItemVisible(tree, current);
547
ListTreeHighlightItem(tree, current, True);
550
if (count == matches->count)
557
/*-------------------------------------------------------------------------*/
558
static void qmonCQHighlight(Widget w, XtPointer cld, XtPointer cad)
560
ListTreeMultiReturnStruct *ret = (ListTreeMultiReturnStruct*)cad;
564
DENTER(GUI_LAYER, "qmonCQHighlight");
566
if (rmon_mlgetl(&RMON_DEBUG_ON, GUI_LAYER) & INFOPRINT) {
567
printf("HIGHLIGHT: count=%d\n",ret->count);
568
for (i=0; i<ret->count; i++) {
570
printf("%s",item->text);
571
while (item->parent) {
573
printf("<--%s",item->text);
579
if (ret && ret->count > 0) {
580
item = ret->items[0];
581
/* qmonCQSetValues(item); */
587
/*-------------------------------------------------------------------------*/
588
static void qmonCQMenu(Widget w, XtPointer cld, XtPointer cad)
590
ListTreeItemReturnStruct *ret = (ListTreeItemReturnStruct *)cad;
593
DENTER(GUI_LAYER, "qmonCQMenu");
595
if (rmon_mlgetl(&RMON_DEBUG_ON, GUI_LAYER) & INFOPRINT) {
596
printf ("MENU: item=%s\n", ret->item->text);
600
** set the values in the item for the node popup
602
strcpy(name, ret->item->text);
604
printf("Menu Item: %s\n", name);
609
/*-------------------------------------------------------------------------*/
610
static void qmonCQActivate(Widget w, XtPointer cld, XtPointer cad)
612
ListTreeActivateStruct *ret = (ListTreeActivateStruct*)cad;
615
DENTER(GUI_LAYER, "qmonCQActivate");
617
if (rmon_mlgetl(&RMON_DEBUG_ON, GUI_LAYER) & INFOPRINT) {
618
printf("ACTIVATE: item=%s count=%d\n",ret->item->text,ret->count);
620
while (count<ret->count) {
621
printf(" path: %s\n",ret->path[count]->text);
629
/*-------------------------------------------------------------------------*/
630
static ListTreeItem* CullToTree(
632
ListTreeItem *parent,
635
lListElem *ep = NULL;
636
lListElem *ep2 = NULL;
637
ListTreeItem *cq_node = NULL;
638
ListTreeItem *cq_hostnode = NULL;
640
ListTreeItem *cq_attributes = NULL;
641
ListTreeItem *cq_attributes_gen = NULL;
642
ListTreeItem *cq_attributes_em = NULL;
643
ListTreeItem *cq_attributes_ckpt = NULL;
644
ListTreeItem *cq_attributes_pe = NULL;
645
ListTreeItem *cq_attributes_lst = NULL;
646
ListTreeItem *cq_attributes_hlim = NULL;
647
ListTreeItem *cq_attributes_slim = NULL;
648
ListTreeItem *cq_attributes_cplx = NULL;
649
ListTreeItem *cq_attributes_acl = NULL;
650
ListTreeItem *cq_attributes_prj = NULL;
652
ListTreeItem *cq_qinstances = NULL;
653
ListTreeItem *ret = NULL;
654
StringConst cq_name = NULL;
656
DENTER(GUI_LAYER, "CullToTree");
663
cq_name = lGetString(ep, CQ_name) ? lGetString(ep, CQ_name) : "-NA-";
664
cq_node = ListTreeAddBranch(tree, parent, (char*) cq_name);
669
cq_hostnode = ListTreeAddBranch(tree, cq_node, (char*)"Hostlist");
670
for_each(ep2, lGetList(ep, CQ_hostlist)) {
671
ListTreeAddLeaf(tree, cq_hostnode, (char*)lGetHost(ep2,HR_name));
678
cq_qinstances = ListTreeAddBranch(tree, cq_node, (char*) "Queue Instances");
679
for_each(ep2, lGetList(ep, CQ_qinstances)) {
680
ListTreeAddLeaf(tree, cq_qinstances, (char*)lGetString(ep2,QU_full_name));
686
** Attributes pseudo nodes
688
cq_attributes = ListTreeAddBranch(tree, cq_node, (char*) "Attributes");
689
cq_attributes_gen = ListTreeAddBranch(tree, cq_attributes, (char*) "General");
690
cq_attributes_em = ListTreeAddBranch(tree, cq_attributes, (char*) "Execution Method");
691
cq_attributes_ckpt = ListTreeAddBranch(tree, cq_attributes, (char*) "Checkpointing");
692
cq_attributes_pe = ListTreeAddBranch(tree, cq_attributes, (char*) "Parallel Environment");
693
cq_attributes_lst = ListTreeAddBranch(tree, cq_attributes, (char*) "Load/Suspend Thresholds");
694
cq_attributes_hlim = ListTreeAddBranch(tree, cq_attributes, (char*) "Hard Limits");
695
cq_attributes_slim = ListTreeAddBranch(tree, cq_attributes, (char*) "Soft Limits");
696
cq_attributes_cplx = ListTreeAddBranch(tree, cq_attributes, (char*) "Complexes");
697
cq_attributes_acl = ListTreeAddBranch(tree, cq_attributes, (char*) "Access");
698
cq_attributes_prj = ListTreeAddBranch(tree, cq_attributes, (char*) "Project Access");
701
/*--------- general config --------------------------------------------*/
703
cq_add_aqtlist(tree, cq_attributes_gen, ep, CQ_qtype, "CQ_qtype");
705
cq_add_aulng(tree, cq_attributes_gen, ep, CQ_seq_no, "Sequence Number");
707
cq_add_aulng(tree, cq_attributes_gen, ep, CQ_job_slots, "Job Slots");
709
cq_add_abool(tree, cq_attributes_gen, ep, CQ_rerun, "Rerun Jobs");
711
cq_add_astr(tree, cq_attributes_gen, ep, CQ_shell_start_mode, "CQ_shell_start_mode");
713
cq_add_ainter(tree, cq_attributes_gen, ep, CQ_notify, "CQ_notify");
715
cq_add_astr(tree, cq_attributes_gen, ep, CQ_tmpdir, "CQ_tmpdir");
717
cq_add_astr(tree, cq_attributes_gen, ep, CQ_shell, "CQ_shell");
719
cq_add_astr(tree, cq_attributes_gen, ep, CQ_calendar, "CQ_calendar");
721
cq_add_astr(tree, cq_attributes_gen, ep, CQ_priority, "CQ_priority");
723
cq_add_astr(tree, cq_attributes_gen, ep, CQ_processors, "CQ_processors");
725
cq_add_astr(tree, cq_attributes_gen, ep, CQ_initial_state, "CQ_initial_state");
726
/*--------- hard limits --------------------------------------------*/
727
cq_add_atime(tree, cq_attributes_hlim, ep, CQ_h_rt, "Wallclock Time (sec)");
728
cq_add_atime(tree, cq_attributes_hlim, ep, CQ_h_cpu, "CPU Time (sec)");
729
cq_add_amem(tree, cq_attributes_hlim, ep, CQ_h_fsize, "File Size (Byte)");
730
cq_add_amem(tree, cq_attributes_hlim, ep, CQ_h_data, "Data Size (Byte)");
731
cq_add_amem(tree, cq_attributes_hlim, ep, CQ_h_stack, "Stack Size (Byte)");
732
cq_add_amem(tree, cq_attributes_hlim, ep, CQ_h_core, "Corefile Size (Byte)");
733
cq_add_amem(tree, cq_attributes_hlim, ep, CQ_h_rss, "Resident Set Size (Byte)");
734
cq_add_amem(tree, cq_attributes_hlim, ep, CQ_h_vmem, "Virtual Memory (Byte)");
736
/*--------- soft limits --------------------------------------------*/
737
cq_add_atime(tree, cq_attributes_slim, ep, CQ_s_rt, "Wallclock Time (sec)");
738
cq_add_atime(tree, cq_attributes_slim, ep, CQ_s_cpu, "CPU Time (sec)");
739
cq_add_amem(tree, cq_attributes_slim, ep, CQ_s_fsize, "File Size (Byte)");
740
cq_add_amem(tree, cq_attributes_slim, ep, CQ_s_data, "Data Size (Byte)");
741
cq_add_amem(tree, cq_attributes_slim, ep, CQ_s_stack, "Stack Size (Byte)");
742
cq_add_amem(tree, cq_attributes_slim, ep, CQ_s_core, "Corefile Size (Byte)");
743
cq_add_amem(tree, cq_attributes_slim, ep, CQ_s_rss, "Resident Set Size (Byte)");
744
cq_add_amem(tree, cq_attributes_slim, ep, CQ_s_vmem, "Virtual Memory (Byte)");
746
/*--------- ckpt --------------------------------------------*/
747
cq_add_ainter(tree, cq_attributes_ckpt, ep, CQ_min_cpu_interval, "Min CPU Interval");
749
cq_add_astrlist(tree, cq_attributes_ckpt, ep, CQ_ckpt_list, "CQ_ckpt_list");
751
/*--------- execution method ------------------------------------------*/
752
cq_add_astr(tree, cq_attributes_em, ep, CQ_prolog, "CQ_prolog");
754
cq_add_astr(tree, cq_attributes_em, ep, CQ_epilog, "CQ_epilog");
756
cq_add_astr(tree, cq_attributes_em, ep, CQ_starter_method, "CQ_starter_method");
758
cq_add_astr(tree, cq_attributes_em, ep, CQ_suspend_method, "CQ_suspend_method");
760
cq_add_astr(tree, cq_attributes_em, ep, CQ_resume_method, "CQ_resume_method");
761
cq_add_astr(tree, cq_attributes_em, ep, CQ_terminate_method, "CQ_terminate_method");
764
/*--------- pe ------------------------------------------*/
765
cq_add_astrlist(tree, cq_attributes_pe, ep, CQ_pe_list, "Parallel Environment");
767
/*--------- Owners ------------------------------------------*/
768
cq_add_ausrlist(tree, cq_attributes, ep, CQ_owner_list, "Owners");
770
/*--------- Access -------------------------------------------*/
771
cq_add_ausrlist(tree, cq_attributes_acl, ep, CQ_acl, "CQ_acl");
773
cq_add_ausrlist(tree, cq_attributes_acl, ep, CQ_xacl, "CQ_xacl");
775
/*--------- Projects -------------------------------------------*/
776
cq_add_aprjlist(tree, cq_attributes_prj, ep, CQ_projects, "CQ_projects");
778
cq_add_aprjlist(tree, cq_attributes_prj, ep, CQ_xprojects, "CQ_xprojects");
780
/*--------- Load/Suspend Thresholds ---------------------------------*/
781
cq_add_acelist(tree, cq_attributes_lst, ep, CQ_load_thresholds, "CQ_load_thresholds");
783
cq_add_acelist(tree, cq_attributes_lst, ep, CQ_suspend_thresholds, "CQ_suspend_thresholds");
785
cq_add_aulng(tree, cq_attributes_lst, ep, CQ_nsuspend, "Jobs suspended per interval");
787
cq_add_ainter(tree, cq_attributes_lst, ep, CQ_suspend_interval, "Suspend Interval");
790
/*--------- Consumables ---------------------------------*/
791
cq_add_acelist(tree, cq_attributes, ep, CQ_consumable_config_list, "CQ_consumable_config_list");
793
/*--------- Subordinates ---------------------------------*/
794
cq_add_asolist(tree, cq_attributes, ep, CQ_subordinate_list, "CQ_subordinate_list");
800
ret = ListTreeFirstItem(tree);
807
/*-------------------------------------------------------------------------*/
808
static void qmonCQUpdateTree(void)
810
Widget tree = cq_tree;
811
lList *cluster_queue_tree = NULL;
812
ListTreeItem *old_root = NULL;
813
ListTreeItem *root_node = NULL;
816
DENTER(GUI_LAYER, "qmonCQUpdateTree");
819
** set and get several lists
821
qmonMirrorMultiAnswer(CQUEUE_T, &alp);
823
qmonMessageBox(AppShell, alp, 0);
829
cluster_queue_tree = qmonMirrorList(SGE_CQUEUE_LIST);
831
ListTreeRefreshOff(tree);
833
** unchain the old tree, what about the old user_data struct ????
835
old_root = ListTreeFirstItem(tree);
836
ListTreeUnchainItem(tree, old_root);
838
root_node = ListTreeAddBranch(tree, NULL, "/");
839
CullToTree(tree, root_node, cluster_queue_tree);
842
** open the new tree according to old tree or to
846
ListTreeOpenLikeTree(tree, root_node, old_root);
847
ListTreeDelete(tree, old_root);
850
ListTreeOpenToLevel(tree, NULL, 1);
852
/* ListTreeHighlightItem(tree, root_node, True); */
853
ListTreeRefreshOn(tree);
854
/* ListTreeMakeItemVisible(tree, root_node); */
862
/*-------------------------------------------------------------------------*/
863
static ListTreeItem* cq_add_aulng(Widget tree, ListTreeItem *parent,
864
lListElem *elem, int field_nm,
865
StringConst attribute_name)
870
DENTER(GUI_LAYER, "cq_add_aulng");
872
item = ListTreeAddBranch(tree, parent, (char*)attribute_name);
873
for_each(ep, lGetList(elem, field_nm)) {
874
char *hostref = (char*) lGetHost(ep, AULNG_href);
875
u_long32 u = lGetUlong(ep, AULNG_value);
876
dstring ds = DSTRING_INIT;
877
sge_dstring_sprintf(&ds, "%s " sge_u32, hostref, u);
878
ListTreeAddLeaf(tree, item, ds.s);
879
sge_dstring_free(&ds);
885
/*-------------------------------------------------------------------------*/
886
static ListTreeItem* cq_add_abool(Widget tree, ListTreeItem *parent,
887
lListElem *elem, int field_nm,
888
StringConst attribute_name)
893
DENTER(GUI_LAYER, "cq_add_abool");
895
item = ListTreeAddBranch(tree, parent, (char*)attribute_name);
896
for_each(ep, lGetList(elem, field_nm)) {
897
char *hostref = (char*) lGetHost(ep, ABOOL_href);
898
Bool b = lGetBool(ep, ABOOL_value);
899
dstring ds = DSTRING_INIT;
900
sge_dstring_sprintf(&ds, "%s %s", hostref, b ? "true" : "false");
901
ListTreeAddLeaf(tree, item, ds.s);
902
sge_dstring_free(&ds);
908
/*-------------------------------------------------------------------------*/
909
static ListTreeItem* cq_add_amem(Widget tree, ListTreeItem *parent,
910
lListElem *elem, int field_nm,
911
StringConst attribute_name)
916
DENTER(GUI_LAYER, "cq_add_amem");
918
item = ListTreeAddBranch(tree, parent, (char*)attribute_name);
919
for_each(ep, lGetList(elem, field_nm)) {
920
char *hostref = (char*) lGetHost(ep, AMEM_href);
921
char *value = (char*)lGetString(ep, AMEM_value);
922
dstring ds = DSTRING_INIT;
923
sge_dstring_sprintf(&ds, "%s %s", hostref, value ? value : "-NA-");
924
ListTreeAddLeaf(tree, item, ds.s);
925
sge_dstring_free(&ds);
931
/*-------------------------------------------------------------------------*/
932
static ListTreeItem* cq_add_atime(Widget tree, ListTreeItem *parent,
933
lListElem *elem, int field_nm,
934
StringConst attribute_name)
939
DENTER(GUI_LAYER, "cq_add_atime");
941
item = ListTreeAddBranch(tree, parent, (char*)attribute_name);
942
for_each(ep, lGetList(elem, field_nm)) {
943
char *hostref = (char*) lGetHost(ep, ATIME_href);
944
char *value = (char*)lGetString(ep, ATIME_value);
945
dstring ds = DSTRING_INIT;
946
sge_dstring_sprintf(&ds, "%s %s", hostref, value ? value : "-NA-");
947
ListTreeAddLeaf(tree, item, ds.s);
948
sge_dstring_free(&ds);
954
/*-------------------------------------------------------------------------*/
955
static ListTreeItem* cq_add_ainter(Widget tree, ListTreeItem *parent,
956
lListElem *elem, int field_nm,
957
StringConst attribute_name)
962
DENTER(GUI_LAYER, "cq_add_ainter");
964
item = ListTreeAddBranch(tree, parent, (char*)attribute_name);
965
for_each(ep, lGetList(elem, field_nm)) {
966
char *hostref = (char*) lGetHost(ep, AINTER_href);
967
char *value = (char*)lGetString(ep, AINTER_value);
968
dstring ds = DSTRING_INIT;
969
sge_dstring_sprintf(&ds, "%s %s", hostref, value ? value : "-NA-");
970
ListTreeAddLeaf(tree, item, ds.s);
971
sge_dstring_free(&ds);
977
/*-------------------------------------------------------------------------*/
978
static ListTreeItem* cq_add_astr(Widget tree, ListTreeItem *parent,
979
lListElem *elem, int field_nm,
980
StringConst attribute_name)
985
DENTER(GUI_LAYER, "cq_add_astr");
987
item = ListTreeAddBranch(tree, parent, (char*)attribute_name);
988
for_each(ep, lGetList(elem, field_nm)) {
989
char *hostref = (char*) lGetHost(ep, ASTR_href);
990
char *value = (char*)lGetString(ep, ASTR_value);
991
dstring ds = DSTRING_INIT;
992
sge_dstring_sprintf(&ds, "%s %s", hostref, value ? value : "-NA-");
993
ListTreeAddLeaf(tree, item, ds.s);
994
sge_dstring_free(&ds);
1000
/*-------------------------------------------------------------------------*/
1001
static ListTreeItem* cq_add_astrlist(Widget tree, ListTreeItem *parent,
1002
lListElem *elem, int field_nm,
1003
StringConst attribute_name)
1008
DENTER(GUI_LAYER, "cq_add_astrlist");
1010
item = ListTreeAddBranch(tree, parent, (char*)attribute_name);
1011
for_each(ep, lGetList(elem, field_nm)) {
1012
ListTreeItem *sublist;
1014
char *hostref = (char*) lGetHost(ep, ASTRLIST_href);
1015
lList *value = lGetList(ep, ASTRLIST_value);
1016
sublist = ListTreeAddBranch(tree, item, hostref);
1017
for_each(ep2, value) {
1018
char *name = (char*) lGetString(ep2, ST_name);
1019
ListTreeAddLeaf(tree, sublist, name ? name : "-NA-");
1026
/*-------------------------------------------------------------------------*/
1027
static ListTreeItem* cq_add_ausrlist(Widget tree, ListTreeItem *parent,
1028
lListElem *elem, int field_nm,
1029
StringConst attribute_name)
1034
DENTER(GUI_LAYER, "cq_add_ausrlist");
1036
item = ListTreeAddBranch(tree, parent, (char*)attribute_name);
1037
for_each(ep, lGetList(elem, field_nm)) {
1038
ListTreeItem *sublist;
1040
char *hostref = (char*) lGetHost(ep, AUSRLIST_href);
1041
lList *value = lGetList(ep, AUSRLIST_value);
1042
sublist = ListTreeAddBranch(tree, item, hostref);
1043
for_each(ep2, value) {
1044
char *name = (char*) lGetString(ep2, US_name);
1045
ListTreeAddLeaf(tree, sublist, name ? name : "-NA-");
1052
/*-------------------------------------------------------------------------*/
1053
static ListTreeItem* cq_add_aprjlist(Widget tree, ListTreeItem *parent,
1054
lListElem *elem, int field_nm,
1055
StringConst attribute_name)
1060
DENTER(GUI_LAYER, "cq_add_aprjlist");
1062
item = ListTreeAddBranch(tree, parent, (char*)attribute_name);
1063
for_each(ep, lGetList(elem, field_nm)) {
1064
ListTreeItem *sublist;
1066
char *hostref = (char*) lGetHost(ep, APRJLIST_href);
1067
lList *value = lGetList(ep, APRJLIST_value);
1068
sublist = ListTreeAddBranch(tree, item, hostref);
1069
for_each(ep2, value) {
1070
char *name = (char*) lGetString(ep2, PR_name);
1071
ListTreeAddLeaf(tree, sublist, name ? name : "-NA-");
1078
/*-------------------------------------------------------------------------*/
1079
static ListTreeItem* cq_add_aqtlist(Widget tree, ListTreeItem *parent,
1080
lListElem *elem, int field_nm,
1081
StringConst attribute_name)
1086
DENTER(GUI_LAYER, "cq_add_aqtlist");
1088
item = ListTreeAddBranch(tree, parent, (char*)attribute_name);
1090
for_each(ep, lGetList(elem, field_nm)) {
1091
ListTreeItem *sublist;
1092
char *hostref = (char*) lGetHost(ep, AQTLIST_href);
1093
u_long32 u = lGetUlong(ep, AQTLIST_value);
1094
sublist = ListTreeAddBranch(tree, item, hostref);
1095
for_each(ep2, value) {
1096
char *name = lGetString(ep2, UP_name);
1097
ListTreeAddLeaf(tree, sublist, name ? name : "-NA-");
1105
/*-------------------------------------------------------------------------*/
1106
static ListTreeItem* cq_add_acelist(Widget tree, ListTreeItem *parent,
1107
lListElem *elem, int field_nm,
1108
StringConst attribute_name)
1113
DENTER(GUI_LAYER, "cq_add_acelist");
1115
item = ListTreeAddBranch(tree, parent, (char*)attribute_name);
1117
for_each(ep, lGetList(elem, field_nm)) {
1118
ListTreeItem *sublist;
1119
char *hostref = (char*) lGetHost(ep, AQTLIST_href);
1120
u_long32 u = lGetUlong(ep, AQTLIST_value);
1121
sublist = ListTreeAddBranch(tree, item, hostref);
1122
for_each(ep2, value) {
1123
char *name = lGetString(ep2, UP_name);
1124
ListTreeAddLeaf(tree, sublist, name ? name : "-NA-");
1132
/*-------------------------------------------------------------------------*/
1133
static ListTreeItem* cq_add_asolist(Widget tree, ListTreeItem *parent,
1134
lListElem *elem, int field_nm,
1135
StringConst attribute_name)
1141
DENTER(GUI_LAYER, "cq_add_asolist");
1143
item = ListTreeAddBranch(tree, parent, (char*)attribute_name);
1144
for_each(ep, lGetList(elem, field_nm)) {
1145
ListTreeItem *sublist;
1146
char *hostref = (char*) lGetHost(ep, AQTLIST_href);
1147
u_long32 u = lGetUlong(ep, AQTLIST_value);
1148
sublist = ListTreeAddBranch(tree, item, hostref);
1149
for_each(ep2, value) {
1150
char *name = lGetString(ep2, PR_name);
1151
ListTreeAddLeaf(tree, sublist, name ? name : "-NA-");
1160
/*-------------------------------------------------------------------------*/
1161
static void qmonQinstanceHandleEnterLeave(
1168
int root_x, root_y, pos_x, pos_y;
1170
unsigned int keys_buttons;
1173
static int prev_row = -1;
1176
DENTER(GUI_LAYER, "qmonQinstanceHandleEnterLeave");
1180
if (qmonBrowserObjectEnabled(BROWSE_QUEUE)) {
1182
** XQueryPointer(XtDisplay(w), XtWindow(w),
1183
** &root, &child, &root_x, &root_y,
1184
** &pos_x, &pos_y, &keys_buttons);
1186
if (XbaeMatrixGetEventRowColumn(w, ev, &row, &col)) {
1187
if ( row != prev_row ) {
1189
/* locate the quue */
1190
str = XbaeMatrixGetCell(w, row, 0);
1191
if (str && *str != '\0') {
1193
dstring queue_info = DSTRING_INIT;
1194
qp = cqueue_list_locate_qinstance(
1195
qmonMirrorList(SGE_CQUEUE_LIST), str);
1197
sprintf(line, "+++++++++++++++++++++++++++++++++++++++++++\n");
1198
qmonBrowserShow(line);
1199
qmonQinstanceShowBrowserInfo(&queue_info, qp);
1200
qmonBrowserShow(sge_dstring_get_string(&queue_info));
1201
qmonBrowserShow(line);
1203
sge_dstring_free(&queue_info);
1213
/*-------------------------------------------------------------------------*/
1214
static void qmonQinstanceShowBrowserInfo(
1220
const char *str, *str2;
1223
DENTER(GUI_LAYER, "qmonQinstanceShowBrowserInfo");
1225
/* sge_dstring_sprintf(info, "%-30.30s%s\n", "Queue:", lGetString(qep, QU_full_name)); */
1227
sge_dstring_sprintf(info, "%-30.30s%s\n", "qname:", lGetString(qep, QU_qname));
1230
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "hostname:",
1231
lGetHost(qep, QU_qhostname));
1233
sge_dstring_sprintf_append(info, "%-30.30s%d\n", "seq_no:",
1234
(int)lGetUlong(qep, QU_seq_no));
1235
/* Load Thresholds */
1236
sge_dstring_sprintf_append(info, "%-30.30s", "Load Thresholds:");
1237
for_each(ep, lGetList(qep, QU_load_thresholds)) {
1238
str = lGetString(ep, CE_name);
1239
str2 = lGetString(ep, CE_stringval);
1240
sge_dstring_sprintf_append(info, "%s=%s ", str?str:"", str2?str2:"");
1242
sge_dstring_sprintf_append(info, "\n");
1243
/* Suspend Thresholds */
1244
sge_dstring_sprintf_append(info, "%-30.30s", "Suspend Thresholds:");
1245
for_each(ep, lGetList(qep, QU_suspend_thresholds)) {
1246
str = lGetString(ep, CE_name);
1247
str2 = lGetString(ep, CE_stringval);
1248
sge_dstring_sprintf_append(info, "%s=%s ", str?str:"", str2?str2:"");
1250
sge_dstring_sprintf_append(info, "\n");
1252
sge_dstring_sprintf_append(info, "%-30.30s%d\n", "nsuspend:",
1253
(int)lGetUlong(qep, QU_nsuspend));
1254
/* suspend_interval */
1255
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "suspend_interval:",
1256
lGetString(qep, QU_suspend_interval));
1258
str = lGetString(qep, QU_priority);
1259
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "priority:", str?str:"");
1261
/* min_cpu_interval */
1262
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "min_cpu_interval:",
1263
lGetString(qep, QU_min_cpu_interval));
1266
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "processors:",
1267
lGetString(qep, QU_processors));
1271
dstring type_buffer = DSTRING_INIT;
1273
qinstance_print_qtype_to_dstring(qep, &type_buffer, false);
1274
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "qype:",
1275
sge_dstring_get_string(&type_buffer));
1276
sge_dstring_free(&type_buffer);
1279
sge_dstring_sprintf_append(info, "%-30.30s", "ckpt_list:");
1280
for_each(ep, lGetList(qep, QU_ckpt_list)) {
1281
str = lGetString(ep, ST_name);
1282
sge_dstring_sprintf_append(info, "%s ", str);
1284
sge_dstring_sprintf_append(info, "\n");
1286
sge_dstring_sprintf_append(info, "%-30.30s", "pe_list:");
1287
for_each(ep, lGetList(qep, QU_pe_list)) {
1288
str = lGetString(ep, ST_name);
1289
sge_dstring_sprintf_append(info, "%s ", str);
1291
sge_dstring_sprintf_append(info, "\n");
1293
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "rerun:",
1294
lGetBool(qep, QU_rerun) ? "True" : "False");
1296
sge_dstring_sprintf_append(info, "%-30.30s%d\n", "slots:",
1297
(int)lGetUlong(qep, QU_job_slots));
1299
sge_dstring_sprintf_append(info, "%-30.30s%d\n", "slots used:",
1300
qinstance_slots_used(qep));
1302
str = lGetString(qep, QU_shell);
1303
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "shell:", str ? str : "");
1306
str = lGetString(qep, QU_prolog);
1307
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "prolog:", str ? str : "");
1309
str = lGetString(qep, QU_epilog);
1310
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "epilog:", str ? str : "");
1311
/* shell_start_mode */
1312
str = lGetString(qep, QU_shell_start_mode);
1313
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "shell_start_mode:", str ? str : "");
1315
/* starter_method */
1316
str = lGetString(qep, QU_starter_method);
1317
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "starter_method:", str ? str : "");
1319
/* suspend_method */
1320
str = lGetString(qep, QU_suspend_method);
1321
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "suspend_method:", str ? str : "");
1324
str = lGetString(qep, QU_resume_method);
1325
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "resume_method:", str ? str : "");
1327
/* terminate_method */
1328
str = lGetString(qep, QU_terminate_method);
1329
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "terminate_method:", str ? str : "");
1332
str = lGetString(qep, QU_notify);
1333
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "Notify Job Interval:", str ? str : "");
1336
str = lGetString(qep, QU_tmpdir);
1337
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "tmpdir:", str ? str : "");
1339
sge_dstring_sprintf_append(info, "%-30.30s", "Access List:");
1340
for_each(ep, lGetList(qep, QU_acl)) {
1341
sge_dstring_sprintf_append(info, "%s ", lGetString(ep, US_name));
1343
sge_dstring_sprintf_append(info, "\n");
1345
sge_dstring_sprintf_append(info, "%-30.30s", "No Access List:");
1346
for_each(ep, lGetList(qep, QU_xacl)) {
1347
sge_dstring_sprintf_append(info, "%s ", lGetString(ep, US_name));
1349
sge_dstring_sprintf_append(info, "\n");
1350
/* subordinate_list */
1351
sge_dstring_sprintf_append(info, "%-30.30s", "Subordinates:");
1352
for_each(ep, lGetList(qep, QU_subordinate_list)) {
1353
str = lGetString(ep, SO_name);
1354
i = (int) lGetUlong(ep, SO_threshold);
1355
sge_dstring_sprintf_append(info, "%s=%d ", str?str:"", i);
1357
sge_dstring_sprintf_append(info, "\n");
1358
/* Complex Values */
1359
sge_dstring_sprintf_append(info, "%-30.30s", "Complex Values:");
1360
for_each(ep, lGetList(qep, QU_consumable_config_list)) {
1361
str = lGetString(ep, CE_name);
1362
str2 = lGetString(ep, CE_stringval);
1363
sge_dstring_sprintf_append(info, "%s=%s ", str?str:"", str2?str2:"");
1365
sge_dstring_sprintf_append(info, "\n");
1368
sge_dstring_sprintf_append(info, "%-30.30s", "Project List:");
1369
for_each(ep, lGetList(qep, QU_projects)) {
1370
sge_dstring_sprintf_append(info, "%s ", lGetString(ep, PR_name));
1372
sge_dstring_sprintf_append(info, "\n");
1374
sge_dstring_sprintf_append(info, "%-30.30s", "XProject List:");
1375
for_each(ep, lGetList(qep, QU_xprojects)) {
1376
sge_dstring_sprintf_append(info, "%s ", lGetString(ep, PR_name));
1378
sge_dstring_sprintf_append(info, "\n");
1381
str = lGetString(qep, QU_calendar);
1382
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "calendar:", str ? str : "");
1385
str = lGetString(qep, QU_initial_state);
1386
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "initial state:", str ? str : "");
1388
str = lGetString(qep, QU_s_rt);
1389
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "Soft Real Time:", str ? str : "");
1390
str = lGetString(qep, QU_h_rt);
1391
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "Hard Real Time:", str ? str : "");
1392
str = lGetString(qep, QU_s_cpu);
1393
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "Soft Cpu:", str ? str : "");
1394
str = lGetString(qep, QU_h_cpu);
1395
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "Hard Cpu:", str ? str : "");
1396
str = lGetString(qep, QU_s_fsize);
1397
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "Soft File Size:", str ? str : "");
1398
str = lGetString(qep, QU_h_fsize);
1399
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "Hard File Size:", str ? str : "");
1400
str = lGetString(qep, QU_s_data);
1401
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "Soft Data Size:", str ? str : "");
1402
str = lGetString(qep, QU_h_data);
1403
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "Hard Data Size:", str ? str : "");
1404
str = lGetString(qep, QU_s_stack);
1405
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "Soft Stack Size:", str ? str : "");
1406
str = lGetString(qep, QU_h_stack);
1407
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "Hard Stack Size:", str ? str : "");
1408
str = lGetString(qep, QU_s_core);
1409
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "Soft Core Size:", str ? str : "");
1410
str = lGetString(qep, QU_h_core);
1411
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "Hard Core Size:", str ? str : "");
1412
str = lGetString(qep, QU_s_rss);
1413
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "Soft Resident Set Size:", str ? str : "");
1414
str = lGetString(qep, QU_h_rss);
1415
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "Hard Resident Set Size:", str ? str : "");
1416
str = lGetString(qep, QU_s_vmem);
1417
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "Soft Virtual Memory: Size", str ? str : "");
1418
str = lGetString(qep, QU_h_vmem);
1419
sge_dstring_sprintf_append(info, "%-30.30s%s\n", "Hard Virtual Memory Size:", str ? str : "");
1424
/*-------------------------------------------------------------------------*/
1425
static void qmonQinstanceExplain(Widget w, XtPointer cld, XtPointer cad)
1429
u_long32 explain_bits = QI_DEFAULT;
1432
Widget matrix = current_matrix;
1433
lListElem *qp = NULL;
1435
int nr_selected_rows = 0;
1437
DENTER(GUI_LAYER, "qmonQinstanceExplain");
1440
** loop over selected entries and build id list
1442
rows = XbaeMatrixNumRows(matrix);
1444
** number of selected rows
1446
nr_selected_rows = XbaeMatrixGetNumSelected(matrix)/XbaeMatrixNumColumns(matrix);
1448
if (nr_selected_rows > 0) {
1450
sprintf(line, "+++++++++++++++++++++++++++++++++++++++++++\n");
1452
qmonMirrorMultiAnswer(CQUEUE_T | EXECHOST_T | CENTRY_T, &alp);
1454
qmonMessageBox(w, alp, 0);
1460
** cld contains the action we need, check if a force is involved
1462
explain_w = XmtNameToWidget(w, "*cq_explain_states");
1463
state = XmtChooserGetState(explain_w);
1465
if (ISSET(state,(1<<0))) {
1466
explain_bits |= QI_AMBIGUOUS;
1468
if (ISSET(state,(1<<1))) {
1469
explain_bits |= QI_ALARM;
1471
if (ISSET(state,(1<<2))) {
1472
explain_bits |= QI_SUSPEND_ALARM;
1474
if (ISSET(state,(1<<3))) {
1475
explain_bits |= QI_ERROR;
1478
if (explain_bits != QI_DEFAULT) {
1480
** open browser window
1482
qmonBrowserOpen(w, NULL, NULL);
1484
for (i=0; i<rows; i++) {
1485
/* is this row selected */
1486
if (XbaeMatrixIsRowSelected(matrix, i)) {
1487
str = XbaeMatrixGetCell(matrix, i, 0);
1488
if ( str && *str != '\0' ) {
1489
dstring queue_info = DSTRING_INIT;
1490
DPRINTF(("CQ/QI to explain: %s\n", str));
1491
qp = cqueue_list_locate_qinstance(
1492
qmonMirrorList(SGE_CQUEUE_LIST), str);
1494
qmonQinstanceShowBrowserExplain(&queue_info, qp,
1495
qmonMirrorList(SGE_CENTRY_LIST),
1496
qmonMirrorList(SGE_EXECHOST_LIST),
1498
qmonBrowserShow(sge_dstring_get_string(&queue_info));
1499
qmonBrowserShow(line);
1501
sge_dstring_free(&queue_info);
1507
qmonMessageShow(w, True, "@{Select at least one queue instance!}");
1514
/*-------------------------------------------------------------------------*/
1515
static void qmonQinstanceShowBrowserExplain( dstring *info, lListElem *q,
1516
lList *centry_list, lList *exechost_list, u_long32 explain_bits)
1520
char load_alarm_reason[MAX_STRING_SIZE];
1521
char suspend_alarm_reason[MAX_STRING_SIZE];
1523
bool has_value_from_object;
1527
DENTER(GUI_LAYER, "qmonQinstanceShowBrowserExplain");
1529
if (explain_bits == QI_DEFAULT) {
1534
*load_alarm_reason = 0;
1535
*suspend_alarm_reason = 0;
1537
if (!(load_avg_str=getenv("SGE_LOAD_AVG")) || !strlen(load_avg_str))
1538
load_avg_str = LOAD_ATTR_LOAD_AVG;
1540
/* compute the load and check for alarm states */
1541
is_load_value = sge_get_double_qattr(&load_avg, load_avg_str, q, exechost_list, centry_list, &has_value_from_object);
1542
if (sge_load_alarm(NULL, q, lGetList(q, QU_load_thresholds), exechost_list, centry_list, NULL, true)) {
1543
qinstance_state_set_alarm(q, true);
1544
sge_load_alarm_reason(q, lGetList(q, QU_load_thresholds), exechost_list,
1545
centry_list, load_alarm_reason,
1546
MAX_STRING_SIZE - 1, "load");
1548
parse_ulong_val(NULL, &interval, TYPE_TIM,
1549
lGetString(q, QU_suspend_interval), NULL, 0);
1550
if (lGetUlong(q, QU_nsuspend) != 0 &&
1552
sge_load_alarm(NULL, q, lGetList(q, QU_suspend_thresholds), exechost_list, centry_list, NULL, false)) {
1553
qinstance_state_set_suspend_alarm(q, true);
1554
sge_load_alarm_reason(q, lGetList(q, QU_suspend_thresholds),
1555
exechost_list, centry_list, suspend_alarm_reason,
1556
MAX_STRING_SIZE - 1, "suspend");
1559
sge_dstring_sprintf(info, "Queue: %s\n", lGetString(q, QU_full_name));
1560
if ((explain_bits & QI_ALARM) > 0) {
1561
if(*load_alarm_reason) {
1562
sge_dstring_sprintf_append(info, load_alarm_reason);
1565
if ((explain_bits & QI_SUSPEND_ALARM) > 0) {
1566
if(*suspend_alarm_reason) {
1567
sge_dstring_sprintf_append(info, suspend_alarm_reason);
1570
if (explain_bits != QI_DEFAULT) {
1571
lList *qim_list = lGetList(q, QU_message_list);
1572
lListElem *qim = NULL;
1574
for_each(qim, qim_list) {
1575
u_long32 type = lGetUlong(qim, QIM_type);
1577
if ((explain_bits & QI_AMBIGUOUS) == type ||
1578
(explain_bits & QI_ERROR) == type) {
1579
const char *message = lGetString(qim, QIM_message);
1581
sge_dstring_sprintf_append(info, "\t");
1582
sge_dstring_sprintf_append(info, message);
1590
/*-------------------------------------------------------------------------*/
1591
static void qmonCQHandleEnterLeave(
1598
int root_x, root_y, pos_x, pos_y;
1600
unsigned int keys_buttons;
1602
static char line[] = "+++++++++++++++++++++++++++++++++++++++++++\n";
1603
static int prev_row = -1;
1609
DENTER(GUI_LAYER, "qmonCQHandleEnterLeave");
1613
if (qmonBrowserObjectEnabled(BROWSE_QUEUE)) {
1615
** XQueryPointer(XtDisplay(w), XtWindow(w),
1616
** &root, &child, &root_x, &root_y,
1617
** &pos_x, &pos_y, &keys_buttons);
1619
if (XbaeMatrixGetEventRowColumn(w, ev, &row, &col)) {
1620
if ( row != prev_row ) {
1622
/* locate the quue */
1623
str = XbaeMatrixGetCell(w, row, 0);
1624
if (str && *str != '\0') {
1625
qp = cqueue_list_locate(qmonMirrorList(SGE_CQUEUE_LIST), str);
1627
queue_info = qmonCQShowBrowserInfo(qp);
1628
qmonBrowserShow(queue_info);
1629
qmonBrowserShow(line);
1639
/*-------------------------------------------------------------------------*/
1640
static String qmonCQShowBrowserInfo(
1644
static char info[60000];
1645
#define WIDTH "%s%-30.30s"
1647
DENTER(GUI_LAYER, "qmonCQShowBrowserInfo");
1649
sprintf(info, WIDTH"%s\n", "\n","Cluster Queue:", lGetString(qep, CQ_name));
1651
sprintf(info, "%s\n", info);
1653
DPRINTF(("info is %d long\n", strlen(info)));
1660
/*-------------------------------------------------------------------------*/
1661
static void qmonCQModify(Widget w, XtPointer cld, XtPointer cad)
1664
int nr_selected_rows;
1668
Widget matrix = cluster_queue_settings;
1669
int mode = (int) cld;
1670
tQCAction qc_action = {QC_ADD, NULL};
1672
DENTER(GUI_LAYER, "qmonCQModify");
1675
** loop over selected entries and delete them
1677
rows = XbaeMatrixNumRows(matrix);
1679
** number of selected rows
1681
nr_selected_rows = XbaeMatrixGetNumSelected(matrix)/XbaeMatrixNumColumns(matrix);
1683
if (nr_selected_rows == 1) {
1684
for (i=0; i<rows; i++) {
1685
/* is this row selected */
1686
if (XbaeMatrixIsRowSelected(matrix, i)) {
1687
str = XbaeMatrixGetCell(cluster_queue_settings, i, 0);
1688
if ( str && *str != '\0' ) {
1689
DPRINTF(("CQ to modify: %s\n", str));
1690
qc_action.action = mode;
1691
qc_action.qname = str;
1692
qmonQCPopup(matrix, (XtPointer)(&qc_action), NULL);
1696
qmonMessageBox(w, alp, 0);
1699
** update the matrix
1701
qmonCQUpdateCQMatrix();
1703
if (nr_selected_rows > 1) {
1704
qmonMessageShow(w, True, "@{Select only one queue !}");
1706
qmonMessageShow(w, True, "@{Select one queue !}");
1715
/*-------------------------------------------------------------------------*/
1716
static void qmonCQDelete(Widget w, XtPointer cld, XtPointer cad)
1722
Boolean status, answer = False;
1723
Widget matrix = cluster_queue_settings;
1725
DENTER(GUI_LAYER, "qmonCQDelete");
1727
/* force = XmToggleButtonGetState(force_toggle); */
1730
** loop over selected entries and delete them
1732
rows = XbaeMatrixNumRows(matrix);
1733
if (XbaeMatrixGetNumSelected(matrix) > 0) {
1734
status = XmtAskForBoolean(w, "xmtBooleanDialog",
1735
"@{queue.askdel.Do you really want to\ndelete the selected queues ?}",
1736
"@{Delete}", "@{Cancel}", NULL, XmtNoButton, XmDIALOG_WARNING,
1737
False, &answer, NULL);
1740
for (i=0; i<rows; i++) {
1741
/* is this row selected */
1742
if (XbaeMatrixIsRowSelected(matrix, i)) {
1743
str = XbaeMatrixGetCell(cluster_queue_settings, i, 0);
1744
if ( str && *str != '\0' ) {
1745
DPRINTF(("CQ to delete: %s\n", str));
1746
cqueue_delete(ctx, &alp, str);
1751
qmonMessageBox(w, alp, 0);
1754
** update the matrix
1756
XbaeMatrixDeselectAll(cluster_queue_settings);
1757
qmonCQUpdateCQMatrix();
1758
/* qmonCQUpdateTree(); */
1765
/*-------------------------------------------------------------------------*/
1766
static void qmonCQChangeState(Widget w, XtPointer cld, XtPointer cad)
1774
long action = (long) cld;
1775
Widget force_toggle;
1776
Widget matrix = current_matrix;
1778
DENTER(GUI_LAYER, "qmonCQChangeState");
1781
** loop over selected entries and build id list
1783
rows = XbaeMatrixNumRows(matrix);
1784
if (XbaeMatrixGetNumSelected(matrix) > 0) {
1786
** cld contains the action we need, check if a force is involved
1788
force_toggle = XmtNameToWidget(w, "*cq_force");
1789
force = XmToggleButtonGetState(force_toggle);
1791
for (i=0; i<rows; i++) {
1792
/* is this row selected */
1793
if (XbaeMatrixIsRowSelected(matrix, i)) {
1794
str = XbaeMatrixGetCell(matrix, i, 0);
1795
if ( str && *str != '\0' ) {
1796
DPRINTF(("CQ/QI to change: %s\n", str));
1797
lAddElemStr(&ql, ST_name, str, ST_Type);
1802
alp = qmonChangeStateList(SGE_CQUEUE_LIST, ql, force, action);
1804
qmonMessageBox(w, alp, 0);
1806
** update the matrix
1808
if (current_matrix == cluster_queue_settings) {
1809
qmonCQUpdateCQMatrix();
1811
qmonCQUpdateQIMatrix();
1821
/*-------------------------------------------------------------------------*/
1822
static void qmonCQFolderChange(Widget w, XtPointer cld, XtPointer cad)
1824
XmTabCallbackStruct *cbs = (XmTabCallbackStruct*)cad;
1826
DENTER(GUI_LAYER, "qmonCQFolderChange");
1828
DPRINTF(("%s\n", XtName(cbs->tab_child)));
1830
if (!strcmp(XtName(cbs->tab_child), "clusterqueue_layout")) {
1831
current_matrix = cluster_queue_settings;
1832
qmonCQUpdateCQMatrix();
1834
XtSetSensitive(cq_add, True);
1835
XtSetSensitive(cq_clone, True);
1836
XtSetSensitive(cq_mod, True);
1837
XtSetSensitive(cq_delete, True);
1838
XtSetSensitive(cq_sick, True);
1839
XtSetSensitive(cq_force, True);
1840
XtSetSensitive(cq_suspend, True);
1841
XtSetSensitive(cq_resume, True);
1842
XtSetSensitive(cq_disable, True);
1843
XtSetSensitive(cq_enable, True);
1844
XtSetSensitive(cq_clear_error, True);
1845
XtSetSensitive(cq_reschedule, True);
1846
XtSetSensitive(cq_load, False);
1847
XtSetSensitive(cq_explain_states, False);
1848
XtSetSensitive(cq_explain, False);
1849
} else if (!strcmp(XtName(cbs->tab_child), "qhost_layout")) {
1850
current_matrix = qhost_settings;
1851
qmonCQUpdateQhostMatrix();
1853
XtSetSensitive(cq_add, False);
1854
XtSetSensitive(cq_clone, False);
1855
XtSetSensitive(cq_mod, False);
1856
XtSetSensitive(cq_delete, False);
1857
XtSetSensitive(cq_sick, False);
1858
XtSetSensitive(cq_force, False);
1859
XtSetSensitive(cq_suspend, False);
1860
XtSetSensitive(cq_resume, False);
1861
XtSetSensitive(cq_disable, False);
1862
XtSetSensitive(cq_enable, False);
1863
XtSetSensitive(cq_reschedule, False);
1864
XtSetSensitive(cq_clear_error, False);
1865
XtSetSensitive(cq_load, False);
1866
XtSetSensitive(cq_explain_states, False);
1867
XtSetSensitive(cq_explain, False);
1869
current_matrix = qinstance_settings;
1870
qmonCQUpdateQIMatrix();
1872
XtSetSensitive(cq_add, False);
1873
XtSetSensitive(cq_clone, False);
1874
XtSetSensitive(cq_mod, False);
1875
XtSetSensitive(cq_delete, False);
1876
XtSetSensitive(cq_sick, False);
1877
XtSetSensitive(cq_force, True);
1878
XtSetSensitive(cq_suspend, True);
1879
XtSetSensitive(cq_resume, True);
1880
XtSetSensitive(cq_disable, True);
1881
XtSetSensitive(cq_enable, True);
1882
XtSetSensitive(cq_reschedule, True);
1883
XtSetSensitive(cq_clear_error, True);
1884
XtSetSensitive(cq_load, True);
1885
XtSetSensitive(cq_explain_states, True);
1886
XtSetSensitive(cq_explain, True);
1892
/*-------------------------------------------------------------------------*/
1893
static void qmonCQUpdateCQMatrix(void)
1908
lListElem *cq = NULL;
1913
u_long32 qstate = U_LONG32_MAX;
1915
DENTER(GUI_LAYER, "qmonCQUpdateCQMatrix");
1917
qmonMirrorMultiAnswer(CQUEUE_T | EXECHOST_T | CENTRY_T | USERSET_T | PE_T |HGROUP_T, &alp);
1919
qmonMessageBox(cluster_queue_settings, alp, 0);
1925
rl = qmonGetQCUResourceList();
1926
qrl = qmonGetQCUQrefList();
1927
ul = qmonGetQCUUserRefList();
1928
prl = qmonGetQCUPERefList();
1929
qstate = qmonGetQCUQueueState();
1932
** set the customize button label
1934
if (rl || qrl || ul || prl || qstate != U_LONG32_MAX) {
1935
setButtonLabel(cq_customize, "@{Customize +}");
1937
setButtonLabel(cq_customize, "@{Customize}");
1940
ehl = qmonMirrorList(SGE_EXECHOST_LIST);
1941
cl = qmonMirrorList(SGE_CENTRY_LIST);
1942
ql = qmonMirrorList(SGE_CQUEUE_LIST);
1943
acl = qmonMirrorList(SGE_USERSET_LIST);
1944
prjl = qmonMirrorList(SGE_PROJECT_LIST);
1945
pel = qmonMirrorList(SGE_PE_LIST);
1946
hgl = qmonMirrorList(SGE_HGROUP_LIST);
1949
** match filter criteria
1951
filter_queues(&fql, ql, cl, hgl, ehl, acl, prjl, pel, rl, qrl, prl, ul, qstate, NULL);
1954
** sort according to sorting criteria
1956
lPSortList(fql, "%I+ ", CQ_name);
1959
** Cluster Queue Pane
1961
XtVaSetValues(cluster_queue_settings, XmNcells, NULL, NULL);
1963
num_rows = XbaeMatrixNumRows(cluster_queue_settings);
1964
num_fql = lGetNumberOfElem(fql);
1965
if (num_fql > num_rows) {
1966
XbaeMatrixAddRows(cluster_queue_settings, num_rows, NULL, NULL, NULL,
1967
num_fql - num_rows);
1972
/* is correct_capacities needed here ??? */
1973
/* correct_capacities(ehl, cl); */
1974
for_each (cq, fql) {
1976
u_long32 used, resv, total;
1977
u_long32 temp_disabled, available, manual_intervention;
1978
u_long32 suspend_manual, suspend_threshold, suspend_on_subordinate;
1979
u_long32 suspend_calendar, unknown, load_alarm;
1980
u_long32 disabled_manual, disabled_calendar, ambiguous;
1981
u_long32 orphaned, error;
1982
bool is_load_available;
1984
cqueue_calculate_summary(cq, ehl, cl,
1985
&load, &is_load_available, &used, &resv, &total,
1986
&suspend_manual, &suspend_threshold,
1987
&suspend_on_subordinate, &suspend_calendar,
1988
&unknown, &load_alarm, &disabled_manual,
1989
&disabled_calendar, &ambiguous, &orphaned,
1990
&error, &available, &temp_disabled,
1991
&manual_intervention);
1993
XbaeMatrixSetCell(cluster_queue_settings, row, 0, (char*)lGetString(cq, CQ_name));
1994
if (is_load_available) {
1995
sprintf(buf, "%7.2f ", load);
1997
sprintf(buf, "%7s ", "-NA-");
1999
XbaeMatrixSetCell(cluster_queue_settings, row, 1, buf);
2000
sprintf(buf, "%6d ", (int)used);
2001
XbaeMatrixSetCell(cluster_queue_settings, row, 2, buf);
2002
sprintf(buf, "%6d ", (int)resv);
2003
XbaeMatrixSetCell(cluster_queue_settings, row, 3, buf);
2004
sprintf(buf, "%6d ", (int)available);
2005
XbaeMatrixSetCell(cluster_queue_settings, row, 4, buf);
2006
sprintf(buf, "%6d ", (int)total);
2007
XbaeMatrixSetCell(cluster_queue_settings, row, 5, buf);
2008
sprintf(buf, "%6d ", (int)temp_disabled);
2009
XbaeMatrixSetCell(cluster_queue_settings, row, 6, buf);
2010
sprintf(buf, "%6d ", (int)manual_intervention);
2011
XbaeMatrixSetCell(cluster_queue_settings, row, 7, buf);
2012
sprintf(buf, "%5d ", (int)suspend_manual);
2013
XbaeMatrixSetCell(cluster_queue_settings, row, 8, buf);
2014
sprintf(buf, "%5d ", (int)suspend_threshold);
2015
XbaeMatrixSetCell(cluster_queue_settings, row, 9, buf);
2016
sprintf(buf, "%5d ", (int)suspend_on_subordinate);
2017
XbaeMatrixSetCell(cluster_queue_settings, row, 10, buf);
2018
sprintf(buf, "%5d ", (int)suspend_calendar);
2019
XbaeMatrixSetCell(cluster_queue_settings, row, 11, buf);
2020
sprintf(buf, "%5d ", (int)unknown);
2021
XbaeMatrixSetCell(cluster_queue_settings, row, 12, buf);
2022
sprintf(buf, "%5d ", (int)load_alarm);
2023
XbaeMatrixSetCell(cluster_queue_settings, row, 13, buf);
2024
sprintf(buf, "%5d ", (int)disabled_manual);
2025
XbaeMatrixSetCell(cluster_queue_settings, row, 14, buf);
2026
sprintf(buf, "%5d ", (int)disabled_calendar);
2027
XbaeMatrixSetCell(cluster_queue_settings, row, 15, buf);
2028
sprintf(buf, "%5d ", (int)ambiguous);
2029
XbaeMatrixSetCell(cluster_queue_settings, row, 16, buf);
2030
sprintf(buf, "%5d ", (int)orphaned);
2031
XbaeMatrixSetCell(cluster_queue_settings, row, 17, buf);
2032
sprintf(buf, "%5d ", (int)error);
2033
XbaeMatrixSetCell(cluster_queue_settings, row, 18, buf);
2041
/*-------------------------------------------------------------------------*/
2042
static void qmonCQUpdateQIMatrix(void)
2057
lListElem *cq = NULL;
2061
u_long32 qstate = U_LONG32_MAX;
2064
lListElem *qip = NULL;
2069
DENTER(GUI_LAYER, "qmonCQUpdateQIMatrix");
2071
qmonMirrorMultiAnswer(CQUEUE_T | EXECHOST_T | CENTRY_T | USERSET_T | PE_T |HGROUP_T, &alp);
2073
qmonMessageBox(cluster_queue_settings, alp, 0);
2079
rl = qmonGetQCUResourceList();
2080
qrl = qmonGetQCUQrefList();
2081
ul = qmonGetQCUUserRefList();
2082
prl = qmonGetQCUPERefList();
2083
qstate = qmonGetQCUQueueState();
2086
** set the customize button label
2088
if (rl || qrl || ul || prl || qstate != U_LONG32_MAX) {
2089
setButtonLabel(cq_customize, "@{Customize +}");
2091
setButtonLabel(cq_customize, "@{Customize}");
2094
ehl = qmonMirrorList(SGE_EXECHOST_LIST);
2095
cl = qmonMirrorList(SGE_CENTRY_LIST);
2096
ql = qmonMirrorList(SGE_CQUEUE_LIST);
2097
acl = qmonMirrorList(SGE_USERSET_LIST);
2098
prjl = qmonMirrorList(SGE_PROJECT_LIST);
2099
pel = qmonMirrorList(SGE_PE_LIST);
2100
hgl = qmonMirrorList(SGE_HGROUP_LIST);
2103
** match filter criteria
2105
filter_queues(&fql, ql, cl, hgl, ehl, acl, prjl, pel, rl, qrl, prl, ul, qstate, NULL);
2108
** sort according to sorting criteria
2110
lPSortList(fql, "%I+", CQ_name);
2113
** Cluster Queue Instances Pane
2115
XtVaSetValues(qinstance_settings, XmNcells, NULL, NULL);
2122
char arch_string[80];
2124
char *load_avg_str = NULL;
2125
char load_alarm_reason[MAX_STRING_SIZE];
2126
char suspend_alarm_reason[MAX_STRING_SIZE];
2128
bool has_value_from_object;
2131
if (!(load_avg_str=getenv("SGE_LOAD_AVG")) || !strlen(load_avg_str))
2132
load_avg_str = LOAD_ATTR_LOAD_AVG;
2134
ql = lCopyList("copy", lGetList(cq, CQ_qinstances));
2135
lPSortList(ql, "%I+", QU_full_name);
2137
if ((lGetUlong(qp, QU_tag) & TAG_SHOW_IT)!=0) {
2139
num_rows = XbaeMatrixNumRows(qinstance_settings);
2140
if (row >= num_rows) {
2141
XbaeMatrixAddRows(qinstance_settings, num_rows,
2142
NULL, NULL, NULL, 1);
2145
/* compute the load and check for alarm states */
2146
is_load_value = sge_get_double_qattr(&load_avg, load_avg_str, qp, ehl, cl,
2147
&has_value_from_object);
2148
if (sge_load_alarm(NULL, qp, lGetList(qp, QU_load_thresholds), ehl, cl, NULL, true)) {
2149
qinstance_state_set_alarm(qp, true);
2150
sge_load_alarm_reason(qp, lGetList(qp, QU_load_thresholds), ehl,
2151
cl, load_alarm_reason, MAX_STRING_SIZE - 1, "load");
2153
parse_ulong_val(NULL, &interval, TYPE_TIM,
2154
lGetString(qp, QU_suspend_interval), NULL, 0);
2155
if (lGetUlong(qp, QU_nsuspend) != 0 &&
2157
sge_load_alarm(NULL, qp, lGetList(qp, QU_suspend_thresholds), ehl, cl, NULL, false)) {
2158
qinstance_state_set_suspend_alarm(qp, true);
2159
sge_load_alarm_reason(qp, lGetList(qp, QU_suspend_thresholds),
2160
ehl, cl, suspend_alarm_reason,
2161
MAX_STRING_SIZE - 1, "suspend");
2166
XbaeMatrixSetCell(qinstance_settings, row, 0,
2167
(char*)lGetString(qp, QU_full_name));
2169
qip = lAddElemStr(&qil, QI_queue, lGetString(qp, QU_full_name), qi_descr);
2173
dstring type_string = DSTRING_INIT;
2175
qinstance_print_qtype_to_dstring(qp, &type_string, true);
2177
XbaeMatrixSetCell(qinstance_settings, row, 1,
2178
(char*) sge_dstring_get_string(&type_string));
2180
lSetString(qip, QI_qtype, sge_dstring_get_string(&type_string));
2182
sge_dstring_free(&type_string);
2184
/* number of used/free slots */
2185
sprintf(to_print, "%d/%d/%d ", qinstance_slots_reserved_now(qp), qinstance_slots_used(qp),
2186
(int)lGetUlong(qp, QU_job_slots));
2187
sprintf(buf, "%-9.9s ", to_print);
2189
XbaeMatrixSetCell(qinstance_settings, row, 2, buf);
2191
lSetString(qip, QI_used_total, buf);
2195
if (!is_load_value) {
2196
if (has_value_from_object) {
2197
sprintf(to_print, "%2.2f ", load_avg);
2199
sprintf(to_print, "--- ");
2202
sprintf(to_print, "-NA- ");
2205
XbaeMatrixSetCell(qinstance_settings, row, 3, to_print);
2207
lSetString(qip, QI_load_avg, to_print);
2211
if (!sge_get_string_qattr(arch_string, sizeof(arch_string)-1,
2212
LOAD_ATTR_ARCH, qp, ehl, cl)) {
2214
XbaeMatrixSetCell(qinstance_settings, row, 4, arch_string);
2216
lSetString(qip, QI_arch, arch_string);
2220
XbaeMatrixSetCell(qinstance_settings, row, 4, "-NA-");
2222
lSetString(qip, QI_arch, "-NA-");
2226
dstring state_string = DSTRING_INIT;
2228
qinstance_state_append_to_dstring(qp, &state_string);
2230
XbaeMatrixSetCell(qinstance_settings, row, 5,
2231
(char *)sge_dstring_get_string(&state_string));
2233
lSetString(qip, QI_states, sge_dstring_get_string(&state_string));
2235
sge_dstring_free(&state_string);
2249
** sort qinstances according to the criteria in qi_field_sort_by
2251
if (qi_field_sort_by == QI_queue && qi_field_sort_direction == SORT_ASCENDING) {
2252
lPSortList(qil, "%I+", QI_queue);
2253
} else if (qi_field_sort_by == QI_queue && qi_field_sort_direction == SORT_DESCENDING) {
2254
lPSortList(qil, "%I-", QI_queue);
2255
} else if (qi_field_sort_direction == SORT_ASCENDING) {
2256
lPSortList(qil, "%I+ %I+", qi_field_sort_by, QI_queue);
2258
lPSortList(qil, "%I- %I+", qi_field_sort_by, QI_queue);
2261
if ((qil_num = lGetNumberOfElem(qil)) > 0) {
2262
num_rows = XbaeMatrixNumRows(qinstance_settings);
2263
if (qil_num >= num_rows) {
2264
XbaeMatrixAddRows(qinstance_settings, num_rows,
2265
NULL, NULL, NULL, qil_num - num_rows);
2270
for_each(qip, qil) {
2271
XbaeMatrixSetCell(qinstance_settings, row, 0, (char*)lGetString(qip, QI_queue));
2272
XbaeMatrixSetCell(qinstance_settings, row, 1, (char*)lGetString(qip, QI_qtype));
2273
XbaeMatrixSetCell(qinstance_settings, row, 2, (char*)lGetString(qip, QI_used_total));
2274
XbaeMatrixSetCell(qinstance_settings, row, 3, (char*)lGetString(qip, QI_load_avg));
2275
XbaeMatrixSetCell(qinstance_settings, row, 4, (char*)lGetString(qip, QI_arch));
2276
XbaeMatrixSetCell(qinstance_settings, row, 5, (char*)lGetString(qip, QI_states));
2286
static int reformatDoubleValue(
2295
DENTER(TOP_LAYER, "reformatDoubleValue");
2297
if (parse_ulong_val(&dval, NULL, TYPE_MEM, oldmem, NULL, 0)) {
2298
if (dval==DBL_MAX) {
2299
strcpy(result, "infinity");
2303
if (fabs(dval) >= 1024*1024*1024) {
2304
dval /= 1024*1024*1024;
2306
} else if (fabs(dval) >= 1024*1024) {
2309
} else if (fabs(dval) >= 1024) {
2313
sprintf(result, format, dval, c);
2317
strcpy(result, "?E");
2325
/*-------------------------------------------------------------------------*/
2326
static void qmonCQUpdateQhostMatrix(void)
2331
lListElem *eh = NULL;
2332
lListElem *lep = NULL;
2336
DENTER(GUI_LAYER, "qmonCQUpdateQhostMatrix");
2343
qmonMirrorMultiAnswer(EXECHOST_T | CENTRY_T, &alp);
2345
qmonMessageBox(qhost_settings, alp, 0);
2351
ehl = qmonMirrorList(SGE_EXECHOST_LIST);
2352
cl = qmonMirrorList(SGE_CENTRY_LIST);
2354
lWriteListTo(ehl, stdout);
2355
lWriteListTo(cl, stdout);
2357
lPSortList(ehl, "%I+", EH_name);
2359
XtVaSetValues(qhost_settings, XmNcells, NULL, NULL);
2365
dstring rs = DSTRING_INIT;
2366
u_long32 dominant = 0;
2368
char *fields[] = {LOAD_ATTR_MEM_USED, LOAD_ATTR_MEM_TOTAL,
2369
LOAD_ATTR_SWAP_USED, LOAD_ATTR_SWAP_TOTAL,
2370
LOAD_ATTR_VIRTUAL_USED, LOAD_ATTR_VIRTUAL_TOTAL};
2372
num_rows = XbaeMatrixNumRows(qhost_settings);
2373
if (row >= num_rows) {
2374
XbaeMatrixAddRows(qhost_settings, num_rows,
2375
NULL, NULL, NULL, 1);
2378
if(!strcmp(lGetHost(eh, EH_name), SGE_TEMPLATE_NAME) || !strcmp(lGetHost(eh, EH_name), SGE_GLOBAL_NAME)) {
2381
strcpy(buffer, (char *)lGetHost(eh, EH_name));
2382
if (bootstrap_get_ignore_fqdn() && (s = strchr(buffer, '.')))
2385
XbaeMatrixSetCell(qhost_settings, row, column++, buffer);
2387
lep=get_attribute_by_name(NULL, eh, NULL, LOAD_ATTR_ARCH, cl, DISPATCH_TIME_NOW, 0);
2389
sge_strlcpy(buffer, sge_get_dominant_stringval(lep, &dominant, &rs),
2391
sge_dstring_clear(&rs);
2395
strcpy(buffer, "-");
2397
XbaeMatrixSetCell(qhost_settings, row, column++, buffer);
2399
lep=get_attribute_by_name(NULL, eh, NULL, LOAD_ATTR_NUM_PROC, cl, DISPATCH_TIME_NOW, 0);
2401
sge_strlcpy(buffer, sge_get_dominant_stringval(lep, &dominant, &rs),
2403
sge_dstring_clear(&rs);
2407
strcpy(buffer, "-");
2408
XbaeMatrixSetCell(qhost_settings, row, column++, buffer);
2410
lep=get_attribute_by_name(NULL, eh, NULL, LOAD_ATTR_LOAD_AVG, cl, DISPATCH_TIME_NOW, 0);
2412
reformatDoubleValue(buffer, "%.2f%c", sge_get_dominant_stringval(lep, &dominant, &rs));
2413
sge_dstring_clear(&rs);
2417
strcpy(buffer, "-");
2419
XbaeMatrixSetCell(qhost_settings, row, column++, buffer);
2421
lep=get_attribute_by_name(NULL, eh, NULL, LOAD_ATTR_NP_LOAD_AVG, cl, DISPATCH_TIME_NOW, 0);
2423
/* lWriteElemTo(lep, stdout); */
2424
sprintf(buffer, "%.1f%%", 100 * lGetDouble(lep, CE_pj_doubleval));
2425
sge_dstring_clear(&rs);
2429
strcpy(buffer, "-");
2431
XbaeMatrixSetCell(qhost_settings, row, column++, buffer);
2433
for (i = 0; i < 6 ; i++) {
2434
lep=get_attribute_by_name(NULL, eh, NULL, fields[i], cl, DISPATCH_TIME_NOW, 0);
2436
reformatDoubleValue(buffer, "%.1f%c", sge_get_dominant_stringval(lep, &dominant, &rs));
2437
sge_dstring_clear(&rs);
2441
strcpy(buffer, "-");
2443
XbaeMatrixSetCell(qhost_settings, row, column++, buffer);
2447
/* shrink back excess rows */
2448
num_rows = XbaeMatrixNumRows(qhost_settings);
2450
if (num_rows > row) {
2451
XbaeMatrixDeleteRows(qhost_settings, row, num_rows - row);
2457
/*-------------------------------------------------------------------------*/
2458
static void qmonCQStartUpdate(Widget w, XtPointer cld, XtPointer cad)
2460
DENTER(GUI_LAYER, "qmonCQStartUpdate");
2462
qmonTimerAddUpdateProc(EXECHOST_T, "qmonCQUpdateQhostMatrix", qmonCQUpdateQhostMatrix);
2463
qmonStartTimer(EXECHOST_T);
2468
/*-------------------------------------------------------------------------*/
2469
static void qmonCQStopUpdate(Widget w, XtPointer cld, XtPointer cad)
2471
DENTER(GUI_LAYER, "qmonCQStopUpdate");
2473
qmonStopTimer(EXECHOST_T);
2474
qmonTimerRmUpdateProc(EXECHOST_T, "qmonCQUpdateQhostMatrix");
2479
/*-------------------------------------------------------------------------*/
2480
static void qmonQinstanceShowLoad(Widget w, XtPointer cld, XtPointer cad)
2482
static Widget lmon=0;
2483
static Widget lmon_matrix=0;
2484
Widget matrix = qinstance_settings;
2485
const char *qiname = NULL;
2486
int rows, nr_selected_rows, i;
2488
DENTER(GUI_LAYER, "qmonQinstanceShowLoad");
2490
rows = XbaeMatrixNumRows(matrix);
2492
** number of selected rows
2494
nr_selected_rows = XbaeMatrixGetNumSelected(matrix)/XbaeMatrixNumColumns(matrix);
2496
if (nr_selected_rows == 1) {
2497
for (i=0; i<rows; i++) {
2498
/* is this row selected */
2499
if (XbaeMatrixIsRowSelected(matrix, i)) {
2500
qiname = XbaeMatrixGetCell(matrix, i, 0);
2504
if (qiname && qiname[0] != '\0') {
2506
lmon = XmtBuildQueryDialog(matrix, "lmon_shell",
2508
"lmon_matrix", &lmon_matrix,
2511
/* qmonCQUpdate(w, NULL, NULL); */
2512
XtManageChild(lmon);
2513
qmonQinstanceSetLoad(lmon_matrix, qiname);
2515
XtAddEventHandler(XtParent(lmon), StructureNotifyMask, False,
2516
SetMinShellSize, (XtPointer) SHELL_WIDTH);
2517
XtAddEventHandler(XtParent(lmon), StructureNotifyMask, False,
2518
SetMaxShellSize, (XtPointer) SHELL_WIDTH);
2521
if (nr_selected_rows > 1) {
2522
qmonMessageShow(w, True, "@{Select only one queue instance !}");
2524
qmonMessageShow(w, True, "@{To show the load select one queue instance!}");
2531
/*-------------------------------------------------------------------------*/
2532
static void qmonQinstanceSetLoad(Widget matrix, const char *qiname)
2534
static char info[10000];
2541
StringConst new_row[3];
2546
DENTER(GUI_LAYER, "qmonQueueSetLoad");
2548
ehl = qmonMirrorList(SGE_EXECHOST_LIST);
2549
cl = qmonMirrorList(SGE_CENTRY_LIST);
2550
ql = qmonMirrorList(SGE_CQUEUE_LIST);
2552
qep = cqueue_list_locate_qinstance(ql, qiname);
2554
/* is correct_capacities needed here ??? */
2555
/* correct_capacities(ehl, cl); */
2556
queue_complexes2scheduler(&ncl, qep, ehl, cl);
2558
sprintf(info, "%s %s", XmtLocalize(matrix, "Attributes for queue", "Attributes for queue"), lGetString(qep, QU_qname));
2560
xstr = XmtCreateXmString(info);
2561
XtVaSetValues(XtParent(matrix), XmNdialogTitle, xstr, NULL);
2564
rows = XbaeMatrixNumRows(matrix);
2565
XbaeMatrixDeleteRows(matrix, 0, rows);
2568
for_each_rev (ep, ncl) {
2573
StringConst slot_limit;
2574
StringConst job_limit;
2575
if (!(name = lGetString(ep, CE_name)))
2577
/* don't view value entry from complex */
2578
slot_limit = (lGetUlong(ep, CE_dominant)&DOMINANT_TYPE_VALUE)?
2579
NULL:lGetString(ep, CE_stringval);
2580
type = lGetUlong(ep, CE_valtype);
2581
if (slot_limit && (type == TYPE_MEM || type == TYPE_DOUBLE) &&
2582
(n=sscanf(slot_limit, "%f%c", &fval, &unit))>=1) {
2583
sprintf(info, "%8.3f%c", fval, (n>1) ? unit : '\0');
2584
lSetString(ep, CE_stringval, info);
2585
slot_limit = lGetString(ep, CE_stringval);
2588
while (*slot_limit && isspace(*slot_limit))
2591
job_limit = lGetString(ep, CE_pj_stringval);
2592
type = lGetUlong(ep, CE_valtype);
2593
if (job_limit && (type == TYPE_MEM || type == TYPE_DOUBLE) &&
2594
(n = sscanf(job_limit, "%f%c", &fval, &unit))>=1) {
2595
sprintf(info, "%8.3f%c", fval, (n>1) ? unit : '\0');
2596
lSetString(ep, CE_pj_stringval, info);
2597
job_limit = lGetString(ep, CE_pj_stringval);
2601
while (*job_limit && isspace(*job_limit))
2605
new_row[1] = slot_limit ? slot_limit : "";
2606
new_row[2] = job_limit ? job_limit : "";
2608
XbaeMatrixAddRows(matrix, 0, (String*) new_row, NULL, NULL, 1);
2618
/*-------------------------------------------------------------------------*/
2619
static void qmonCQSick(Widget w, XtPointer cld, XtPointer cad)
2626
lListElem *qp = NULL;
2627
Widget matrix = cluster_queue_settings;
2628
int nr_selected_rows = 0;
2630
DENTER(GUI_LAYER, "qmonCQSick");
2632
rows = XbaeMatrixNumRows(matrix);
2634
** number of selected rows
2636
nr_selected_rows = XbaeMatrixGetNumSelected(matrix)/XbaeMatrixNumColumns(matrix);
2638
if (nr_selected_rows > 0) {
2639
dstring ds = DSTRING_INIT;
2640
qmonBrowserOpen(w, NULL, NULL);
2642
qmonMirrorMultiAnswer(CQUEUE_T | HGROUP_T, &alp);
2644
qmonMessageBox(cluster_queue_settings, alp, 0);
2650
hgl = qmonMirrorList(SGE_HGROUP_LIST);
2651
for (i=0; i<rows; i++) {
2652
/* is this row selected */
2653
if (XbaeMatrixIsRowSelected(matrix, i)) {
2654
str = XbaeMatrixGetCell(cluster_queue_settings, i, 0);
2655
if ( str && *str != '\0' ) {
2656
qp = cqueue_list_locate(qmonMirrorList(SGE_CQUEUE_LIST), str);
2657
cqueue_sick(qp, &alp, hgl, &ds);
2661
if (sge_dstring_get_string(&ds))
2662
qmonBrowserShow(sge_dstring_get_string(&ds));
2663
sge_dstring_free(&ds);
2664
qmonMessageBox(w, alp, 0);
2667
qmonMessageShow(w, True, "@{Select at least one queue !}");
2675
/*-------------------------------------------------------------------------*/
2676
static void qmonQinstanceSort(
2681
XbaeMatrixLabelActivateCallbackStruct *cbs =
2682
(XbaeMatrixLabelActivateCallbackStruct *) cad;
2692
DENTER(GUI_LAYER, "qmonQinstanceSort");
2694
DPRINTF(("QISort = cbs->column = %d\n", cbs->column));
2696
/* not coping beyond 6th column */
2697
if (cbs->column > 5) {
2702
** Here is what we are going to do for sorting:
2703
** if the user clicks on a column, we'll sort ascending,
2704
** doing a 2nd time toggles to decending; except
2705
** we always toggle on the job number the first time
2706
** it is selected from a different column, since it is
2707
** always a secondary sort key and if it is selected
2708
** the user most likely wants a toggle.
2711
if (column_nm[cbs->column] == qi_field_sort_by) {
2712
/* toggling sort order */
2713
if (qi_field_sort_direction == SORT_ASCENDING) {
2714
qi_field_sort_direction = SORT_DESCENDING;
2716
qi_field_sort_direction = SORT_ASCENDING;
2719
qi_field_sort_by = column_nm[cbs->column];
2720
qi_field_sort_direction = SORT_ASCENDING;
2723
qmonCQUpdateQIMatrix();