Source

pythongrid / test / test_drmaa.py

from drmaa import *

s = Session()
print('DRMAA library v%s'%str(s.version))
print('DRM system used: '+s.drmsInfo)

jt = JobTemplate()
jt.remoteCommand = '/bin/sleep'
jt.args = ['10']
jt.nativeSpecification = ''
jname = s.runJob(jt)

jinfo = s.wait(jname, Session.TIMEOUT_WAIT_FOREVER)

jt2 = JobTemplate()
jt2.remoteCommand = '/bin/sleep'
jt2.args = ['20']
jt2.nativeSpecification = ''
jname = s.runJob(jt2)

jinfo2 = s.wait(jname, Session.TIMEOUT_WAIT_FOREVER)

# Show all the returned information
# print jinfo
if (jinfo.wasAborted):
    print('Job never ran')
if (jinfo.hasExited):
    print('Job exited using the following resources:')
    print jinfo.resourceUsage
if (jinfo.hasSignal):
    print('Job was signalled with '+jinfo.terminatedSignal)
s.exit()