From 66ecc4796313b6da0fe2d05d310f3e6c9fed4e8b Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Wed, 9 Jun 2010 16:32:29 +0100 Subject: [PATCH] Submit[*each*]Pending job This is useful so we can test both SubmitJob and SubmitManyJobs. Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/cli.py | 11 +++++++++-- scripts/gnt-debug | 4 +++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/cli.py b/lib/cli.py index 50f5363cb..1932a009a 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -2248,11 +2248,18 @@ class JobExecutor(object): SetGenericOpcodeOpts(ops, self.opts) self.queue.append((name, ops)) - def SubmitPending(self): + def SubmitPending(self, each=False): """Submit all pending jobs. """ - results = self.cl.SubmitManyJobs([row[1] for row in self.queue]) + if each: + results = [] + for row in self.queue: + # SubmitJob will remove the success status, but raise an exception if + # the submission fails, so we'll notice that anyway. + results.append([True, self.cl.SubmitJob(row[1])]) + else: + results = self.cl.SubmitManyJobs([row[1] for row in self.queue]) for (idx, ((status, data), (name, _))) in enumerate(zip(results, self.queue)): self.jobs.append((idx, status, data, name)) diff --git a/scripts/gnt-debug b/scripts/gnt-debug index 5dc7dc630..c96deca92 100755 --- a/scripts/gnt-debug +++ b/scripts/gnt-debug @@ -90,7 +90,7 @@ def GenericOpCodes(opts, args): t1 = time.time() ToStdout("Submitting...") - jex.SubmitPending() + jex.SubmitPending(each=opts.each) if opts.timing_stats: t2 = time.time() @@ -174,6 +174,8 @@ commands = { help="Repeat the job this number of times"), cli_option("--timing-stats", default=False, action="store_true", help="Show timing stats"), + cli_option("--each", default=False, action="store_true", + help="Submit each job separately"), ], "<op_list_file...>", "Submits jobs built from json files" " containing a list of serialized opcodes"), -- GitLab