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