~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/clients/common/qstat_printing.c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*___INFO__MARK_BEGIN__*/
 
2
/*************************************************************************
 
3
 * 
 
4
 *  The Contents of this file are made available subject to the terms of
 
5
 *  the Sun Industry Standards Source License Version 1.2
 
6
 * 
 
7
 *  Sun Microsystems Inc., March, 2001
 
8
 * 
 
9
 * 
 
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
 
16
 * 
 
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.
 
23
 * 
 
24
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 
25
 * 
 
26
 *   Copyright: 2001 by Sun Microsystems, Inc.
 
27
 * 
 
28
 *   All Rights Reserved.
 
29
 * 
 
30
 ************************************************************************/
 
31
/*___INFO__MARK_END__*/
 
32
#include <stdio.h>
 
33
#include <stdlib.h>
 
34
#include <string.h>
 
35
#include <sys/stat.h>
 
36
#include <fnmatch.h>
 
37
 
 
38
#include "sge_unistd.h"
 
39
#include "sgermon.h"
 
40
#include "symbols.h"
 
41
#include "sge.h"
 
42
#include "sge_time.h"
 
43
#include "sge_log.h"
 
44
#include "sge_all_listsL.h"
 
45
#include "sge_host.h"
 
46
#include "sge_sched.h"
 
47
#include "cull_sort.h"
 
48
#include "usage.h"
 
49
#include "sge_feature.h"
 
50
#include "parse.h"
 
51
#include "sge_prog.h"
 
52
#include "sge_parse_num_par.h"
 
53
#include "sge_string.h"
 
54
#include "show_job.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"
 
60
#include "sge_job.h"
 
61
#include "get_path.h"
 
62
#include "sge_var.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"
 
68
#include "sge_pe.h"
 
69
#include "sge_ulong.h"
 
70
#include "sge_ja_task.h"
 
71
#include "sge_qstat.h"
 
72
 
 
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,
 
79
                         lList **alpp);
 
80
 
 
81
static int sge_print_subtask(lListElem *job, lListElem *ja_task, lListElem *task, int print_hdr, int indent);
 
82
 
 
83
 
 
84
static char hashes[] = "##############################################################################################################";
 
85
 
 
86
static int sge_print_subtask(
 
87
lListElem *job,
 
88
lListElem *ja_task,
 
89
lListElem *pe_task,  /* NULL, if master task shall be printed */
 
90
int print_hdr,
 
91
int indent 
 
92
) {
 
93
   char task_state_string[8];
 
94
   u_long32 tstate, tstatus;
 
95
   int task_running;
 
96
   const char *str;
 
97
   lListElem *ep;
 
98
   lList *usage_list;
 
99
   lList *scaled_usage_list;
 
100
 
 
101
   DENTER(TOP_LAYER, "sge_print_subtask");
 
102
 
 
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);
 
108
   } else {
 
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);
 
112
   }
 
113
 
 
114
   task_running = (tstatus==JRUNNING || tstatus==JTRANSFERING);
 
115
 
 
116
   if (print_hdr) {
 
117
      printf(QSTAT_INDENT "Sub-tasks:           %-12.12s %5.5s %s %-4.4s %-6.6s\n", 
 
118
             "task-ID",
 
119
             "state",
 
120
             USAGE_ATTR_CPU "        " USAGE_ATTR_MEM "     " USAGE_ATTR_IO "     ",
 
121
             "stat",
 
122
             "failed");
 
123
   }
 
124
 
 
125
   if(pe_task == NULL) {
 
126
      str = "";
 
127
   } else {
 
128
      str = lGetString(pe_task, PET_id);
 
129
   }
 
130
   printf("   %s%-12s ", indent?QSTAT_INDENT2:"", str);
 
131
 
 
132
   /* move status info into state info */
 
133
   tstate = lGetUlong(ja_task, JAT_state);
 
134
   if (tstatus==JRUNNING) {
 
135
      tstate |= JRUNNING;
 
136
      tstate &= ~JTRANSFERING;
 
137
   } else if (tstatus==JTRANSFERING) {
 
138
      tstate |= JTRANSFERING;
 
139
      tstate &= ~JRUNNING;
 
140
   } else if (tstatus==JFINISHED) {
 
141
      tstate |= JEXITING;
 
142
      tstate &= ~(JRUNNING|JTRANSFERING);
 
143
   }
 
144
 
 
145
   if (lGetList(job, JB_jid_predecessor_list) || lGetUlong(ja_task, JAT_hold)) {
 
146
      tstate |= JHELD;
 
147
   }
 
148
 
 
149
   if (lGetUlong(ja_task, JAT_job_restarted)) {
 
150
      tstate &= ~JWAITING;
 
151
      tstate |= JMIGRATING;
 
152
   }
 
153
 
 
154
   /* write states into string */ 
 
155
   job_get_state_string(task_state_string, tstate);
 
156
   printf("%-5.5s ", task_state_string); 
 
157
 
 
158
   {
 
159
      lListElem *up;
 
160
 
 
161
      /* scaled cpu usage */
 
162
      if (!(up = lGetElemStr(scaled_usage_list, UA_name, USAGE_ATTR_CPU))) {
 
163
         printf("%-10.10s ", task_running?"NA":""); 
 
164
      } else {
 
165
         dstring resource_string = DSTRING_INIT;
 
166
 
 
167
         double_print_time_to_dstring(lGetDouble(up, UA_value), 
 
168
                                      &resource_string);
 
169
         printf("%s ", sge_dstring_get_string(&resource_string));
 
170
         sge_dstring_free(&resource_string);
 
171
      }
 
172
 
 
173
      /* scaled mem usage */
 
174
      if (!(up = lGetElemStr(scaled_usage_list, UA_name, USAGE_ATTR_MEM))) 
 
175
         printf("%-7.7s ", task_running?"NA":""); 
 
176
      else
 
177
         printf("%-5.5f ", lGetDouble(up, UA_value)); 
 
178
  
 
179
      /* scaled io usage */
 
180
      if (!(up = lGetElemStr(scaled_usage_list, UA_name, USAGE_ATTR_IO))) 
 
181
         printf("%-7.7s ", task_running?"NA":""); 
 
182
      else
 
183
         printf("%-5.5f ", lGetDouble(up, UA_value)); 
 
184
   }
 
185
 
 
186
   if (tstatus==JFINISHED) {
 
187
      ep=lGetElemStr(usage_list, UA_name, "exit_status");
 
188
 
 
189
      printf("%-4d", ep ? (int)lGetDouble(ep, UA_value) : 0);
 
190
   }
 
191
 
 
192
   putchar('\n');
 
193
 
 
194
   DRETURN(0);
 
195
}
 
196
 
 
197
/*-------------------------------------------------------------------------*/
 
198
/* print jobs per queue                                                    */
 
199
/*-------------------------------------------------------------------------*/
 
200
int sge_print_jobs_queue(
 
201
lListElem *qep,
 
202
lList *job_list,
 
203
const lList *pe_list,
 
204
lList *user_list,
 
205
lList *ehl,
 
206
lList *centry_list,
 
207
int print_jobs_of_queue,
 
208
u_long32 full_listing,
 
209
char *indent,
 
210
u_long32 group_opt, 
 
211
int queue_name_length,
 
212
qhost_report_handler_t *report_handler, 
 
213
lList **alpp
 
214
) {
 
215
   lListElem *jlep;
 
216
   lListElem *jatep;
 
217
   lListElem *gdilep;
 
218
   u_long32 job_tag;
 
219
   u_long32 jid = 0, old_jid;
 
220
   u_long32 jataskid = 0, old_jataskid;
 
221
   const char *qnm;
 
222
   dstring dyn_task_str = DSTRING_INIT;
 
223
 
 
224
   DENTER(TOP_LAYER, "sge_print_jobs_queue");
 
225
 
 
226
   qnm = lGetString(qep, QU_full_name);
 
227
 
 
228
   for_each(jlep, job_list) {
 
229
      int master, i;
 
230
 
 
231
      for_each(jatep, lGetList(jlep, JB_ja_tasks)) {
 
232
         u_long32 jstate = lGetUlong(jatep, JAT_state);
 
233
 
 
234
         if (shut_me_down) {
 
235
            DRETURN(1);
 
236
         }
 
237
 
 
238
         if ((jstate & JSUSPENDED_ON_SUBORDINATE))
 
239
            lSetUlong(jatep, JAT_state, jstate & ~JRUNNING);
 
240
 
 
241
         gdilep = lGetElemStr(lGetList(jatep, JAT_granted_destin_identifier_list), JG_qname, qnm);
 
242
         if (gdilep != NULL) {
 
243
            int slot_adjust = 0;
 
244
            int lines_to_print;
 
245
            int slots_per_line, slots_in_queue = lGetUlong(gdilep, JG_slots); 
 
246
 
 
247
            job_tag = lGetUlong(jatep, JAT_suitable);
 
248
            job_tag |= TAG_FOUND_IT;
 
249
            lSetUlong(jatep, JAT_suitable, job_tag);
 
250
 
 
251
            master = !strcmp(qnm, 
 
252
                  lGetString(lFirst(lGetList(jatep, JAT_granted_destin_identifier_list)), JG_qname));
 
253
 
 
254
            if (master) {
 
255
               const char *pe_name;
 
256
               lListElem *pe;
 
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))
 
260
 
 
261
                   slot_adjust = 1;
 
262
            }
 
263
 
 
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 */
 
269
                  continue;
 
270
               }
 
271
 
 
272
               /* print only on line per job for this queue */
 
273
               lines_to_print = 1;
 
274
 
 
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;
 
278
               else
 
279
                  slots_per_line = sge_granted_slots(lGetList(jatep, JAT_granted_destin_identifier_list));
 
280
            } else {
 
281
               /* yes */
 
282
               lines_to_print = (int)slots_in_queue+slot_adjust;
 
283
               slots_per_line = 1;
 
284
            }
 
285
 
 
286
            for (i=0; i<lines_to_print ;i++) {
 
287
               int already_printed = 0;
 
288
 
 
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;
 
293
 
 
294
                     old_jid = jid;
 
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);
 
300
 
 
301
                     if (different) 
 
302
                        print_jobid = 1;
 
303
                     else {
 
304
                        if (!(full_listing & QSTAT_DISPLAY_RUNNING))
 
305
                           print_jobid = master && (i==0);
 
306
                        else 
 
307
                           print_jobid = 0;
 
308
                     }
 
309
 
 
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);   
 
316
                        already_printed = 1;
 
317
                     }
 
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);   
 
326
                        already_printed = 1;
 
327
                     }
 
328
 
 
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);
 
335
                        already_printed = 1;
 
336
                     }
 
337
 
 
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);
 
344
                        already_printed = 1;
 
345
                     }
 
346
                         
 
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);
 
353
                        already_printed = 1;
 
354
                     }
 
355
 
 
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);
 
362
                        already_printed = 1;
 
363
                     }
 
364
                  }
 
365
               }
 
366
            }
 
367
         }
 
368
      }
 
369
   }
 
370
   sge_dstring_free(&dyn_task_str);
 
371
 
 
372
   DRETURN(0);
 
373
}
 
374
 
 
375
void sge_printf_header(u_long32 full_listing, u_long32 sge_ext)
 
376
{
 
377
   static int first_pending = 1;
 
378
   static int first_zombie = 1;
 
379
 
 
380
   if ((full_listing & QSTAT_DISPLAY_PENDING) && 
 
381
       (full_listing & QSTAT_DISPLAY_FULL)) {
 
382
      if (first_pending) {
 
383
         first_pending = 0;
 
384
         printf("\n############################################################################%s\n",
 
385
            sge_ext?hashes:"");
 
386
         printf("%s\n", MSG_QSTAT_PRT_PEDINGJOBS);
 
387
         printf("############################################################################%s\n",
 
388
            sge_ext?hashes:"");
 
389
      }
 
390
   } 
 
391
   if ((full_listing & QSTAT_DISPLAY_ZOMBIES) &&
 
392
       (full_listing & QSTAT_DISPLAY_FULL)) {
 
393
      if (first_zombie) {
 
394
         first_zombie = 0;
 
395
         printf("\n############################################################################%s\n", sge_ext?hashes:"");
 
396
         printf("%s\n", MSG_QSTAT_PRT_FINISHEDJOBS);
 
397
         printf("############################################################################%s\n", sge_ext?hashes:""); 
 
398
      }
 
399
   }
 
400
}
 
401
 
 
402
#define OPTI_PRINT8(value) \
 
403
   if (value > 99999999 ) \
 
404
      printf("%8.3g ", value); \
 
405
   else  \
 
406
      printf("%8.0f ", value)
 
407
 
 
408
/* regular output */
 
409
static char jhul1[] = "---------------------------------------------------------------------------------------------";
 
410
/* -g t */
 
411
static char jhul2[] = "-";
 
412
/* -ext */
 
413
static char jhul3[] = "-------------------------------------------------------------------------------";
 
414
/* -t */
 
415
static char jhul4[] = "-----------------------------------------------------";
 
416
/* -urg */
 
417
static char jhul5[] = "----------------------------------------------------------------";
 
418
/* -pri */
 
419
static char jhul6[] = "-----------------------------------";
 
420
 
 
421
static int sge_print_job(
 
422
lListElem *job,
 
423
lListElem *jatep,
 
424
lListElem *qep,
 
425
int print_jobid,
 
426
char *master,
 
427
dstring *dyn_task_str,
 
428
u_long32 full_listing,
 
429
int slots,
 
430
int slot,
 
431
lList *exechost_list,
 
432
lList *centry_list,
 
433
const lList *pe_list,
 
434
char *indent,
 
435
u_long32 group_opt,
 
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,
 
440
lList **alpp
 
441
) {
 
442
   char state_string[8];
 
443
   static int first_time = 1;
 
444
   u_long32 jstate;
 
445
   int sge_urg, sge_pri, sge_ext, sge_time;
 
446
   lList *ql = NULL;
 
447
   lListElem *qrep, *gdil_ep=NULL;
 
448
   int running;
 
449
   const char *queue_name = NULL;
 
450
   const char *cqname = NULL;
 
451
   int tsk_ext;
 
452
   u_long tickets,otickets,stickets,ftickets;
 
453
   int is_zombie_job;
 
454
   dstring ds;
 
455
   char buffer[128];
 
456
   dstring queue_name_buffer = DSTRING_INIT;
 
457
   char jobid[128];
 
458
   int ret = QHOST_SUCCESS; 
 
459
 
 
460
   DENTER(TOP_LAYER, "sge_print_job");
 
461
 
 
462
   sge_dstring_init(&ds, buffer, sizeof(buffer));
 
463
 
 
464
   is_zombie_job = job_is_zombie_job(job);
 
465
 
 
466
   if (qep != NULL) {
 
467
      queue_name = qinstance_get_name(qep, &queue_name_buffer);
 
468
      cqname = lGetString(qep, QU_qname);
 
469
   }
 
470
 
 
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);
 
475
   sge_time = !sge_ext;
 
476
   sge_time = sge_time | tsk_ext | sge_urg | sge_pri;
 
477
 
 
478
 
 
479
   if (!report_handler) {
 
480
      if (first_time) {
 
481
         first_time = 0;
 
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);
 
489
            {
 
490
               int i;
 
491
               for(i=0; i<line_length; i++){
 
492
                  seperator[i] = '-';
 
493
               }
 
494
            }
 
495
            seperator[line_length-1] = '\0';
 
496
            sprintf(part6, "%s%d%s%d%s", part1, queue_name_length, part3, queue_name_length, part5);
 
497
         
 
498
            printf(part6,
 
499
                     indent,
 
500
                     "job-ID",
 
501
                     "prior ",
 
502
                  (sge_pri||sge_urg)?" nurg   ":"",
 
503
                  sge_pri?" npprior":"",
 
504
                  (sge_pri||sge_ext)?" ntckts ":"",
 
505
                  sge_urg?" urg      rrcontr  wtcontr  dlcontr ":"",
 
506
                  sge_pri?"  ppri":"",
 
507
                     "name",
 
508
                     "user",
 
509
                  sge_ext?"project          department ":"",
 
510
                     "state",
 
511
                  sge_time?"submit/start at     ":"",
 
512
                  sge_urg ? " deadline           " : "",
 
513
                  sge_ext ? USAGE_ATTR_CPU "        " USAGE_ATTR_MEM "     " USAGE_ATTR_IO "      " : "",
 
514
                  sge_ext?"tckts ":"",
 
515
                  sge_ext?"ovrts ":"",
 
516
                  sge_ext?"otckt ":"",
 
517
                  sge_ext?"ftckt ":"",
 
518
                  sge_ext?"stckt ":"",
 
519
                  sge_ext?"share ":"",
 
520
                     "queue",
 
521
                  (group_opt & GROUP_NO_PETASK_GROUPS)?"master":"slots",
 
522
                     "ja-task-ID ", 
 
523
                  tsk_ext?"task-ID ":"",
 
524
                  tsk_ext?"state ":"",
 
525
                  tsk_ext?USAGE_ATTR_CPU "        " USAGE_ATTR_MEM "     " USAGE_ATTR_IO "      " : "",
 
526
                  tsk_ext?"stat ":"",
 
527
                  tsk_ext?"failed ":"" );
 
528
 
 
529
            printf("\n%s%s%s%s%s%s%s%s\n", indent, 
 
530
                  jhul1, 
 
531
                  seperator,
 
532
                  (group_opt & GROUP_NO_PETASK_GROUPS)?jhul2:"",
 
533
                  sge_ext ? jhul3 : "", 
 
534
                  tsk_ext ? jhul4 : "",
 
535
                  sge_urg ? jhul5 : "",
 
536
                  sge_pri ? jhul6 : "");
 
537
                  
 
538
            FREE(part6);
 
539
            FREE(seperator);               
 
540
         }
 
541
      }
 
542
 
 
543
      printf("%s", indent);
 
544
 
 
545
      /* job number / ja task id */
 
546
      if (print_jobid) {
 
547
         printf("%7d ", (int)lGetUlong(job, JB_job_number)); 
 
548
      } else {
 
549
         printf("        "); 
 
550
      }   
 
551
   } else {
 
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 ) {
 
555
         DRETURN(ret);
 
556
      }
 
557
   }
 
558
 
 
559
 
 
560
   /* per job priority information */
 
561
   {
 
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) {
 
565
            DRETURN(ret);
 
566
         }
 
567
      } else {
 
568
         if (print_jobid) {
 
569
            printf("%7.5f ", lGetDouble(jatep, JAT_prio)); /* nprio 0.0 - 1.0 */
 
570
         } else {
 
571
            printf("        ");
 
572
         }
 
573
      }
 
574
 
 
575
      if (sge_pri || sge_urg) {
 
576
         if (print_jobid) {
 
577
            printf("%7.5f ", lGetDouble(job, JB_nurg)); /* nurg 0.0 - 1.0 */
 
578
         } else {
 
579
            printf("        ");
 
580
         }
 
581
      }
 
582
 
 
583
      if (sge_pri) {
 
584
         if (print_jobid)
 
585
            printf("%7.5f ", lGetDouble(job, JB_nppri)); /* nppri 0.0 - 1.0 */
 
586
         else
 
587
            printf("        ");
 
588
      }
 
589
 
 
590
      if (sge_pri || sge_ext) {
 
591
         if (print_jobid)
 
592
            printf("%7.5f ", lGetDouble(jatep, JAT_ntix)); /* ntix 0.0 - 1.0 */
 
593
         else
 
594
            printf("        ");
 
595
      }
 
596
 
 
597
      if (sge_urg) {
 
598
         if (print_jobid) {
 
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));
 
603
         } else {
 
604
            printf("         "
 
605
                   "         "
 
606
                   "         "
 
607
                   "         ");
 
608
         }
 
609
      } 
 
610
 
 
611
      if (sge_pri) {
 
612
         if (print_jobid) {
 
613
            printf("%5d ", ((int)lGetUlong(job, JB_priority))-BASE_PRIORITY); 
 
614
         } else {
 
615
            printf("         "
 
616
                   "         ");
 
617
         }
 
618
      }
 
619
 
 
620
   } 
 
621
 
 
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 ) {
 
625
         DRETURN(ret);
 
626
      }
 
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 ) {
 
629
         DRETURN(ret);
 
630
      }
 
631
      ret = report_handler->report_job_string_value(report_handler, cqname, jobid, "job_owner", lGetString(job, JB_owner), alpp);
 
632
      if (ret != QHOST_SUCCESS ) {
 
633
         DRETURN(ret);
 
634
      }
 
635
   } else {
 
636
      if (print_jobid) {
 
637
         /* job name */
 
638
         printf("%-10.10s ", lGetString(job, JB_job_name)); 
 
639
 
 
640
         /* job owner */
 
641
         printf("%-12.12s ", lGetString(job, JB_owner)); 
 
642
      } else {
 
643
         printf("           "); 
 
644
         printf("             "); 
 
645
      }
 
646
   }
 
647
 
 
648
   if (sge_ext) {
 
649
      const char *s;
 
650
 
 
651
      if (print_jobid) {
 
652
         /* job project */
 
653
         printf("%-16.16s ", (s=lGetString(job, JB_project))?s:"NA"); 
 
654
         /* job department */
 
655
         printf("%-10.10s ", (s=lGetString(job, JB_department))?s:"NA"); 
 
656
      } else {
 
657
         printf("                 "); 
 
658
         printf("           "); 
 
659
      }
 
660
   }
 
661
 
 
662
   /* move status info into state info */
 
663
   jstate = lGetUlong(jatep, JAT_state);
 
664
   if (lGetUlong(jatep, JAT_status)==JTRANSFERING) {
 
665
      jstate |= JTRANSFERING;
 
666
      jstate &= ~JRUNNING;
 
667
   }
 
668
 
 
669
   if (lGetList(job, JB_jid_predecessor_list) || lGetUlong(jatep, JAT_hold)) {
 
670
      jstate |= JHELD;
 
671
   }
 
672
 
 
673
   if (lGetUlong(jatep, JAT_job_restarted)) {
 
674
      jstate &= ~JWAITING;
 
675
      jstate |= JMIGRATING;
 
676
   }
 
677
 
 
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);
 
681
   } else {
 
682
      if (print_jobid) {
 
683
         /* write states into string */ 
 
684
         job_get_state_string(state_string, jstate);
 
685
         printf("%-5.5s ", state_string); 
 
686
      } else {
 
687
         printf("      "); 
 
688
      }
 
689
   }
 
690
 
 
691
   if (sge_time) {
 
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);
 
695
         } else {
 
696
            report_handler->report_job_ulong_value(report_handler, cqname, jobid, "start_time", lGetUlong(jatep, JAT_start_time), alpp);
 
697
         }
 
698
      } else {
 
699
         if (print_jobid) {
 
700
            /* start/submit time */
 
701
            if (!lGetUlong(jatep, JAT_start_time) ) {
 
702
               printf("%s ", sge_ctime((time_t)lGetUlong(job, JB_submission_time), &ds));
 
703
            }   
 
704
            else {
 
705
   #if 0
 
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)
 
709
                */
 
710
               if (getenv("JAT_stop_initiate_time") && (lGetUlong(jatep, JAT_state) & JDELETED))
 
711
                  printf("%s!", sge_ctime(lGetUlong(jatep, JAT_stop_initiate_time), &ds));
 
712
               else
 
713
   #endif
 
714
                  printf("%s ", sge_ctime((time_t)lGetUlong(jatep, JAT_start_time), &ds));
 
715
            }
 
716
         } else {
 
717
            printf("                    "); 
 
718
         }
 
719
      }
 
720
   }
 
721
 
 
722
   /* is job logically running */
 
723
   running = lGetUlong(jatep, JAT_status)==JRUNNING || 
 
724
      lGetUlong(jatep, JAT_status)==JTRANSFERING;
 
725
 
 
726
   /* deadline time */
 
727
   if (sge_urg) {
 
728
      if (print_jobid) { 
 
729
         if (!lGetUlong(job, JB_deadline) )
 
730
            printf("                    ");
 
731
         else
 
732
            printf("%s ", sge_ctime((time_t)lGetUlong(job, JB_deadline), &ds));
 
733
      } else {
 
734
         printf("                    "); 
 
735
      }
 
736
   }
 
737
 
 
738
   if (sge_ext) {
 
739
      lListElem *up, *pe, *task;
 
740
      lList *job_usage_list;
 
741
      const char *pe_name;
 
742
      
 
743
      if (!master || !strcmp(master, "MASTER"))
 
744
         job_usage_list = lCopyList(NULL, lGetList(jatep, JAT_scaled_usage_list));
 
745
      else
 
746
         job_usage_list = lCreateList("", UA_Type);
 
747
 
 
748
      /* sum pe-task usage based on queue slots */
 
749
      if (job_usage_list) {
 
750
         int subtask_ndx=1;
 
751
         for_each(task, lGetList(jatep, JAT_task_list)) {
 
752
            lListElem *dst, *src, *ep;
 
753
            const char *qname;
 
754
 
 
755
            if (!slots ||
 
756
                (queue_name && 
 
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));
 
763
                  else
 
764
                     lAppendElem(job_usage_list, lCopyElem(src));
 
765
               }
 
766
            }
 
767
         }
 
768
      }
 
769
 
 
770
 
 
771
      /* scaled cpu usage */
 
772
      if (!(up = lGetElemStr(job_usage_list, UA_name, USAGE_ATTR_CPU))) 
 
773
         printf("%-10.10s ", running?"NA":""); 
 
774
      else {
 
775
         int secs, minutes, hours, days;
 
776
 
 
777
         secs = lGetDouble(up, UA_value);
 
778
 
 
779
         days    = secs/(60*60*24);
 
780
         secs   -= days*(60*60*24);
 
781
 
 
782
         hours   = secs/(60*60);
 
783
         secs   -= hours*(60*60);
 
784
 
 
785
         minutes = secs/60;
 
786
         secs   -= minutes*60;
 
787
      
 
788
         printf("%d:%2.2d:%2.2d:%2.2d ", days, hours, minutes, secs); 
 
789
      } 
 
790
      /* scaled mem usage */
 
791
      if (!(up = lGetElemStr(job_usage_list, UA_name, USAGE_ATTR_MEM))) 
 
792
         printf("%-7.7s ", running?"NA":""); 
 
793
      else
 
794
         printf("%-5.5f ", lGetDouble(up, UA_value)); 
 
795
  
 
796
      /* scaled io usage */
 
797
      if (!(up = lGetElemStr(job_usage_list, UA_name, USAGE_ATTR_IO))) 
 
798
         printf("%-7.7s ", running?"NA":""); 
 
799
      else
 
800
         printf("%-5.5f ", lGetDouble(up, UA_value)); 
 
801
 
 
802
      lFreeList(&job_usage_list);
 
803
 
 
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))) {
 
811
         if (slot == 0) {
 
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);
 
816
         }
 
817
         else {
 
818
            if (slots) {
 
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);
 
823
            } 
 
824
            else {
 
825
               tickets = otickets = ftickets = stickets = 0;
 
826
            }
 
827
         }
 
828
      }
 
829
      else {
 
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);
 
834
      }
 
835
 
 
836
 
 
837
      /* report jobs dynamic scheduling attributes */
 
838
      /* only scheduled have these attribute */
 
839
      /* Pending jobs can also have tickets */
 
840
      if (is_zombie_job) {
 
841
         printf("   NA ");
 
842
         printf("   NA ");
 
843
         printf("   NA ");
 
844
         printf("   NA ");
 
845
         printf("   NA ");
 
846
         printf("   NA ");
 
847
      } else {
 
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)); 
 
855
         } else {
 
856
            printf("      "); 
 
857
            printf("      "); 
 
858
            printf("      "); 
 
859
            printf("      "); 
 
860
            printf("      "); 
 
861
            printf("      "); 
 
862
            printf("      "); 
 
863
         }
 
864
      }
 
865
   }
 
866
 
 
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);
 
871
      } else {
 
872
         char temp[20];
 
873
         sprintf(temp,"%%-%d.%ds ", queue_name_length, queue_name_length);
 
874
         printf(temp, queue_name?queue_name:"");
 
875
      }
 
876
   }
 
877
 
 
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);
 
882
      } else {
 
883
         if (master) {
 
884
            printf("%-7.6s", master);
 
885
         } else {
 
886
            printf("       ");
 
887
         }
 
888
      }   
 
889
   } else {
 
890
      /* job slots requested/granted */
 
891
      if (!slots_per_line) {
 
892
         slots_per_line = sge_job_slot_request(job, pe_list);
 
893
      }   
 
894
      printf("%5d ", slots_per_line);
 
895
   }
 
896
 
 
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 ) {
 
902
            DRETURN(ret);
 
903
         }
 
904
      }
 
905
   } else {
 
906
      if (sge_dstring_get_string(dyn_task_str) && job_is_array(job)) {
 
907
         printf("%s", sge_dstring_get_string(dyn_task_str)); 
 
908
      } else {
 
909
         printf("       ");
 
910
      }
 
911
   }
 
912
   
 
913
   if (tsk_ext) {
 
914
      lList *task_list = lGetList(jatep, JAT_task_list);
 
915
      lListElem *task, *ep;
 
916
      const char *qname;
 
917
      int indent=0;
 
918
      int subtask_ndx=1;
 
919
      int num_spaces = sizeof(jhul1)-1 + (sge_ext?sizeof(jhul2)-1:0) - 
 
920
            ((full_listing & QSTAT_DISPLAY_FULL)?11:0);
 
921
 
 
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)) {
 
927
         if (indent++) {
 
928
            printf("%*s", num_spaces, " ");
 
929
         }   
 
930
         sge_print_subtask(job, jatep, NULL, 0, 0);
 
931
         /* subtask_ndx++; */
 
932
      }
 
933
         
 
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))) {
 
940
            if (indent++) {
 
941
               printf("%*s", num_spaces, " ");
 
942
            }   
 
943
            sge_print_subtask(job, jatep, task, 0, 0);
 
944
         }
 
945
      }
 
946
 
 
947
      if (!indent) {
 
948
         putchar('\n');
 
949
      }
 
950
 
 
951
   } else {
 
952
      if (!report_handler) {
 
953
         /* print a new line */
 
954
         putchar('\n');
 
955
      } else {
 
956
         ret = report_handler->report_job_finished(report_handler, cqname, jobid, alpp);
 
957
         if (ret != QHOST_SUCCESS ) {
 
958
            DRETURN(ret);
 
959
         }
 
960
      }   
 
961
   }
 
962
 
 
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));
 
966
 
 
967
         if(queue_name) {
 
968
            printf(QSTAT_INDENT "Master queue:     %s\n", queue_name);
 
969
         }
 
970
 
 
971
         if (lGetString(job, JB_pe)) {
 
972
            dstring range_string = DSTRING_INIT;
 
973
 
 
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);
 
979
         }
 
980
         if (lGetString(jatep, JAT_granted_pe)) {
 
981
            lListElem *gdil_ep;
 
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); 
 
987
         }
 
988
         if (lGetString(job, JB_checkpoint_name)) 
 
989
            printf(QSTAT_INDENT "Checkpoint Env.:  %s\n", 
 
990
               lGetString(job, JB_checkpoint_name)); 
 
991
 
 
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)); 
 
995
 
 
996
         /* display default requests if necessary */
 
997
         {
 
998
            lList *attributes = NULL;
 
999
            lListElem *ce;
 
1000
            const char *name;
 
1001
            lListElem *hep;
 
1002
 
 
1003
            queue_complexes2scheduler(&attributes, qep, exechost_list, centry_list);
 
1004
            for_each (ce, attributes) {
 
1005
               double dval;
 
1006
 
 
1007
               name = lGetString(ce, CE_name);
 
1008
               if (!lGetBool(ce, CE_consumable) || !strcmp(name, "slots") || 
 
1009
                   job_get_request(job, name))
 
1010
                  continue;
 
1011
 
 
1012
               parse_ulong_val(&dval, NULL, lGetUlong(ce, CE_valtype), lGetString(ce, CE_default), NULL, 0); 
 
1013
               if (dval == 0.0)
 
1014
                  continue;
 
1015
 
 
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)))
 
1024
 
 
1025
               printf("%s%s=%s (default)\n", QSTAT_INDENT, name, lGetString(ce, CE_default));      
 
1026
            }
 
1027
            lFreeList(&attributes);
 
1028
         }
 
1029
 
 
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); 
 
1032
 
 
1033
         ql = lGetList(job, JB_hard_queue_list);
 
1034
         if (ql) {
 
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");
 
1039
            }
 
1040
         }
 
1041
 
 
1042
         ql = lGetList(job, JB_soft_queue_list);
 
1043
         if (ql) {
 
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");
 
1048
            }
 
1049
         }
 
1050
         ql = lGetList(job, JB_master_hard_queue_list);
 
1051
         if (ql){
 
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");
 
1056
            }
 
1057
         }
 
1058
         ql = lGetList(job, JB_jid_request_list );
 
1059
         if (ql) {
 
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");
 
1064
            }
 
1065
         }
 
1066
         ql = lGetList(job, JB_jid_predecessor_list);
 
1067
         if (ql) {
 
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");
 
1072
            }
 
1073
         }
 
1074
         ql = lGetList(job, JB_ja_ad_request_list );
 
1075
         if (ql) {
 
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");
 
1080
            }
 
1081
         }
 
1082
         ql = lGetList(job, JB_ja_ad_predecessor_list);
 
1083
         if (ql) {
 
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");
 
1088
            }
 
1089
         }
 
1090
   }
 
1091
 
 
1092
#undef QSTAT_INDENT
 
1093
#undef QSTAT_INDENT2
 
1094
 
 
1095
   sge_dstring_free(&queue_name_buffer);
 
1096
 
 
1097
   DRETURN(1);
 
1098
}