wiki:TorqueUsage/Scripts/Selectjobs

Select Jobs

#!/usr/bin/env python 

import pbs

c = pbs.pbs_connect(pbs.pbs_default())

# Select jobs in running state
#
attribs = pbs.new_attropl(1)
attribs[0].name  = pbs.ATTR_state
attribs[0].value = 'R'
attribs[0].op =  pbs.EQ

jobs = pbs.pbs_selectjob(c, attribs, 'NULL')
pbs.error()
print jobs

# Select running jobs in queue: q_serial
#
attribs = pbs.new_attropl(2)
attribs[0].name  = pbs.ATTR_state
attribs[0].value = 'R'
attribs[0].op =  pbs.EQ

attribs[1].name  = pbs.ATTR_q
attribs[1].value = "q_serial"
attribs[1].op =  pbs.EQ

jobs = pbs.pbs_selectjob(c, attribs, 'NULL')
pbs.error()
print jobs
Last modified 15 years ago Last modified on 09/19/06 14:59:21