Hey here's a python script for submitting N job at once. Hope this helps.
--
#!/usr/bin/python
import os, sys, random
if 'QBDIR' in os.environ:
sys.path.append('%s/api/python' % os.environ['QBDIR']);
elif os.uname()[0] == 'Darwin':
sys.path.append('/Applications/pfx/qube/api/python');
elif os.uname()[0] == 'Linux':
sys.path.append('/usr/local/pfx/qube/api/python');
else:
sys.path.append('c:/program files/pfx/qube/api/python');
import qb
# submit NUM_JOBS jobs
NUM_JOBS = 10
# JOB_TYPE = "cmdline"
JOB_TYPE = "cmdrange"
MIN_PRIORITY=1
MAX_PRIORITY=10
def main():
listOfJobsToSubmit = []
for i in range (1, NUM_JOBS):
job = {}
job['name'] = 'range'
job['prototype'] = JOB_TYPE
# job['reservations'] = 'host.memory=1,global.ray3=1'
# job['reservations'] = 'host.memory=1,global.xsibatch=1'
job['priority'] = random.randint(MIN_PRIORITY,MAX_PRIORITY)
if JOB_TYPE == "cmdrange":
start = random.randint(1,1000)
end = start + random.randint(1,1000)
step = random.randint(1,10)
framerange = "%d-%dx%d" % (start, end, step)
agenda = qb.genframes(framerange)
job['agenda'] = agenda
job['cpus'] = random.randint(1,len(agenda))
else:
job['cpus'] = 1
package = {}
job['package'] = package
job['package']['cmdline'] = "sleep %d" % random.randint(1,60)
listOfJobsToSubmit.append(job)
print "submitting [%d] jobs" % NUM_JOBS
listOfSubmittedJobs = qb.submit(listOfJobsToSubmit)
# print listOfSubmittedJobs
for job in listOfSubmittedJobs:
print job['id']
if __name__ == "__main__":
main()
sys.exit(0)