Debian Codegraph @

examples/example3.py

raw
1 #!/usr/bin/env python
2
3 from __future__ import print_function
4 import drmaa
5 import os
6
7
8 def main():
9 """Submit a job and wait for it to finish.
10 Note, need file called sleeper.sh in home directory.
11 """
12 s = drmaa.Session()
13 s.initialize()
14 print('Creating job template')
15 jt = s.createJobTemplate()
16 jt.remoteCommand = os.getcwd() + '/sleeper.sh'
17 jt.args = ['42','Simon says:']
18 jt.joinFiles = True
19
20 jobid = s.runJob(jt)
21 print('Your job has been submitted with id ' + jobid)
22
23 retval = s.wait(jobid, drmaa.Session.TIMEOUT_WAIT_FOREVER)
24 print('Job: ' + str(retval.jobId) + ' finished with status ' + str(retval.hasExited))
25
26 print('Cleaning up')
27 s.deleteJobTemplate(jt)
28 s.exit()
29
30
31 if __name__=='__main__':
32 main()