Commit b59252fe authored by Iustin Pop's avatar Iustin Pop
Browse files

Switch gnt-debug submit-job to JobExecutor

Currently gnt-debug submits jobs individually, but in 2.1 JobExecutor
uses the optimized SubmitManyJobs luxi call and as such should be used
whenever multiple jobs need to be submitted.

This patch converts gnt-debug submit-job to use it and also removes an
extra empty line in the JobExecutor class.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarGuido Trotter <>
parent 3d2ca95d
...@@ -1004,7 +1004,6 @@ class JobExecutor(object): ...@@ -1004,7 +1004,6 @@ class JobExecutor(object):
""" """
self.queue.append((name, ops)) self.queue.append((name, ops))
def SubmitPending(self): def SubmitPending(self):
"""Submit all pending jobs. """Submit all pending jobs.
...@@ -71,19 +71,14 @@ def GenericOpCodes(opts, args): ...@@ -71,19 +71,14 @@ def GenericOpCodes(opts, args):
""" """
cl = cli.GetClient() cl = cli.GetClient()
job_data = [] jex = cli.JobExecutor(cl=cl)
job_ids = []
for fname in args: for fname in args:
op_data = simplejson.loads(open(fname).read()) op_data = simplejson.loads(open(fname).read())
op_list = [opcodes.OpCode.LoadOpCode(val) for val in op_data] op_list = [opcodes.OpCode.LoadOpCode(val) for val in op_data]
job_data.append((fname, op_list)) jex.QueueJob("file %s" % fname, *op_list)
for fname, op_list in job_data:
jid = cli.SendJob(op_list, cl=cl) jex.GetResults()
ToStdout("File '%s', job id: %s", fname, jid)
for jid in job_ids:
ToStdout("Waiting for job id %s", jid)
cli.PollJob(jid, cl=cl)
return 0 return 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment