This repository has been archived by the owner on Jul 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjdrmaa.hxx
110 lines (82 loc) · 2.39 KB
/
jdrmaa.hxx
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
#ifndef JDRMAA_HXX
#define JDRMAA_HXX
/**
This file is part of PBSJavaDRMAA.
(C) June 2013 by Bryan J. Lunt <[email protected]>
PBSJavaDRMAA is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
PBSJavaDRMAA is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PBSJavaDRMAA. If not, see <http://www.gnu.org/licenses/>.
*/
#include <drmaa.h>
#include <string.h>
#include <exception>
class DRMAAException: public std::exception
{
char *msg;
public:
DRMAAException(const char *in) throw(){
int inLen = strlen(in);
msg = (char*)malloc(inLen*sizeof(char));
strncpy(msg,in,inLen);
}
~DRMAAException() throw(){
free(msg);
}
virtual const char* what() const throw(){
return msg;
}
};
enum attType {NAMES, VALUES, JOBS};
class DRMAAVector{
public://not good style.
attType type;
union {
drmaa_attr_names_t *asnames;
drmaa_attr_values_t *asvalues;
drmaa_job_ids_t *asjobs;
};
DRMAAVector(attType intype);
~DRMAAVector();
char *next();
size_t size();
};
class DRMAA{
public:
static char *get_contact();
static int init(const char *contact) throw(DRMAAException);
static int init() throw(DRMAAException) { return init(NULL); }
static int exit() throw(DRMAAException);
static DRMAAVector *get_attribute_names();
static DRMAAVector *get_vector_attribute_names();
static int synchronize(const char *job_ids[], signed long timeout, int dispose);
};
#define JOB_ID_SIZE 256
class Job{
public:
char *id;
Job();
Job(const char* inID);
~Job();
void control(int action);
int ps();
};
class JobTemplate{
private:
drmaa_job_template_t *jt;
public:
JobTemplate();
~JobTemplate();
int set_attribute(const char *name, const char *value);
char *get_attribute(const char *name);
int set_vector_attribute(const char *name, const char **value);
DRMAAVector *get_vector_attribute(const char *name);
Job* start();
};
#endif