1 | /* $Id: drmaa_util.h 13 2011-04-20 15:41:43Z mmamonski $ */ |
---|
2 | /* |
---|
3 | * PSNC DRMAA 2.0 utilities library |
---|
4 | * Copyright (C) 2012 Poznan Supercomputing and Networking Center |
---|
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_UTILS__DRMAA_UTIL_H |
---|
21 | #define __DRMAA_UTILS__DRMAA_UTIL_H |
---|
22 | |
---|
23 | #ifdef HAVE_CONFIG_H |
---|
24 | # include <config.h> |
---|
25 | #endif |
---|
26 | |
---|
27 | #include <drmaa_utils/common.h> |
---|
28 | |
---|
29 | enum{ |
---|
30 | FSD_DRMAA_PH_HD = 1<<0, |
---|
31 | FSD_DRMAA_PH_WD = 1<<1, |
---|
32 | FSD_DRMAA_PH_INCR = 1<<2 |
---|
33 | }; |
---|
34 | |
---|
35 | struct fsd_expand_drmaa_ph_s { |
---|
36 | /** |
---|
37 | * Expands placeholders in DRMAA job attribute value. |
---|
38 | * @param self Context. |
---|
39 | * @param input String to transform. Should be malloc'ed |
---|
40 | * and ownership is passed to callee. |
---|
41 | * @param set Set of placeholders to expand. Bitwise |
---|
42 | * `or' of any of following bits: |
---|
43 | * - FSD_DRMAA_PH_HD, |
---|
44 | * - FSD_DRMAA_PH_WD, |
---|
45 | * - FSD_DRMAA_PH_INCR |
---|
46 | * @return Value with expanded placeholders or \c NULL |
---|
47 | * upon error. Caller is responsible for free()'ing it. |
---|
48 | */ |
---|
49 | char *(* |
---|
50 | expand)( fsd_expand_drmaa_ph_t *self, char *input, unsigned set ); |
---|
51 | |
---|
52 | void (* |
---|
53 | set)( fsd_expand_drmaa_ph_t *self, int placeholder, char *value ); |
---|
54 | |
---|
55 | void (*destroy)( fsd_expand_drmaa_ph_t *self ); |
---|
56 | |
---|
57 | char *home_directory; |
---|
58 | char *working_directory; |
---|
59 | char *bulk_incr; |
---|
60 | }; |
---|
61 | |
---|
62 | fsd_expand_drmaa_ph_t * |
---|
63 | fsd_expand_drmaa_ph_new( |
---|
64 | char *home_directory, |
---|
65 | char *working_directory, |
---|
66 | char *bulk_incr |
---|
67 | ); |
---|
68 | |
---|
69 | int fsd_parse_timedelta( const char *string ); |
---|
70 | |
---|
71 | /** |
---|
72 | * Return textual representation of action |
---|
73 | * - argument of drmaa_control(). |
---|
74 | */ |
---|
75 | const char *drmaa_control_to_str( int action ); |
---|
76 | |
---|
77 | /** |
---|
78 | * Return textual representation of job status |
---|
79 | * - result of drmaa_job_ps(). |
---|
80 | */ |
---|
81 | const char *drmaa_job_ps_to_str( int ps ); |
---|
82 | |
---|
83 | int fsd_drmaa_code( int fsd_errno ); |
---|
84 | |
---|
85 | int fsd_errno_from_drmaa_code( int drmaa_errno ); |
---|
86 | |
---|
87 | const char *fsd_drmaa_strerror( int drmaa_errno ); |
---|
88 | |
---|
89 | #endif /* __DRMAA_UTILS__DRMAA_UTIL_H */ |
---|
90 | |
---|