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

« back to all changes in this revision

Viewing changes to source/libs/sgeobj/sge_job.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_JOB_H 
 
2
#define __SGE_JOB_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
#include "sge_htable.h"
 
36
#include "sge_dstring.h"
 
37
#include "sge_jobL.h"
 
38
#include "sge_job_refL.h"
 
39
#include "sge_messageL.h"
 
40
 
 
41
/****** sgeobj/job/jb_now *****************************************************
 
42
*  NAME
 
43
*     jb_now -- macros to handle flag JB_type 
 
44
*
 
45
*  SYNOPSIS
 
46
*
 
47
*     JOB_TYPE_IMMEDIATE
 
48
*     JOB_TYPE_QSH
 
49
*     JOB_TYPE_QLOGIN
 
50
*     JOB_TYPE_QRSH
 
51
*     JOB_TYPE_QRLOGIN
 
52
*        
 
53
*     JOB_TYPE_NO_ERROR
 
54
*        When a job of this type fails and the error condition usually
 
55
*        would result in the job error state the job is finished. Thus
 
56
*        no qmod -c "*" is supported.
 
57
*******************************************************************************/
 
58
 
 
59
#define JOB_TYPE_IMMEDIATE  0x01L
 
60
#define JOB_TYPE_QSH        0x02L
 
61
#define JOB_TYPE_QLOGIN     0x04L
 
62
#define JOB_TYPE_QRSH       0x08L
 
63
#define JOB_TYPE_QRLOGIN    0x10L
 
64
#define JOB_TYPE_NO_ERROR   0x20L
 
65
 
 
66
/* submitted via "qsub -b y" or "qrsh [-b y]" */ 
 
67
#define JOB_TYPE_BINARY     0x40L
 
68
 
 
69
/* array job (qsub -t ...) */
 
70
#define JOB_TYPE_ARRAY      0x80L
 
71
/* Do a raw exec (qsub -noshell) */
 
72
#define JOB_TYPE_NO_SHELL   0x100L
 
73
 
 
74
#define JOB_TYPE_QXXX_MASK \
 
75
   (JOB_TYPE_QSH | JOB_TYPE_QLOGIN | JOB_TYPE_QRSH | JOB_TYPE_QRLOGIN | JOB_TYPE_NO_ERROR)
 
76
 
 
77
#define JOB_TYPE_STR_IMMEDIATE  "IMMEDIATE"
 
78
#define JOB_TYPE_STR_QSH        "INTERACTIVE"
 
79
#define JOB_TYPE_STR_QLOGIN     "QLOGIN"
 
80
#define JOB_TYPE_STR_QRSH       "QRSH"
 
81
#define JOB_TYPE_STR_QRLOGIN    "QRLOGIN"
 
82
#define JOB_TYPE_STR_NO_ERROR   "NO_ERROR"
 
83
 
 
84
#define JOB_TYPE_CLEAR_IMMEDIATE(jb_now) \
 
85
   jb_now = jb_now & ~JOB_TYPE_IMMEDIATE 
 
86
 
 
87
#define JOB_TYPE_SET_IMMEDIATE(jb_now) \
 
88
   jb_now =  jb_now | JOB_TYPE_IMMEDIATE
 
89
 
 
90
#define JOB_TYPE_SET_QSH(jb_now) \
 
91
   jb_now = (jb_now & (~JOB_TYPE_QXXX_MASK)) | JOB_TYPE_QSH
 
92
 
 
93
#define JOB_TYPE_SET_QLOGIN(jb_now) \
 
94
   jb_now = (jb_now & (~JOB_TYPE_QXXX_MASK)) | JOB_TYPE_QLOGIN
 
95
 
 
96
#define JOB_TYPE_SET_QRSH(jb_now) \
 
97
   jb_now = (jb_now & ~JOB_TYPE_QXXX_MASK) | JOB_TYPE_QRSH
 
98
 
 
99
#define JOB_TYPE_SET_QRLOGIN(jb_now) \
 
100
   jb_now = (jb_now & ~JOB_TYPE_QXXX_MASK) | JOB_TYPE_QRLOGIN
 
101
 
 
102
#define JOB_TYPE_SET_BINARY(jb_now) \
 
103
   jb_now = jb_now | JOB_TYPE_BINARY
 
104
 
 
105
#define JOB_TYPE_SET_ARRAY(jb_now) \
 
106
   jb_now = jb_now | JOB_TYPE_ARRAY
 
107
 
 
108
#define JOB_TYPE_CLEAR_NO_ERROR(jb_now) \
 
109
   jb_now = jb_now & ~JOB_TYPE_NO_ERROR
 
110
 
 
111
#define JOB_TYPE_SET_NO_ERROR(jb_now) \
 
112
   jb_now =  jb_now | JOB_TYPE_NO_ERROR
 
113
 
 
114
#define JOB_TYPE_SET_NO_SHELL(jb_now) \
 
115
   jb_now =  jb_now | JOB_TYPE_NO_SHELL
 
116
 
 
117
#define JOB_TYPE_UNSET_BINARY(jb_now) \
 
118
   jb_now = jb_now & ~JOB_TYPE_BINARY
 
119
 
 
120
#define JOB_TYPE_UNSET_NO_SHELL(jb_now) \
 
121
   jb_now =  jb_now & ~JOB_TYPE_NO_SHELL
 
122
 
 
123
#define JOB_TYPE_IS_IMMEDIATE(jb_now)      (jb_now & JOB_TYPE_IMMEDIATE)
 
124
#define JOB_TYPE_IS_QSH(jb_now)            (jb_now & JOB_TYPE_QSH)
 
125
#define JOB_TYPE_IS_QLOGIN(jb_now)         (jb_now & JOB_TYPE_QLOGIN)
 
126
#define JOB_TYPE_IS_QRSH(jb_now)           (jb_now & JOB_TYPE_QRSH)
 
127
#define JOB_TYPE_IS_QRLOGIN(jb_now)        (jb_now & JOB_TYPE_QRLOGIN)
 
128
#define JOB_TYPE_IS_BINARY(jb_now)         (jb_now & JOB_TYPE_BINARY)
 
129
#define JOB_TYPE_IS_ARRAY(jb_now)          (jb_now & JOB_TYPE_ARRAY)
 
130
#define JOB_TYPE_IS_NO_ERROR(jb_now)       (jb_now & JOB_TYPE_NO_ERROR)
 
131
#define JOB_TYPE_IS_NO_SHELL(jb_now)       (jb_now & JOB_TYPE_NO_SHELL)
 
132
 
 
133
 
 
134
bool job_is_enrolled(const lListElem *job, 
 
135
                     u_long32 ja_task_number);
 
136
 
 
137
u_long32 job_get_ja_tasks(const lListElem *job);
 
138
 
 
139
u_long32 job_get_not_enrolled_ja_tasks(const lListElem *job);
 
140
 
 
141
u_long32 job_get_enrolled_ja_tasks(const lListElem *job);
 
142
 
 
143
u_long32 job_get_submit_ja_tasks(const lListElem *job);
 
144
 
 
145
lListElem *job_enroll(lListElem *job, lList **answer_list, 
 
146
                      u_long32 task_number);  
 
147
 
 
148
void job_delete_not_enrolled_ja_task(lListElem *job, lList **answer_list,
 
149
                                     u_long32 ja_task_number);
 
150
 
 
151
int job_count_pending_tasks(lListElem *job, bool count_all);
 
152
 
 
153
bool job_has_soft_requests(lListElem *job);
 
154
 
 
155
bool job_is_ja_task_defined(const lListElem *job, u_long32 ja_task_number);
 
156
 
 
157
void job_set_hold_state(lListElem *job, 
 
158
                        lList **answer_list, u_long32 ja_task_id,
 
159
                        u_long32 new_hold_state);
 
160
 
 
161
u_long32 job_get_hold_state(lListElem *job, u_long32 ja_task_id);
 
162
 
 
163
/* int job_add_job(lList **job_list, char *name, lListElem *job, int check,
 
164
                 int hash, htable* Job_Hash_Table); */
 
165
 
 
166
void job_list_print(lList *job_list);
 
167
 
 
168
lListElem *job_get_ja_task_template(const lListElem *job, u_long32 ja_task_id); 
 
169
 
 
170
lListElem *job_get_ja_task_template_hold(const lListElem *job,
 
171
                                         u_long32 ja_task_id, 
 
172
                                         u_long32 hold_state);
 
173
 
 
174
lListElem *job_get_ja_task_template_pending(const lListElem *job,
 
175
                                            u_long32 ja_task_id);
 
176
 
 
177
lListElem *job_search_task(const lListElem *job, lList **answer_list, u_long32 ja_task_id);
 
178
lListElem *job_create_task(lListElem *job, lList **answer_list, u_long32 ja_task_id);
 
179
 
 
180
void job_add_as_zombie(lListElem *zombie, lList **answer_list, 
 
181
                       u_long32 ja_task_id);
 
182
 
 
183
int job_list_add_job(lList **job_list, const char *name, lListElem *job, 
 
184
                     int check); 
 
185
 
 
186
u_long32 job_get_ja_task_hold_state(const lListElem *job, u_long32 ja_task_id);
 
187
 
 
188
void job_destroy_hold_id_lists(const lListElem *job, lList *id_list[16]);
 
189
 
 
190
void job_create_hold_id_lists(const lListElem *job, lList *id_list[16],
 
191
                              u_long32 hold_state[16]);
 
192
 
 
193
bool job_is_zombie_job(const lListElem *job); 
 
194
 
 
195
const char *job_get_shell_start_mode(const lListElem *job,
 
196
                                     const lListElem *queue,
 
197
                                     const char *conf_shell_start_mode);
 
198
 
 
199
bool job_is_array(const lListElem *job); 
 
200
 
 
201
bool job_is_parallel(const lListElem *job);
 
202
 
 
203
bool job_is_tight_parallel(const lListElem *job, const lList *pe_list);
 
204
 
 
205
bool job_might_be_tight_parallel(const lListElem *job, const lList *pe_list);
 
206
 
 
207
void job_get_submit_task_ids(const lListElem *job, u_long32 *start, 
 
208
                             u_long32 *end, u_long32 *step); 
 
209
 
 
210
int job_set_submit_task_ids(lListElem *job, u_long32 start, u_long32 end,
 
211
                            u_long32 step);
 
212
 
 
213
u_long32 job_get_smallest_unenrolled_task_id(const lListElem *job);
 
214
 
 
215
u_long32 job_get_smallest_enrolled_task_id(const lListElem *job);
 
216
 
 
217
u_long32 job_get_biggest_unenrolled_task_id(const lListElem *job);
 
218
 
 
219
u_long32 job_get_biggest_enrolled_task_id(const lListElem *job);
 
220
 
 
221
int job_list_register_new_job(const lList *job_list, u_long32 max_jobs,
 
222
                              int force_registration);   
 
223
 
 
224
void jatask_list_print_to_string(const lList *task_list, dstring *range_string);
 
225
 
 
226
lList* ja_task_list_split_group(lList **task_list);
 
227
 
 
228
int job_initialize_id_lists(lListElem *job, lList **answer_list);
 
229
 
 
230
void job_initialize_env(lListElem *job, 
 
231
                        lList **answer_list,
 
232
                        const lList* path_alias_list,
 
233
                        const char *unqualified_hostname,
 
234
                        const char *qualified_hostname);
 
235
 
 
236
const char* job_get_env_string(const lListElem *job, const char *variable);
 
237
 
 
238
void job_set_env_string(lListElem *job, const char *variable, 
 
239
                        const char *value);
 
240
 
 
241
void job_check_correct_id_sublists(lListElem *job, lList **answer_list);
 
242
 
 
243
const char *job_get_id_string(u_long32 job_id, u_long32 ja_task_id, 
 
244
                              const char *pe_task_id, dstring *buffer);
 
245
 
 
246
const char *job_get_job_key(u_long32 job_id, dstring *buffer);
 
247
 
 
248
const char *job_get_key(u_long32 job_id, u_long32 ja_task_id, 
 
249
                        const char *pe_task_id, dstring *buffer);
 
250
 
 
251
const char *jobscript_get_key(lListElem *jep, dstring *buffer);
 
252
 
 
253
char *jobscript_parse_key(char *key,const char **exec_file);
 
254
 
 
255
bool job_parse_key(char *key, u_long32 *job_id, u_long32 *ja_task_id,
 
256
                   char **pe_task_id, bool *only_job);
 
257
 
 
258
bool job_is_pe_referenced(const lListElem *job, const lListElem *pe);
 
259
 
 
260
bool job_is_ckpt_referenced(const lListElem *job, const lListElem *ckpt);
 
261
 
 
262
void job_get_state_string(char *str, u_long32 op);
 
263
 
 
264
lListElem *job_list_locate(lList *job_list, u_long32 job_id);
 
265
 
 
266
void job_add_parent_id_to_context(lListElem *job);
 
267
 
 
268
int job_check_qsh_display(const lListElem *job, 
 
269
                          lList **answer_list, 
 
270
                          bool output_warning);
 
271
 
 
272
int job_check_owner(const char *user_name, u_long32 job_id, lList *master_job_list);
 
273
 
 
274
int job_resolve_host_for_path_list(const lListElem *job, lList **answer_list, int name);
 
275
 
 
276
lListElem *
 
277
job_get_request(const lListElem *this_elem, const char *centry_name);
 
278
 
 
279
bool
 
280
job_get_contribution(const lListElem *this_elem, lList **answer_list,
 
281
                     const char *name, double *value,
 
282
                     const lListElem *implicit_centry);
 
283
 
 
284
/* unparse functions */
 
285
bool sge_unparse_string_option_dstring(dstring *category_str, const lListElem *job_elem, 
 
286
                               int nm, char *option);
 
287
 
 
288
bool sge_unparse_ulong_option_dstring(dstring *category_str, const lListElem *job_elem, 
 
289
                               int nm, char *option);
 
290
                               
 
291
bool sge_unparse_pe_dstring(dstring *category_str, const lListElem *job_elem, int pe_pos, int range_pos,
 
292
                            const char *option); 
 
293
 
 
294
bool sge_unparse_resource_list_dstring(dstring *category_str, lListElem *job_elem, 
 
295
                                       int nm, const char *option);
 
296
 
 
297
bool sge_unparse_queue_list_dstring(dstring *category_str, lListElem *job_elem, 
 
298
                                    int nm, const char *option);   
 
299
 
 
300
bool sge_unparse_acl_dstring(dstring *category_str, const char *owner, const char *group, 
 
301
                             const lList *acl_list, const char *option);
 
302
 
 
303
bool job_verify(const lListElem *job, lList **answer_list);
 
304
bool job_verify_submitted_job(const lListElem *job, lList **answer_list);
 
305
bool job_verify_execd_job(const lListElem *job, lList **answer_list);
 
306
 
 
307
bool job_get_wallclock_limit(u_long32 *limit, const lListElem *jep);
 
308
 
 
309
#endif /* __SGE_JOB_H */