Debian Codegraph @

examples/example4.py

raw
1 #!/usr/bin/env python
2
3 from __future__ import print_function
4 import drmaa
5 import os
6
7 def main():
8 """Submit a job, then kill it.
9 Note, need file called sleeper.sh in home directory.
10 """
11 s = drmaa.Session()
12 s.initialize()
13 print('Creating job template')
14 jt = s.createJobTemplate()
15 jt.remoteCommand = os.getcwd() + '/sleeper.sh'
16 jt.args = ['42','Simon says:']
17 jt.joinFiles = True
18
19 jobid = s.runJob(jt)
20 print('Your job has been submitted with id ' + jobid)
21 # options are: SUSPEND, RESUME, HOLD, RELEASE, TERMINATE
22 s.control(jobid, drmaa.JobControlAction.TERMINATE)
23
24 print('Cleaning up')
25 s.deleteJobTemplate(jt)
26 s.exit()
27
28
29 if __name__=='__main__':
30 main()