OPTIONS:
-d database the database to process
+ -n num in -w mode, only perform num-many jobs
-p cols-def create properties table with SQL column spec
-v print output of the job's command
propdef = None
work = False
status = False
+ numjobs = None
try:
- opts, args = getopt.getopt(sys.argv[1:], "hd:c:p:wsv")
+ opts, args = getopt.getopt(sys.argv[1:], "hd:c:p:wsvn:")
for opt, arg in opts:
if opt == "-h":
status = True
elif opt == "-v":
verbose = True
+ elif opt == "-n":
+ numjobs = int(arg)
else:
print("Unknown option '", opt, "'.")
insertJobs(conn, cmds)
if work:
- while True:
+ n = 0
+ while not numjobs or n < numjobs:
+
jobid = getNextJobId(conn)
if jobid == None:
print("All jobs have been started.")
break
processJob(conn, jobid)
+ n += 1
conn.close()