1 | /* $Id: pbs_drmaa.h 2 2009-10-12 09:51:22Z mamonski $ */ |
---|
2 | /* |
---|
3 | * FedStage DRMAA for PBS Pro |
---|
4 | * Copyright (C) 2006-2007 FedStage Systems |
---|
5 | * |
---|
6 | * This program is free software: you can redistribute it and/or modify |
---|
7 | * it under the terms of the GNU General Public License as published by |
---|
8 | * the Free Software Foundation, either version 3 of the License, or |
---|
9 | * (at your option) any later version. |
---|
10 | * |
---|
11 | * This program is distributed in the hope that it will be useful, |
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | * GNU General Public License for more details. |
---|
15 | * |
---|
16 | * You should have received a copy of the GNU General Public License |
---|
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
18 | */ |
---|
19 | |
---|
20 | #ifndef __DRMAA__PBS_DRMAA_H |
---|
21 | #define __DRMAA__PBS_DRMAA_H |
---|
22 | |
---|
23 | #ifdef HAVE_CONFIG_H |
---|
24 | # include <config.h> |
---|
25 | #endif |
---|
26 | |
---|
27 | #include <sys/types.h> |
---|
28 | #include <stdbool.h> |
---|
29 | #include <time.h> |
---|
30 | #include <pbs_ifl.h> |
---|
31 | |
---|
32 | #include <drmaa_utils/common.h> |
---|
33 | #include <pbs_drmaa/pbs_attrib.h> |
---|
34 | |
---|
35 | |
---|
36 | /** PBS DRMAA specific session data. */ |
---|
37 | struct drmaa_session_impl_s { |
---|
38 | int pbs_conn; /**< PBS connection (or -1). */ |
---|
39 | drmaa_mutex_t conn_mutex; /**< Mutex for PBS connection. */ |
---|
40 | drmaa_thread_t wait_thread; |
---|
41 | bool wait_thread_started; |
---|
42 | struct attrl *status_attrl; |
---|
43 | }; |
---|
44 | |
---|
45 | |
---|
46 | enum { PBS_ATTRIBS_BITSET_SIZE = (N_PBS_DRMAA_ATTRIBS+31) / 32 }; |
---|
47 | struct drmaa_submit_impl_s { |
---|
48 | struct attrl *pbs_attribs; |
---|
49 | uint32_t pbs_attribs_bitset[ PBS_ATTRIBS_BITSET_SIZE ]; |
---|
50 | char *script_filename; |
---|
51 | }; |
---|
52 | |
---|
53 | |
---|
54 | void * |
---|
55 | drmaa_wait_thread( void *arg ); |
---|
56 | |
---|
57 | drmaa_submit_ctx_t * |
---|
58 | drmaa_create_submission_context( |
---|
59 | const drmaa_job_template_t *jt, int bulk_no, |
---|
60 | drmaa_err_ctx_t *err |
---|
61 | ); |
---|
62 | |
---|
63 | void |
---|
64 | drmaa_free_submission_context( drmaa_submit_ctx_t *c, drmaa_err_ctx_t* ); |
---|
65 | |
---|
66 | void drmaa_set_job_defaults ( drmaa_submit_ctx_t*, drmaa_err_ctx_t* ); |
---|
67 | void drmaa_create_job_script ( drmaa_submit_ctx_t*, drmaa_err_ctx_t* ); |
---|
68 | void drmaa_set_job_submit_state ( drmaa_submit_ctx_t*, drmaa_err_ctx_t* ); |
---|
69 | void drmaa_set_job_files ( drmaa_submit_ctx_t*, drmaa_err_ctx_t* ); |
---|
70 | void drmaa_set_file_staging ( drmaa_submit_ctx_t*, drmaa_err_ctx_t* ); |
---|
71 | void drmaa_set_job_resources ( drmaa_submit_ctx_t*, drmaa_err_ctx_t* ); |
---|
72 | void drmaa_set_job_environment ( drmaa_submit_ctx_t*, drmaa_err_ctx_t* ); |
---|
73 | void drmaa_set_job_email_notif ( drmaa_submit_ctx_t*, drmaa_err_ctx_t* ); |
---|
74 | void drmaa_apply_native_spec ( drmaa_submit_ctx_t*, drmaa_err_ctx_t* ); |
---|
75 | void drmaa_apply_job_category ( drmaa_submit_ctx_t*, drmaa_err_ctx_t* ); |
---|
76 | char *drmaa_translate_staging( const char *stage, drmaa_err_ctx_t* ); |
---|
77 | |
---|
78 | void |
---|
79 | drmaa_parse_qsub_args( |
---|
80 | drmaa_submit_ctx_t *ctx, const char *string, |
---|
81 | drmaa_err_ctx_t *err |
---|
82 | ); |
---|
83 | |
---|
84 | void |
---|
85 | drmaa_job_missing( drmaa_job_t *job, drmaa_err_ctx_t *err ); |
---|
86 | |
---|
87 | void |
---|
88 | drmaa_add_pbs_attr( |
---|
89 | drmaa_submit_ctx_t *c, |
---|
90 | int attr, char *resource, char *value, |
---|
91 | unsigned set, |
---|
92 | drmaa_err_ctx_t *err |
---|
93 | ); |
---|
94 | |
---|
95 | char * |
---|
96 | drmaa_write_tmpfile( |
---|
97 | const char *content, size_t len, |
---|
98 | drmaa_err_ctx_t *err |
---|
99 | ); |
---|
100 | |
---|
101 | struct attrl * |
---|
102 | drmaa_create_pbs_attrl( drmaa_err_ctx_t *err ); |
---|
103 | |
---|
104 | void |
---|
105 | drmaa_log_attrl( const struct attrl *attribute_list, const char *prefix ); |
---|
106 | |
---|
107 | void |
---|
108 | drmaa_free_attrl( struct attrl *attr ); |
---|
109 | |
---|
110 | void |
---|
111 | drmaa_err_pbs_error( drmaa_err_ctx_t *err ); |
---|
112 | |
---|
113 | int |
---|
114 | drmaa_err_map_pbs_error( int pbs_errcode ); |
---|
115 | |
---|
116 | #define RAISE_PBS() \ |
---|
117 | drmaa_err_pbs_error( err ) |
---|
118 | |
---|
119 | #endif /* __DRMAA__PBS_DRMAA_H */ |
---|
120 | |
---|