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

« back to all changes in this revision

Viewing changes to source/clients/common/sge_qstat.h

  • 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
#ifndef __SGE_QSTAT_H
 
2
#define __SGE_QSTAT_H
 
3
/*___INFO__MARK_BEGIN__*/
 
4
/*************************************************************************
 
5
 * 
 
6
 *  The Contents of this file are made available subject to the terms of
 
7
 *  the Sun Industry Standards Source License Version 1.2
 
8
 * 
 
9
 *  Sun Microsystems Inc., March, 2001
 
10
 * 
 
11
 * 
 
12
 *  Sun Industry Standards Source License Version 1.2
 
13
 *  =================================================
 
14
 *  The contents of this file are subject to the Sun Industry Standards
 
15
 *  Source License Version 1.2 (the "License"); You may not use this file
 
16
 *  except in compliance with the License. You may obtain a copy of the
 
17
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 
18
 * 
 
19
 *  Software provided under this License is provided on an "AS IS" basis,
 
20
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 
21
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 
22
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 
23
 *  See the License for the specific provisions governing your rights and
 
24
 *  obligations concerning the Software.
 
25
 * 
 
26
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 
27
 * 
 
28
 *   Copyright: 2001 by Sun Microsystems, Inc.
 
29
 * 
 
30
 *   All Rights Reserved.
 
31
 * 
 
32
 ************************************************************************/
 
33
/*___INFO__MARK_END__*/
 
34
 
 
35
#ifdef  __cplusplus
 
36
extern "C" {
 
37
#endif
 
38
 
 
39
#include "sge_gdi_ctx.h"
 
40
 
 
41
typedef struct qstat_env_str qstat_env_t;
 
42
 
 
43
struct qstat_env_str {
 
44
   sge_gdi_ctx_class_t *ctx;
 
45
 
 
46
   /*  Input parameters */
 
47
   lList *resource_list;   /* -l resource_request           */ 
 
48
   lList *qresource_list;  /* -F qresource_request          */
 
49
   lList* queueref_list;   /* -q queue_list                 */
 
50
   lList* peref_list;      /* -pe pe_list                   */
 
51
   lList* user_list;       /* -u user_list - selects jobs   */
 
52
   lList* queue_user_list; /* -U user_list - selects queues */
 
53
   u_long32 full_listing;  /* -ext      */
 
54
   u_long32 qselect_mode;  /* called as qselect */
 
55
   u_long32 group_opt;     /* -g        */
 
56
   u_long32 queue_state;   /* -qs       */
 
57
   u_long32 explain_bits;  /* -explain  */
 
58
   u_long32 job_info;      /* -j        */
 
59
   
 
60
   /* Needed lists */
 
61
   lList* queue_list;
 
62
   lList* centry_list;
 
63
   lList* exechost_list;
 
64
   lList* schedd_config;
 
65
   lList* pe_list;
 
66
   lList* ckpt_list;
 
67
   lList* acl_list;
 
68
   lList* zombie_list;
 
69
   lList* job_list;
 
70
   lList* hgrp_list;
 
71
   lList* project_list;
 
72
   
 
73
   bool need_queues;
 
74
   
 
75
   int (*shut_me_down)(void);
 
76
   u_long32 global_showjobs;
 
77
   u_long32 global_showqueues;
 
78
   
 
79
   /* 
 
80
   ** number of slots to be printed in slots column when 0 i
 
81
   ** is passed the number of requested slots printed
 
82
   */
 
83
   int slots_per_line;
 
84
   
 
85
   /* length of the longest queue name */   
 
86
   int longest_queue_length;
 
87
   
 
88
   
 
89
   lEnumeration *what_JB_Type;
 
90
   lEnumeration *what_JAT_Type_template;
 
91
   lEnumeration *what_JAT_Type_list;
 
92
   
 
93
};
 
94
 
 
95
 
 
96
typedef struct qselect_handler_str qselect_handler_t;
 
97
 
 
98
struct qselect_handler_str {
 
99
   void *ctx;
 
100
   
 
101
   int (*report_started)(qselect_handler_t *thiz, lList** alpp);
 
102
   int (*report_finished)(qselect_handler_t *thiz, lList** alpp);
 
103
   int (*report_queue)(qselect_handler_t *thiz, const char* qname, lList** alpp);
 
104
   int (*destroy)(qselect_handler_t *thiz, lList** alpp);
 
105
};
 
106
 
 
107
int qselect(qstat_env_t* qstat_env, qselect_handler_t *handler, lList **alpp);
 
108
 
 
109
/* ------------- Cluster Queue Summary -------------------------------------- */
 
110
/* qstat -g c                                                                 */
 
111
 
 
112
typedef struct cqueue_summary_str cqueue_summary_t;
 
113
 
 
114
struct cqueue_summary_str {
 
115
   double load;
 
116
   bool   is_load_available;
 
117
   u_long32 used;
 
118
   u_long32 resv;
 
119
   u_long32 total;
 
120
   u_long32 temp_disabled; 
 
121
   u_long32 available; 
 
122
   u_long32 manual_intervention;
 
123
   u_long32 suspend_manual; 
 
124
   u_long32 suspend_threshold; 
 
125
   u_long32 suspend_on_subordinate;
 
126
   u_long32 suspend_calendar; 
 
127
   u_long32 unknown, load_alarm;
 
128
   u_long32 disabled_manual; 
 
129
   u_long32 disabled_calendar; 
 
130
   u_long32 ambiguous;
 
131
   u_long32 orphaned, error;
 
132
};
 
133
 
 
134
typedef struct cqueue_summary_handler_str cqueue_summary_handler_t;
 
135
 
 
136
struct cqueue_summary_handler_str {
 
137
   void *ctx;
 
138
   qstat_env_t *qstat_env;
 
139
   
 
140
   int (*report_started)(cqueue_summary_handler_t *thiz, lList **alpp);
 
141
   int (*report_finished)(cqueue_summary_handler_t *thiz, lList **alpp);
 
142
   
 
143
   int (*report_cqueue)(cqueue_summary_handler_t *thiz, const char* cqname, cqueue_summary_t *summary, lList **alpp);
 
144
   
 
145
   int (*destroy)(cqueue_summary_handler_t *thiz);
 
146
};
 
147
 
 
148
int qstat_cqueue_summary(qstat_env_t* qstat_env, cqueue_summary_handler_t *handler, lList **alpp);
 
149
 
 
150
/* ---------------- QStat queue/job handling ---------------------------------*/
 
151
 
 
152
typedef struct queue_summary_str queue_summary_t;
 
153
 
 
154
struct queue_summary_str {
 
155
   
 
156
   const char* queue_type;
 
157
   
 
158
   u_long32    used_slots;
 
159
   u_long32    resv_slots;
 
160
   u_long32    free_slots;
 
161
   
 
162
   const char* arch;
 
163
   const char* state;
 
164
   
 
165
   const char* load_avg_str;
 
166
   bool has_load_value;
 
167
   bool has_load_value_from_object;
 
168
   double load_avg;
 
169
   
 
170
};
 
171
 
 
172
typedef struct job_summary_str job_summary_t;
 
173
 
 
174
struct job_summary_str {
 
175
   bool print_jobid;
 
176
   u_long32 priority;
 
177
   double nurg;
 
178
   double urg;
 
179
   double nppri;
 
180
   double nprior;
 
181
   double ntckts;
 
182
   double rrcontr;
 
183
   double wtcontr;
 
184
   double dlcontr;
 
185
   const char* name;
 
186
   const char* user;
 
187
   const char* project;
 
188
   const char* department;
 
189
   char state[8];
 
190
   time_t submit_time;
 
191
   time_t start_time;
 
192
   time_t stop_initiate_time;
 
193
   time_t deadline;
 
194
   
 
195
   bool   has_cpu_usage;
 
196
   u_long32 cpu_usage;
 
197
   bool   has_mem_usage;
 
198
   double mem_usage;
 
199
   bool   has_io_usage;
 
200
   double io_usage;
 
201
   
 
202
   bool   is_zombie;
 
203
   u_long override_tickets;
 
204
   bool   is_queue_assigned;
 
205
   u_long tickets;
 
206
   u_long otickets;
 
207
   u_long ftickets;
 
208
   u_long stickets;
 
209
 
 
210
   double share;
 
211
   const char* queue;
 
212
   const char* master;
 
213
   u_long32 slots;
 
214
   bool is_array;
 
215
   bool is_running;
 
216
   const char* task_id;
 
217
   
 
218
};
 
219
 
 
220
typedef enum {
 
221
   JOB_ADDITIONAL_INFO_ERROR = 0,
 
222
   CHECKPOINT_ENV  = 1,
 
223
   MASTER_QUEUE    = 2,
 
224
   FULL_JOB_NAME   = 3
 
225
} job_additional_info_t;
 
226
 
 
227
typedef struct task_summary_str task_summary_t;
 
228
 
 
229
struct task_summary_str {
 
230
   const char* task_id;
 
231
   const char* state;
 
232
   bool has_cpu_usage;
 
233
   double cpu_usage;
 
234
   bool has_mem_usage;
 
235
   double mem_usage;
 
236
   bool has_io_usage;
 
237
   double io_usage;
 
238
   bool is_running;
 
239
   bool has_exit_status;
 
240
   u_long32 exit_status;
 
241
};
 
242
 
 
243
typedef struct job_handler_str job_handler_t;
 
244
 
 
245
struct job_handler_str {
 
246
 
 
247
  void *ctx;
 
248
  qstat_env_t *qstat_env;
 
249
  
 
250
  int(*report_job)(job_handler_t* handler, u_long32 jid, job_summary_t *summary, lList **alpp);
 
251
  
 
252
  int (*report_sub_tasks_started)(job_handler_t* handler, lList **alpp);
 
253
  int (*report_sub_task)(job_handler_t* handler, task_summary_t *summary, lList **alpp);
 
254
  int (*report_sub_tasks_finished)(job_handler_t* handler, lList **alpp);
 
255
  
 
256
  int (*report_additional_info)(job_handler_t *handler, job_additional_info_t name, const char* value, lList **alpp);
 
257
  
 
258
  int (*report_requested_pe)(job_handler_t *handler, const char* pe_name, const char* pe_range, lList **alpp);
 
259
  int (*report_granted_pe)(job_handler_t *handler, const char* pe_name, int pe_slots, lList **alpp);
 
260
  
 
261
  int (*report_request)(job_handler_t* handler, const char* name, const char* value, lList **alpp);
 
262
  
 
263
  int (*report_hard_resources_started)(job_handler_t* handler, lList **alpp);
 
264
  int (*report_hard_resource)(job_handler_t *handler, const char* name, const char* value, double uc, lList **alpp);
 
265
  int (*report_hard_resources_finished)(job_handler_t* handler, lList **alpp);
 
266
  
 
267
  int (*report_soft_resources_started)(job_handler_t* handler, lList **alpp);
 
268
  /* RH TODO: the soft resource/request has no contribution => remove the parameter uc */
 
269
  int (*report_soft_resource)(job_handler_t *handler, const char* name, const char* value, double uc, lList **alpp);
 
270
  int (*report_soft_resources_finished)(job_handler_t* handler, lList **alpp);
 
271
  
 
272
  int (*report_hard_requested_queues_started)(job_handler_t *handler, lList **alpp);
 
273
  int (*report_hard_requested_queue)(job_handler_t *handler, const char* name, lList **alpp);
 
274
  int (*report_hard_requested_queues_finished)(job_handler_t *handler, lList **alpp);
 
275
  
 
276
  int (*report_soft_requested_queues_started)(job_handler_t *handler, lList **alpp);
 
277
  int (*report_soft_requested_queue)(job_handler_t *handler, const char* name, lList **alpp);
 
278
  int (*report_soft_requested_queues_finished)(job_handler_t *handler, lList **alpp);
 
279
  
 
280
  int (*report_master_hard_requested_queues_started)(job_handler_t* handler, lList **alpp);
 
281
  int (*report_master_hard_requested_queue)(job_handler_t* handler, const char* name, lList **alpp);
 
282
  int (*report_master_hard_requested_queues_finished)(job_handler_t* handler, lList **alpp);
 
283
  
 
284
  int (*report_predecessors_requested_started)(job_handler_t* handler, lList **alpp);
 
285
  int (*report_predecessor_requested)(job_handler_t* handler, const char* name, lList **alpp);
 
286
  int (*report_predecessors_requested_finished)(job_handler_t* handler, lList **alpp);
 
287
  
 
288
  int (*report_predecessors_started)(job_handler_t* handler, lList **alpp);
 
289
  int (*report_predecessor)(job_handler_t* handler, u_long32 jid, lList **alpp);
 
290
  int (*report_predecessors_finished)(job_handler_t* handler, lList **alpp);
 
291
  
 
292
  int (*report_ad_predecessors_requested_started)(job_handler_t* handler, lList **alpp);
 
293
  int (*report_ad_predecessor_requested)(job_handler_t* handler, const char* name, lList **alpp);
 
294
  int (*report_ad_predecessors_requested_finished)(job_handler_t* handler, lList **alpp);
 
295
  
 
296
  int (*report_ad_predecessors_started)(job_handler_t* handler, lList **alpp);
 
297
  int (*report_ad_predecessor)(job_handler_t* handler, u_long32 jid, lList **alpp);
 
298
  int (*report_ad_predecessors_finished)(job_handler_t* handler, lList **alpp);
 
299
 
 
300
  int (*report_job_finished)(job_handler_t* handler, u_long32 jid, lList **alpp);
 
301
  
 
302
   
 
303
};
 
304
 
 
305
typedef struct qstat_handler_str qstat_handler_t;
 
306
 
 
307
struct qstat_handler_str {
 
308
  void *ctx;
 
309
  qstat_env_t *qstat_env;
 
310
  
 
311
  int (*report_started)(qstat_handler_t* handler, lList** alpp);
 
312
  int (*report_finished)(qstat_handler_t* hanlder, lList** alpp);
 
313
  
 
314
  int (*report_queue_started)(qstat_handler_t *handler, const char* qname, lList **alpp);
 
315
  int (*report_queue_summary)(qstat_handler_t *handler, const char* qname,  queue_summary_t *summary, lList **alpp);
 
316
  int (*report_queue_load_alarm)(qstat_handler_t* handler, const char* qname, const char* reason, lList **alpp);
 
317
  int (*report_queue_suspend_alarm)(qstat_handler_t* handler, const char* qname, const char* reason, lList **alpp);
 
318
  int (*report_queue_message)(qstat_handler_t* handler, const char* qname, const char *message, lList **alpp);
 
319
  
 
320
  int (*report_queue_resource)(qstat_handler_t* handler, const char* dom, const char* name, const char* value, lList **alpp);
 
321
  
 
322
  job_handler_t job_handler;
 
323
  
 
324
  int (*report_queue_jobs_started)(qstat_handler_t *handler, const char* qname, lList **alpp);
 
325
  int (*report_queue_jobs_finished)(qstat_handler_t *handler, const char* qname, lList **alpp);
 
326
 
 
327
  int (*report_queue_finished)(qstat_handler_t* handler, const char* qname, lList **alpp);
 
328
 
 
329
  int (*report_pending_jobs_started)(qstat_handler_t *handler, lList **alpp);
 
330
  int (*report_pending_jobs_finished)(qstat_handler_t *handler, lList **alpp);
 
331
  int (*report_finished_jobs_started)(qstat_handler_t *handler, lList **alpp);
 
332
  int (*report_finished_jobs_finished)(qstat_handler_t *handler, lList **alpp);
 
333
  int (*report_error_jobs_started)(qstat_handler_t *handler, lList **alpp);
 
334
  int (*report_error_jobs_finished)(qstat_handler_t *handler, lList **alpp);
 
335
  int (*report_zombie_jobs_started)(qstat_handler_t *handler, lList **alpp);
 
336
  int (*report_zombie_jobs_finished)(qstat_handler_t *handler, lList **alpp);
 
337
  
 
338
  
 
339
  int (*destroy)(qstat_handler_t* handler);
 
340
};
 
341
 
 
342
 
 
343
 
 
344
int qstat_no_group(qstat_env_t* qstat_env, qstat_handler_t* handler, lList **alpp);
 
345
 
 
346
 
 
347
void qstat_env_destroy(qstat_env_t *qstat_env);
 
348
 
 
349
const char* sge_get_dominant_stringval(lListElem *rep, u_long32 *dominant_p, dstring *resource_string_p);
 
350
 
 
351
int filter_queues(lList **filtered_queue_list,
 
352
                  lList *queue_list, 
 
353
                  lList *centry_list,
 
354
                  lList *hgrp_list,
 
355
                  lList *exechost_list,
 
356
                  lList *acl_list,
 
357
                  lList *prj_list,
 
358
                  lList *pe_list,
 
359
                  lList *resource_list, 
 
360
                  lList *queueref_list, 
 
361
                  lList *peref_list, 
 
362
                  lList *queue_user_list,
 
363
                  u_long32 queue_states,
 
364
                  lList **alpp);
 
365
                  
 
366
lCondition *qstat_get_JB_Type_selection(lList *user_list, u_long32 show);
 
367
lEnumeration *qstat_get_JB_Type_filter(qstat_env_t* qstat_env);
 
368
void qstat_filter_add_core_attributes(qstat_env_t* qstat_env);
 
369
void qstat_filter_add_ext_attributes(qstat_env_t* qstat_env);
 
370
void qstat_filter_add_pri_attributes(qstat_env_t* qstat_env);
 
371
void qstat_filter_add_urg_attributes(qstat_env_t* qstat_env);
 
372
void qstat_filter_add_l_attributes(qstat_env_t* qstat_env);
 
373
void qstat_filter_add_q_attributes(qstat_env_t* qstat_env);
 
374
void qstat_filter_add_pe_attributes(qstat_env_t* qstat_env);
 
375
void qstat_filter_add_r_attributes(qstat_env_t *qstat_env);
 
376
void qstat_filter_add_xml_attributes(qstat_env_t *qstat_env);
 
377
void qstat_filter_add_t_attributes(qstat_env_t *qstat_env);
 
378
void qstat_filter_add_U_attributes(qstat_env_t *qstat_env);
 
379
 
 
380
int build_job_state_filter(qstat_env_t *qstat_env, const char* job_state, lList **alpp);
 
381
 
 
382
#ifdef  __cplusplus
 
383
}
 
384
#endif
 
385
 
 
386
#endif
 
387