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__*/
38
#include "sge_unistd.h"
44
#include "sge_all_listsL.h"
46
#include "sge_sched.h"
47
#include "cull_sort.h"
49
#include "sge_feature.h"
52
#include "sge_parse_num_par.h"
53
#include "sge_string.h"
55
#include "sge_dstring.h"
56
#include "qstat_printing.h"
57
#include "sge_range.h"
58
#include "sig_handlers.h"
59
#include "msg_clients_common.h"
63
#include "sge_answer.h"
64
#include "sge_qinstance.h"
65
#include "sge_qinstance_state.h"
66
#include "sge_qinstance_type.h"
67
#include "sge_urgency.h"
69
#include "sge_ulong.h"
70
#include "sge_ja_task.h"
71
#include "sge_qstat.h"
73
static int sge_print_job(lListElem *job, lListElem *jatep, lListElem *qep, int print_jobid,
74
char *master, dstring *task_str, u_long32 full_listing, int
75
slots, int slot, lList *ehl, lList *cl, const lList *pe_list,
76
char *intend, u_long32 group_opt, int slots_per_line,
77
int queue_name_length,
78
qhost_report_handler_t *report_handler,
81
static int sge_print_subtask(lListElem *job, lListElem *ja_task, lListElem *task, int print_hdr, int indent);
84
static char hashes[] = "##############################################################################################################";
86
static int sge_print_subtask(
89
lListElem *pe_task, /* NULL, if master task shall be printed */
93
char task_state_string[8];
94
u_long32 tstate, tstatus;
99
lList *scaled_usage_list;
101
DENTER(TOP_LAYER, "sge_print_subtask");
103
/* is sub-task logically running */
104
if(pe_task == NULL) {
105
tstatus = lGetUlong(ja_task, JAT_status);
106
usage_list = lGetList(ja_task, JAT_usage_list);
107
scaled_usage_list = lGetList(ja_task, JAT_scaled_usage_list);
109
tstatus = lGetUlong(pe_task, PET_status);
110
usage_list = lGetList(pe_task, PET_usage);
111
scaled_usage_list = lGetList(pe_task, PET_scaled_usage);
114
task_running = (tstatus==JRUNNING || tstatus==JTRANSFERING);
117
printf(QSTAT_INDENT "Sub-tasks: %-12.12s %5.5s %s %-4.4s %-6.6s\n",
120
USAGE_ATTR_CPU " " USAGE_ATTR_MEM " " USAGE_ATTR_IO " ",
125
if(pe_task == NULL) {
128
str = lGetString(pe_task, PET_id);
130
printf(" %s%-12s ", indent?QSTAT_INDENT2:"", str);
132
/* move status info into state info */
133
tstate = lGetUlong(ja_task, JAT_state);
134
if (tstatus==JRUNNING) {
136
tstate &= ~JTRANSFERING;
137
} else if (tstatus==JTRANSFERING) {
138
tstate |= JTRANSFERING;
140
} else if (tstatus==JFINISHED) {
142
tstate &= ~(JRUNNING|JTRANSFERING);
145
if (lGetList(job, JB_jid_predecessor_list) || lGetUlong(ja_task, JAT_hold)) {
149
if (lGetUlong(ja_task, JAT_job_restarted)) {
151
tstate |= JMIGRATING;
154
/* write states into string */
155
job_get_state_string(task_state_string, tstate);
156
printf("%-5.5s ", task_state_string);
161
/* scaled cpu usage */
162
if (!(up = lGetElemStr(scaled_usage_list, UA_name, USAGE_ATTR_CPU))) {
163
printf("%-10.10s ", task_running?"NA":"");
165
dstring resource_string = DSTRING_INIT;
167
double_print_time_to_dstring(lGetDouble(up, UA_value),
169
printf("%s ", sge_dstring_get_string(&resource_string));
170
sge_dstring_free(&resource_string);
173
/* scaled mem usage */
174
if (!(up = lGetElemStr(scaled_usage_list, UA_name, USAGE_ATTR_MEM)))
175
printf("%-7.7s ", task_running?"NA":"");
177
printf("%-5.5f ", lGetDouble(up, UA_value));
179
/* scaled io usage */
180
if (!(up = lGetElemStr(scaled_usage_list, UA_name, USAGE_ATTR_IO)))
181
printf("%-7.7s ", task_running?"NA":"");
183
printf("%-5.5f ", lGetDouble(up, UA_value));
186
if (tstatus==JFINISHED) {
187
ep=lGetElemStr(usage_list, UA_name, "exit_status");
189
printf("%-4d", ep ? (int)lGetDouble(ep, UA_value) : 0);
197
/*-------------------------------------------------------------------------*/
198
/* print jobs per queue */
199
/*-------------------------------------------------------------------------*/
200
int sge_print_jobs_queue(
203
const lList *pe_list,
207
int print_jobs_of_queue,
208
u_long32 full_listing,
211
int queue_name_length,
212
qhost_report_handler_t *report_handler,
219
u_long32 jid = 0, old_jid;
220
u_long32 jataskid = 0, old_jataskid;
222
dstring dyn_task_str = DSTRING_INIT;
224
DENTER(TOP_LAYER, "sge_print_jobs_queue");
226
qnm = lGetString(qep, QU_full_name);
228
for_each(jlep, job_list) {
231
for_each(jatep, lGetList(jlep, JB_ja_tasks)) {
232
u_long32 jstate = lGetUlong(jatep, JAT_state);
238
if ((jstate & JSUSPENDED_ON_SUBORDINATE))
239
lSetUlong(jatep, JAT_state, jstate & ~JRUNNING);
241
gdilep = lGetElemStr(lGetList(jatep, JAT_granted_destin_identifier_list), JG_qname, qnm);
242
if (gdilep != NULL) {
245
int slots_per_line, slots_in_queue = lGetUlong(gdilep, JG_slots);
247
job_tag = lGetUlong(jatep, JAT_suitable);
248
job_tag |= TAG_FOUND_IT;
249
lSetUlong(jatep, JAT_suitable, job_tag);
251
master = !strcmp(qnm,
252
lGetString(lFirst(lGetList(jatep, JAT_granted_destin_identifier_list)), JG_qname));
257
if (((pe_name=lGetString(jatep, JAT_granted_pe))) &&
258
((pe=pe_list_locate(pe_list, pe_name))) &&
259
!lGetBool(pe, PE_job_is_first_task))
264
/* job distribution view ? */
265
if (!(group_opt & GROUP_NO_PETASK_GROUPS)) {
266
/* no - condensed ouput format */
267
if (!master && !(full_listing & QSTAT_DISPLAY_FULL)) {
268
/* skip all slave outputs except in full display mode */
272
/* print only on line per job for this queue */
275
/* always only show the number of job slots represented by the line */
276
if ((full_listing & QSTAT_DISPLAY_FULL))
277
slots_per_line = slots_in_queue;
279
slots_per_line = sge_granted_slots(lGetList(jatep, JAT_granted_destin_identifier_list));
282
lines_to_print = (int)slots_in_queue+slot_adjust;
286
for (i=0; i<lines_to_print ;i++) {
287
int already_printed = 0;
289
if (!lGetNumberOfElem(user_list) ||
290
(lGetNumberOfElem(user_list) && (lGetUlong(jatep, JAT_suitable)&TAG_SELECT_IT))) {
291
if (print_jobs_of_queue && (job_tag & TAG_SHOW_IT)) {
292
int different, print_jobid;
295
jid = lGetUlong(jlep, JB_job_number);
296
old_jataskid = jataskid;
297
jataskid = lGetUlong(jatep, JAT_task_number);
298
sge_dstring_sprintf(&dyn_task_str, sge_u32, jataskid);
299
different = (jid != old_jid) || (jataskid != old_jataskid);
304
if (!(full_listing & QSTAT_DISPLAY_RUNNING))
305
print_jobid = master && (i==0);
310
if (!already_printed && (full_listing & QSTAT_DISPLAY_RUNNING) &&
311
(lGetUlong(jatep, JAT_state) & JRUNNING)) {
312
sge_print_job(jlep, jatep, qep, print_jobid,
313
(master && different && (i==0))?"MASTER":"SLAVE", &dyn_task_str, full_listing,
314
slots_in_queue+slot_adjust, i, ehl, centry_list, pe_list, indent,
315
group_opt, slots_per_line, queue_name_length, report_handler, alpp);
318
if (!already_printed && (full_listing & QSTAT_DISPLAY_SUSPENDED) &&
319
((lGetUlong(jatep, JAT_state)&JSUSPENDED) ||
320
(lGetUlong(jatep, JAT_state)&JSUSPENDED_ON_THRESHOLD) ||
321
(lGetUlong(jatep, JAT_state)&JSUSPENDED_ON_SUBORDINATE))) {
322
sge_print_job(jlep, jatep, qep, print_jobid,
323
(master && different && (i==0))?"MASTER":"SLAVE", &dyn_task_str, full_listing,
324
slots_in_queue+slot_adjust, i, ehl, centry_list, pe_list, indent,
325
group_opt, slots_per_line, queue_name_length, report_handler, alpp);
329
if (!already_printed && (full_listing & QSTAT_DISPLAY_USERHOLD) &&
330
(lGetUlong(jatep, JAT_hold)&MINUS_H_TGT_USER)) {
331
sge_print_job(jlep, jatep, qep, print_jobid,
332
(master && different && (i==0))?"MASTER":"SLAVE", &dyn_task_str, full_listing,
333
slots_in_queue+slot_adjust, i, ehl, centry_list, pe_list, indent,
334
group_opt, slots_per_line, queue_name_length, report_handler, alpp);
338
if (!already_printed && (full_listing & QSTAT_DISPLAY_OPERATORHOLD) &&
339
(lGetUlong(jatep, JAT_hold)&MINUS_H_TGT_OPERATOR)) {
340
sge_print_job(jlep, jatep, qep, print_jobid,
341
(master && different && (i==0))?"MASTER":"SLAVE", &dyn_task_str, full_listing,
342
slots_in_queue+slot_adjust, i, ehl, centry_list, pe_list, indent,
343
group_opt, slots_per_line, queue_name_length, report_handler, alpp);
347
if (!already_printed && (full_listing & QSTAT_DISPLAY_SYSTEMHOLD) &&
348
(lGetUlong(jatep, JAT_hold)&MINUS_H_TGT_SYSTEM)) {
349
sge_print_job(jlep, jatep, qep, print_jobid,
350
(master && different && (i==0))?"MASTER":"SLAVE", &dyn_task_str, full_listing,
351
slots_in_queue+slot_adjust, i, ehl, centry_list, pe_list, indent,
352
group_opt, slots_per_line, queue_name_length, report_handler, alpp);
356
if (!already_printed && (full_listing & QSTAT_DISPLAY_JOBARRAYHOLD) &&
357
(lGetUlong(jatep, JAT_hold)&MINUS_H_TGT_JA_AD)) {
358
sge_print_job(jlep, jatep, qep, print_jobid,
359
(master && different && (i==0))?"MASTER":"SLAVE", &dyn_task_str, full_listing,
360
slots_in_queue+slot_adjust, i, ehl, centry_list, pe_list, indent,
361
group_opt, slots_per_line, queue_name_length, report_handler, alpp);
370
sge_dstring_free(&dyn_task_str);
375
void sge_printf_header(u_long32 full_listing, u_long32 sge_ext)
377
static int first_pending = 1;
378
static int first_zombie = 1;
380
if ((full_listing & QSTAT_DISPLAY_PENDING) &&
381
(full_listing & QSTAT_DISPLAY_FULL)) {
384
printf("\n############################################################################%s\n",
386
printf("%s\n", MSG_QSTAT_PRT_PEDINGJOBS);
387
printf("############################################################################%s\n",
391
if ((full_listing & QSTAT_DISPLAY_ZOMBIES) &&
392
(full_listing & QSTAT_DISPLAY_FULL)) {
395
printf("\n############################################################################%s\n", sge_ext?hashes:"");
396
printf("%s\n", MSG_QSTAT_PRT_FINISHEDJOBS);
397
printf("############################################################################%s\n", sge_ext?hashes:"");
402
#define OPTI_PRINT8(value) \
403
if (value > 99999999 ) \
404
printf("%8.3g ", value); \
406
printf("%8.0f ", value)
409
static char jhul1[] = "---------------------------------------------------------------------------------------------";
411
static char jhul2[] = "-";
413
static char jhul3[] = "-------------------------------------------------------------------------------";
415
static char jhul4[] = "-----------------------------------------------------";
417
static char jhul5[] = "----------------------------------------------------------------";
419
static char jhul6[] = "-----------------------------------";
421
static int sge_print_job(
427
dstring *dyn_task_str,
428
u_long32 full_listing,
431
lList *exechost_list,
433
const lList *pe_list,
436
int slots_per_line, /* number of slots to be printed in slots column
437
when 0 is passed the number of requested slots printed */
438
int queue_name_length,
439
qhost_report_handler_t *report_handler,
442
char state_string[8];
443
static int first_time = 1;
445
int sge_urg, sge_pri, sge_ext, sge_time;
447
lListElem *qrep, *gdil_ep=NULL;
449
const char *queue_name = NULL;
450
const char *cqname = NULL;
452
u_long tickets,otickets,stickets,ftickets;
456
dstring queue_name_buffer = DSTRING_INIT;
458
int ret = QHOST_SUCCESS;
460
DENTER(TOP_LAYER, "sge_print_job");
462
sge_dstring_init(&ds, buffer, sizeof(buffer));
464
is_zombie_job = job_is_zombie_job(job);
467
queue_name = qinstance_get_name(qep, &queue_name_buffer);
468
cqname = lGetString(qep, QU_qname);
471
sge_ext = ((full_listing & QSTAT_DISPLAY_EXTENDED) == QSTAT_DISPLAY_EXTENDED);
472
tsk_ext = (full_listing & QSTAT_DISPLAY_TASKS);
473
sge_urg = (full_listing & QSTAT_DISPLAY_URGENCY);
474
sge_pri = (full_listing & QSTAT_DISPLAY_PRIORITY);
476
sge_time = sge_time | tsk_ext | sge_urg | sge_pri;
479
if (!report_handler) {
482
if (!(full_listing & QSTAT_DISPLAY_FULL)) {
483
int line_length = queue_name_length-10+1;
484
char * seperator = malloc(line_length);
485
const char *part1 = "%s%-7.7s %s %s%s%s%s%s %-10.10s %-12.12s %s%-5.5s %s%s%s%s%s%s%s%s%s%-";
486
const char *part3 = ".";
487
const char *part5 = "s %s %s%s%s%s%s%s";
488
char *part6 = malloc(strlen(part1) + strlen(part3) + strlen(part5) + 20);
491
for(i=0; i<line_length; i++){
495
seperator[line_length-1] = '\0';
496
sprintf(part6, "%s%d%s%d%s", part1, queue_name_length, part3, queue_name_length, part5);
502
(sge_pri||sge_urg)?" nurg ":"",
503
sge_pri?" npprior":"",
504
(sge_pri||sge_ext)?" ntckts ":"",
505
sge_urg?" urg rrcontr wtcontr dlcontr ":"",
509
sge_ext?"project department ":"",
511
sge_time?"submit/start at ":"",
512
sge_urg ? " deadline " : "",
513
sge_ext ? USAGE_ATTR_CPU " " USAGE_ATTR_MEM " " USAGE_ATTR_IO " " : "",
521
(group_opt & GROUP_NO_PETASK_GROUPS)?"master":"slots",
523
tsk_ext?"task-ID ":"",
525
tsk_ext?USAGE_ATTR_CPU " " USAGE_ATTR_MEM " " USAGE_ATTR_IO " " : "",
527
tsk_ext?"failed ":"" );
529
printf("\n%s%s%s%s%s%s%s%s\n", indent,
532
(group_opt & GROUP_NO_PETASK_GROUPS)?jhul2:"",
533
sge_ext ? jhul3 : "",
534
tsk_ext ? jhul4 : "",
535
sge_urg ? jhul5 : "",
536
sge_pri ? jhul6 : "");
543
printf("%s", indent);
545
/* job number / ja task id */
547
printf("%7d ", (int)lGetUlong(job, JB_job_number));
552
snprintf(jobid, sizeof(jobid)-1, "%d", (int)lGetUlong(job, JB_job_number));
553
ret = report_handler->report_job_begin(report_handler, cqname, jobid, alpp);
554
if (ret != QHOST_SUCCESS ) {
560
/* per job priority information */
562
if (report_handler) {
563
ret = report_handler->report_job_double_value(report_handler, cqname, jobid, "priority", lGetDouble(jatep, JAT_prio), alpp);
564
if (ret != QHOST_SUCCESS) {
569
printf("%7.5f ", lGetDouble(jatep, JAT_prio)); /* nprio 0.0 - 1.0 */
575
if (sge_pri || sge_urg) {
577
printf("%7.5f ", lGetDouble(job, JB_nurg)); /* nurg 0.0 - 1.0 */
585
printf("%7.5f ", lGetDouble(job, JB_nppri)); /* nppri 0.0 - 1.0 */
590
if (sge_pri || sge_ext) {
592
printf("%7.5f ", lGetDouble(jatep, JAT_ntix)); /* ntix 0.0 - 1.0 */
599
OPTI_PRINT8(lGetDouble(job, JB_urg));
600
OPTI_PRINT8(lGetDouble(job, JB_rrcontr));
601
OPTI_PRINT8(lGetDouble(job, JB_wtcontr));
602
OPTI_PRINT8(lGetDouble(job, JB_dlcontr));
613
printf("%5d ", ((int)lGetUlong(job, JB_priority))-BASE_PRIORITY);
622
if (report_handler) {
623
ret = report_handler->report_job_string_value(report_handler, cqname, jobid, "qinstance_name", queue_name, alpp);
624
if (ret != QHOST_SUCCESS ) {
627
ret = report_handler->report_job_string_value(report_handler, cqname, jobid, "job_name", lGetString(job, JB_job_name), alpp);
628
if (ret != QHOST_SUCCESS ) {
631
ret = report_handler->report_job_string_value(report_handler, cqname, jobid, "job_owner", lGetString(job, JB_owner), alpp);
632
if (ret != QHOST_SUCCESS ) {
638
printf("%-10.10s ", lGetString(job, JB_job_name));
641
printf("%-12.12s ", lGetString(job, JB_owner));
653
printf("%-16.16s ", (s=lGetString(job, JB_project))?s:"NA");
655
printf("%-10.10s ", (s=lGetString(job, JB_department))?s:"NA");
662
/* move status info into state info */
663
jstate = lGetUlong(jatep, JAT_state);
664
if (lGetUlong(jatep, JAT_status)==JTRANSFERING) {
665
jstate |= JTRANSFERING;
669
if (lGetList(job, JB_jid_predecessor_list) || lGetUlong(jatep, JAT_hold)) {
673
if (lGetUlong(jatep, JAT_job_restarted)) {
675
jstate |= JMIGRATING;
678
if (report_handler) {
679
job_get_state_string(state_string, jstate);
680
report_handler->report_job_string_value(report_handler, cqname, jobid, "job_state", state_string, alpp);
683
/* write states into string */
684
job_get_state_string(state_string, jstate);
685
printf("%-5.5s ", state_string);
692
if (report_handler) {
693
if (!lGetUlong(jatep, JAT_start_time)) {
694
report_handler->report_job_ulong_value(report_handler, cqname, jobid, "submit_time", lGetUlong(job, JB_submission_time), alpp);
696
report_handler->report_job_ulong_value(report_handler, cqname, jobid, "start_time", lGetUlong(jatep, JAT_start_time), alpp);
700
/* start/submit time */
701
if (!lGetUlong(jatep, JAT_start_time) ) {
702
printf("%s ", sge_ctime((time_t)lGetUlong(job, JB_submission_time), &ds));
706
/* AH: intermediate change to monitor JAT_stop_initiate_time
707
* must be removed before 6.0 if really needed a better possiblity
708
* for monitoring must be found (TODO)
710
if (getenv("JAT_stop_initiate_time") && (lGetUlong(jatep, JAT_state) & JDELETED))
711
printf("%s!", sge_ctime(lGetUlong(jatep, JAT_stop_initiate_time), &ds));
714
printf("%s ", sge_ctime((time_t)lGetUlong(jatep, JAT_start_time), &ds));
722
/* is job logically running */
723
running = lGetUlong(jatep, JAT_status)==JRUNNING ||
724
lGetUlong(jatep, JAT_status)==JTRANSFERING;
729
if (!lGetUlong(job, JB_deadline) )
732
printf("%s ", sge_ctime((time_t)lGetUlong(job, JB_deadline), &ds));
739
lListElem *up, *pe, *task;
740
lList *job_usage_list;
743
if (!master || !strcmp(master, "MASTER"))
744
job_usage_list = lCopyList(NULL, lGetList(jatep, JAT_scaled_usage_list));
746
job_usage_list = lCreateList("", UA_Type);
748
/* sum pe-task usage based on queue slots */
749
if (job_usage_list) {
751
for_each(task, lGetList(jatep, JAT_task_list)) {
752
lListElem *dst, *src, *ep;
757
((ep=lFirst(lGetList(task, PET_granted_destin_identifier_list)))) &&
758
((qname=lGetString(ep, JG_qname))) &&
759
!strcmp(qname, queue_name) && ((subtask_ndx++%slots)==slot))) {
760
for_each(src, lGetList(task, PET_scaled_usage)) {
761
if ((dst=lGetElemStr(job_usage_list, UA_name, lGetString(src, UA_name))))
762
lSetDouble(dst, UA_value, lGetDouble(dst, UA_value) + lGetDouble(src, UA_value));
764
lAppendElem(job_usage_list, lCopyElem(src));
771
/* scaled cpu usage */
772
if (!(up = lGetElemStr(job_usage_list, UA_name, USAGE_ATTR_CPU)))
773
printf("%-10.10s ", running?"NA":"");
775
int secs, minutes, hours, days;
777
secs = lGetDouble(up, UA_value);
779
days = secs/(60*60*24);
780
secs -= days*(60*60*24);
782
hours = secs/(60*60);
783
secs -= hours*(60*60);
788
printf("%d:%2.2d:%2.2d:%2.2d ", days, hours, minutes, secs);
790
/* scaled mem usage */
791
if (!(up = lGetElemStr(job_usage_list, UA_name, USAGE_ATTR_MEM)))
792
printf("%-7.7s ", running?"NA":"");
794
printf("%-5.5f ", lGetDouble(up, UA_value));
796
/* scaled io usage */
797
if (!(up = lGetElemStr(job_usage_list, UA_name, USAGE_ATTR_IO)))
798
printf("%-7.7s ", running?"NA":"");
800
printf("%-5.5f ", lGetDouble(up, UA_value));
802
lFreeList(&job_usage_list);
804
/* get tickets for job/slot */
805
/* braces needed to suppress compiler warnings */
806
if ((pe_name=lGetString(jatep, JAT_granted_pe)) &&
807
(pe=pe_list_locate(pe_list, pe_name)) &&
808
lGetBool(pe, PE_control_slaves)
809
&& slots && (gdil_ep=lGetSubStr(jatep, JG_qname, queue_name,
810
JAT_granted_destin_identifier_list))) {
812
tickets = (u_long)lGetDouble(gdil_ep, JG_ticket);
813
otickets = (u_long)lGetDouble(gdil_ep, JG_oticket);
814
ftickets = (u_long)lGetDouble(gdil_ep, JG_fticket);
815
stickets = (u_long)lGetDouble(gdil_ep, JG_sticket);
819
tickets = (u_long)(lGetDouble(gdil_ep, JG_ticket) / slots);
820
otickets = (u_long)(lGetDouble(gdil_ep, JG_oticket) / slots);
821
ftickets = (u_long)(lGetDouble(gdil_ep, JG_fticket) / slots);
822
stickets = (u_long)(lGetDouble(gdil_ep, JG_sticket) / slots);
825
tickets = otickets = ftickets = stickets = 0;
830
tickets = (u_long)lGetDouble(jatep, JAT_tix);
831
otickets = (u_long)lGetDouble(jatep, JAT_oticket);
832
ftickets = (u_long)lGetDouble(jatep, JAT_fticket);
833
stickets = (u_long)lGetDouble(jatep, JAT_sticket);
837
/* report jobs dynamic scheduling attributes */
838
/* only scheduled have these attribute */
839
/* Pending jobs can also have tickets */
848
if (sge_ext || lGetList(jatep, JAT_granted_destin_identifier_list)) {
849
printf("%5d ", (int)tickets),
850
printf("%5d ", (int)lGetUlong(job, JB_override_tickets));
851
printf("%5d ", (int)otickets);
852
printf("%5d ", (int)ftickets);
853
printf("%5d ", (int)stickets);
854
printf("%-5.2f ", lGetDouble(jatep, JAT_share));
867
/* if not full listing we need the queue's name in each line */
868
if (!(full_listing & QSTAT_DISPLAY_FULL)) {
869
if (report_handler) {
870
report_handler->report_job_string_value(report_handler, cqname, jobid, "queue_name", queue_name, alpp);
873
sprintf(temp,"%%-%d.%ds ", queue_name_length, queue_name_length);
874
printf(temp, queue_name?queue_name:"");
878
if ((group_opt & GROUP_NO_PETASK_GROUPS)) {
879
/* MASTER/SLAVE information needed only to show parallel job distribution */
880
if (report_handler) {
881
report_handler->report_job_string_value(report_handler, cqname, jobid, "pe_master", master, alpp);
884
printf("%-7.6s", master);
890
/* job slots requested/granted */
891
if (!slots_per_line) {
892
slots_per_line = sge_job_slot_request(job, pe_list);
894
printf("%5d ", slots_per_line);
897
if (report_handler) {
898
const char*taskid = sge_dstring_get_string(dyn_task_str);
899
if (job_is_array(job)) {
900
ret = report_handler->report_job_string_value(report_handler, cqname, jobid, "taskid", taskid, alpp);
901
if (ret != QHOST_SUCCESS ) {
906
if (sge_dstring_get_string(dyn_task_str) && job_is_array(job)) {
907
printf("%s", sge_dstring_get_string(dyn_task_str));
914
lList *task_list = lGetList(jatep, JAT_task_list);
915
lListElem *task, *ep;
919
int num_spaces = sizeof(jhul1)-1 + (sge_ext?sizeof(jhul2)-1:0) -
920
((full_listing & QSTAT_DISPLAY_FULL)?11:0);
922
/* print master sub-task belonging to this queue */
923
if (!slot && task_list && queue_name &&
924
((ep=lFirst(lGetList(jatep, JAT_granted_destin_identifier_list)))) &&
925
((qname=lGetString(ep, JG_qname))) &&
926
!strcmp(qname, queue_name)) {
928
printf("%*s", num_spaces, " ");
930
sge_print_subtask(job, jatep, NULL, 0, 0);
934
/* print sub-tasks belonging to this queue */
935
for_each(task, task_list) {
936
if (!slots || (queue_name &&
937
((ep=lFirst(lGetList(task, PET_granted_destin_identifier_list)))) &&
938
((qname=lGetString(ep, JG_qname))) &&
939
!strcmp(qname, queue_name) && ((subtask_ndx++%slots)==slot))) {
941
printf("%*s", num_spaces, " ");
943
sge_print_subtask(job, jatep, task, 0, 0);
952
if (!report_handler) {
953
/* print a new line */
956
ret = report_handler->report_job_finished(report_handler, cqname, jobid, alpp);
957
if (ret != QHOST_SUCCESS ) {
963
/* print additional job info if requested */
964
if (print_jobid && (full_listing & QSTAT_DISPLAY_RESOURCES)) {
965
printf(QSTAT_INDENT "Full jobname: %s\n", lGetString(job, JB_job_name));
968
printf(QSTAT_INDENT "Master queue: %s\n", queue_name);
971
if (lGetString(job, JB_pe)) {
972
dstring range_string = DSTRING_INIT;
974
range_list_print_to_string(lGetList(job, JB_pe_range),
975
&range_string, true, false, false);
976
printf(QSTAT_INDENT "Requested PE: %s %s\n",
977
lGetString(job, JB_pe), sge_dstring_get_string(&range_string));
978
sge_dstring_free(&range_string);
980
if (lGetString(jatep, JAT_granted_pe)) {
982
u_long32 pe_slots = 0;
983
for_each (gdil_ep, lGetList(jatep, JAT_granted_destin_identifier_list))
984
pe_slots += lGetUlong(gdil_ep, JG_slots);
985
printf(QSTAT_INDENT "Granted PE: %s "sge_u32"\n",
986
lGetString(jatep, JAT_granted_pe), pe_slots);
988
if (lGetString(job, JB_checkpoint_name))
989
printf(QSTAT_INDENT "Checkpoint Env.: %s\n",
990
lGetString(job, JB_checkpoint_name));
992
sge_show_ce_type_list_line_by_line(QSTAT_INDENT "Hard Resources: ",
993
QSTAT_INDENT2, lGetList(job, JB_hard_resource_list), true, centry_list,
994
sge_job_slot_request(job, pe_list));
996
/* display default requests if necessary */
998
lList *attributes = NULL;
1003
queue_complexes2scheduler(&attributes, qep, exechost_list, centry_list);
1004
for_each (ce, attributes) {
1007
name = lGetString(ce, CE_name);
1008
if (!lGetBool(ce, CE_consumable) || !strcmp(name, "slots") ||
1009
job_get_request(job, name))
1012
parse_ulong_val(&dval, NULL, lGetUlong(ce, CE_valtype), lGetString(ce, CE_default), NULL, 0);
1016
/* For pending jobs (no queue/no exec host) we may print default request only
1017
if the consumable is specified in the global host. For running we print it
1018
if the resource is managed at this node/queue */
1019
if ((qep && lGetSubStr(qep, CE_name, name, QU_consumable_config_list)) ||
1020
(qep && (hep=host_list_locate(exechost_list, lGetHost(qep, QU_qhostname))) &&
1021
lGetSubStr(hep, CE_name, name, EH_consumable_config_list)) ||
1022
((hep=host_list_locate(exechost_list, SGE_GLOBAL_NAME)) &&
1023
lGetSubStr(hep, CE_name, name, EH_consumable_config_list)))
1025
printf("%s%s=%s (default)\n", QSTAT_INDENT, name, lGetString(ce, CE_default));
1027
lFreeList(&attributes);
1030
sge_show_ce_type_list_line_by_line(QSTAT_INDENT "Soft Resources: ",
1031
QSTAT_INDENT2, lGetList(job, JB_soft_resource_list), false, NULL, 0);
1033
ql = lGetList(job, JB_hard_queue_list);
1035
printf(QSTAT_INDENT "Hard requested queues: ");
1036
for_each(qrep, ql) {
1037
printf("%s", lGetString(qrep, QR_name));
1038
printf("%s", lNext(qrep)?", ":"\n");
1042
ql = lGetList(job, JB_soft_queue_list);
1044
printf(QSTAT_INDENT "Soft requested queues: ");
1045
for_each(qrep, ql) {
1046
printf("%s", lGetString(qrep, QR_name));
1047
printf("%s", lNext(qrep)?", ":"\n");
1050
ql = lGetList(job, JB_master_hard_queue_list);
1052
printf(QSTAT_INDENT "Master task hard requested queues: ");
1053
for_each(qrep, ql) {
1054
printf("%s", lGetString(qrep, QR_name));
1055
printf("%s", lNext(qrep)?", ":"\n");
1058
ql = lGetList(job, JB_jid_request_list );
1060
printf(QSTAT_INDENT "Predecessor Jobs (request): ");
1061
for_each(qrep, ql) {
1062
printf("%s", lGetString(qrep, JRE_job_name));
1063
printf("%s", lNext(qrep)?", ":"\n");
1066
ql = lGetList(job, JB_jid_predecessor_list);
1068
printf(QSTAT_INDENT "Predecessor Jobs: ");
1069
for_each(qrep, ql) {
1070
printf(sge_u32, lGetUlong(qrep, JRE_job_number));
1071
printf("%s", lNext(qrep)?", ":"\n");
1074
ql = lGetList(job, JB_ja_ad_request_list );
1076
printf(QSTAT_INDENT "Predecessor Array Jobs (request): ");
1077
for_each(qrep, ql) {
1078
printf("%s", lGetString(qrep, JRE_job_name));
1079
printf("%s", lNext(qrep)?", ":"\n");
1082
ql = lGetList(job, JB_ja_ad_predecessor_list);
1084
printf(QSTAT_INDENT "Predecessor Array Jobs: ");
1085
for_each(qrep, ql) {
1086
printf(sge_u32, lGetUlong(qrep, JRE_job_number));
1087
printf("%s", lNext(qrep)?", ":"\n");
1093
#undef QSTAT_INDENT2
1095
sge_dstring_free(&queue_name_buffer);