[bonfiredemokit] Annotation of /ea/job_submission.py
Annotation of /ea/job_submission.py
Parent Directory
| Revision Log
Revision 1 -
(view)
(download)
(as text)
1 : |
agomez |
1 |
'''
|
2 : |
|
|
Created on 01/03/2012
|
3 : |
|
|
|
4 : |
|
|
@author: R. Valin
|
5 : |
|
|
'''
|
6 : |
|
|
import saga
|
7 : |
|
|
|
8 : |
|
|
try:
|
9 : |
|
|
# create an "echo 'hello, world' job"
|
10 : |
|
|
jd = saga.job.description()
|
11 : |
|
|
jd.set_attribute("Executable", "/bin/echo")
|
12 : |
|
|
jd.set_vector_attribute("Arguments", ["Hello, World!"])
|
13 : |
|
|
jd.set_attribute("Interactive", "True")
|
14 : |
|
|
|
15 : |
|
|
# connect to the local job service
|
16 : |
|
|
js = saga.job.service("fork://localhost");
|
17 : |
|
|
|
18 : |
|
|
# submit the job
|
19 : |
|
|
job = js.create_job(jd)
|
20 : |
|
|
job.run()
|
21 : |
|
|
|
22 : |
|
|
# wait for the job to complete
|
23 : |
|
|
job.wait(-1)
|
24 : |
|
|
|
25 : |
|
|
# print the job's output
|
26 : |
|
|
output = job.get_stdout()
|
27 : |
|
|
print output.read()
|
28 : |
|
|
|
29 : |
|
|
except saga.exception, e:
|
30 : |
|
|
print "ERROR: "
|
31 : |
|
|
for err in e.get_all_messages():
|
32 : |
|
|
print err
|
33 : |
|
|
|
|