23
23
BOA_PROXY = "http://boa.cs.iastate.edu/boa/?q=boa/api"
24
24
25
25
class NotLoggedInException (Exception ):
26
- pass
26
+ pass
27
27
28
28
class BoaException (Exception ):
29
29
pass
30
30
31
31
class BoaClient (object ):
32
- """ A client class for accessing boa's api
32
+ """ A client class for accessing boa's api
33
33
34
34
Attributes:
35
35
server (xmlrpc.client.ServerProxy):
@@ -56,10 +56,10 @@ def login(self, username, password):
56
56
return response
57
57
except xmlrpc .client .Fault as e :
58
58
raise BoaException (e ).with_traceback (e .__traceback__ )
59
-
59
+
60
60
def close (self ):
61
61
"""Log out of the boa framework using the remote api
62
-
62
+
63
63
Raises:
64
64
BoaException: if theres an issue reading from the server
65
65
"""
@@ -72,10 +72,10 @@ def close(self):
72
72
73
73
def ensure_logged_in (self ):
74
74
"""Checks if a user is currently logged in through the remote api
75
-
75
+
76
76
Returns:
77
77
bool: True if user is logged in, false if otherwise
78
-
78
+
79
79
Raises:
80
80
NotLoggedInException: if user is not currently logged in
81
81
"""
@@ -99,7 +99,7 @@ def datasets(self):
99
99
100
100
def dataset_names (self ):
101
101
"""Retrieves a list of names of all datasets provided by boa
102
-
102
+
103
103
Returns:
104
104
list: the dataset names
105
105
@@ -118,13 +118,13 @@ def dataset_names(self):
118
118
119
119
def get_dataset (self , name ):
120
120
"""Retrieves a dataset given a name.
121
-
121
+
122
122
Args:
123
123
name (str): The name of the input dataset to return.
124
124
125
125
Returns:
126
126
dict: a dictionary with the keys id and name
127
-
127
+
128
128
Raises:
129
129
BoaException: if theres an issue reading from the server
130
130
"""
@@ -142,7 +142,7 @@ def last_job(self):
142
142
143
143
Returns:
144
144
JobHandle: the last submitted job
145
-
145
+
146
146
Raises:
147
147
BoaException: if theres an issue reading from the server
148
148
"""
@@ -155,14 +155,14 @@ def last_job(self):
155
155
156
156
def job_count (self , pub_only = False ):
157
157
"""Retrieves the number of jobs submitted by a user
158
-
158
+
159
159
Args:
160
160
pub_only (bool, optional): if true, return only public jobs
161
161
otherwise return all jobs
162
-
162
+
163
163
Returns:
164
164
int: the number of jobs submitted by a user
165
-
165
+
166
166
Raises:
167
167
BoaException: if theres an issue reading from the server
168
168
"""
@@ -179,9 +179,9 @@ def query(self, query, dataset=None):
179
179
query (str): a boa query represented as a string.
180
180
dataset (str, optional): the name of the input dataset.
181
181
182
- Returns:
183
- (JobHandle) a job
184
-
182
+ Returns:
183
+ (JobHandle) a job
184
+
185
185
Raises:
186
186
BoaException: if theres an issue reading from the server
187
187
"""
@@ -195,13 +195,13 @@ def query(self, query, dataset=None):
195
195
196
196
def get_job (self , id ):
197
197
"""Retrieves a job given an id.
198
-
198
+
199
199
Args:
200
- id (int): the id of the job you want to retrieve
200
+ id (int): the id of the job you want to retrieve
201
201
202
202
Returns:
203
203
JobHandle: the desired job.
204
-
204
+
205
205
Raises:
206
206
BoaException: if theres an issue reading from the server
207
207
"""
@@ -213,7 +213,7 @@ def get_job(self, id):
213
213
214
214
def job_list (self , pub_only = False , offset = 0 , length = 1000 ):
215
215
"""Returns a list of the most recent jobs, based on an offset and length.
216
-
216
+
217
217
This includes public and private jobs. Returned jobs are ordered from newest to oldest
218
218
219
219
Args:
@@ -223,7 +223,7 @@ def job_list(self, pub_only=False, offset=0, length=1000):
223
223
224
224
Returns:
225
225
list: a list of jobs where each element is a jobHandle
226
-
226
+
227
227
Raises:
228
228
BoaException: if theres an issue reading from the server
229
229
"""
@@ -243,7 +243,7 @@ def stop(self, job):
243
243
244
244
Args:
245
245
job (JobHandle): the job whose execution you want to stop
246
-
246
+
247
247
Raises:
248
248
BoaException: if theres an issue reading from the server
249
249
"""
@@ -256,9 +256,9 @@ def stop(self, job):
256
256
def resubmit (self , job ):
257
257
"""Resubmits a job to the framework
258
258
259
- Args:
259
+ Args:
260
260
job (JobHandle): The job you want to resubmit
261
-
261
+
262
262
Raises:
263
263
BoaException: if theres an issue reading from the server
264
264
"""
@@ -270,10 +270,10 @@ def resubmit(self, job):
270
270
271
271
def delete (self , job ):
272
272
"""Deletes this job from the framework.
273
-
274
- Args:
273
+
274
+ Args:
275
275
job (JobHandle): the job you want to delete
276
-
276
+
277
277
Raises:
278
278
BoaException: if theres an issue reading from the server
279
279
"""
@@ -285,14 +285,14 @@ def delete(self, job):
285
285
286
286
def set_public (self , job , is_public ):
287
287
"""Modifies the public/private status of this job.
288
-
289
- Args:
290
- is_public (bool): 'True' to make it public, False to make it private
288
+
289
+ Args:
290
+ is_public (bool): 'True' to make it public, False to make it private
291
291
job (JobHandle)
292
-
292
+
293
293
Raises:
294
294
BoaException: if theres an issue reading from the server
295
- """
295
+ """
296
296
self .ensure_logged_in ()
297
297
try :
298
298
if is_public is True :
@@ -304,10 +304,10 @@ def set_public(self, job, is_public):
304
304
305
305
def public_status (self , job ):
306
306
"""Get the jobs public/private status.
307
-
308
- Args:
307
+
308
+ Args:
309
309
job (JobHandle)
310
-
310
+
311
311
Raises:
312
312
BoaException: if theres an issue reading from the server
313
313
"""
@@ -323,10 +323,10 @@ def public_status(self, job):
323
323
324
324
def get_url (self , job ):
325
325
"""Retrieves the jobs URL.
326
-
327
- Args:
326
+
327
+ Args:
328
328
job (JobHandle)
329
-
329
+
330
330
Raises:
331
331
BoaException: if theres an issue reading from the server
332
332
"""
@@ -338,10 +338,10 @@ def get_url(self, job):
338
338
339
339
def public_url (self , job ):
340
340
"""Get the jobs public page URL.
341
-
342
- Args:
341
+
342
+ Args:
343
343
job (JobHandle)
344
-
344
+
345
345
Raises:
346
346
BoaException: if theres an issue reading from the server
347
347
"""
@@ -353,10 +353,10 @@ def public_url(self, job):
353
353
354
354
def get_compiler_errors (self , job ):
355
355
"""Return any errors from trying to compile the job.
356
-
357
- Args:
356
+
357
+ Args:
358
358
job (JobHandle)
359
-
359
+
360
360
Raises:
361
361
BoaException: if theres an issue reading from the server
362
362
"""
@@ -368,10 +368,10 @@ def get_compiler_errors(self, job):
368
368
369
369
def source (self , job ):
370
370
"""Return the source query for this job.
371
-
372
- Args:
371
+
372
+ Args:
373
373
job (JobHandle)
374
-
374
+
375
375
Raises:
376
376
BoaException: if theres an issue reading from the server
377
377
"""
@@ -383,7 +383,7 @@ def source(self, job):
383
383
384
384
def output (self , job ):
385
385
"""Return the output for this job, if it finished successfully and has an output.
386
-
386
+
387
387
Raises:
388
388
BoaException: if theres an issue reading from the server
389
389
"""
0 commit comments