From 14947dbc744256a61c63457bec2a3438a85ec5f3 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 11 Mar 2010 15:07:35 +0100
Subject: [PATCH] Switch burnin to cli.JobExecutor

Burnin has a custom job executor, because of its need to retry some job
series.

While we cannot replace all of it, at least the execution we can switch
to cli.JobExecutor, to take advantage of the recently-introduced
out-of-order waiting.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 tools/burnin | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/tools/burnin b/tools/burnin
index cd16644aa..8d3c14c30 100755
--- a/tools/burnin
+++ b/tools/burnin
@@ -385,18 +385,19 @@ class Burner(object):
 
     """
     self.ClearFeedbackBuf()
-    job_ids = [cli.SendJob(row[0], cl=self.cl) for row in jobs]
-    Log("Submitted job ID(s) %s", utils.CommaJoin(job_ids), indent=1)
-    results = []
-    for jid, (_, iname) in zip(job_ids, jobs):
-      Log("waiting for job %s for %s", jid, iname, indent=2)
-      try:
-        results.append(cli.PollJob(jid, cl=self.cl, feedback_fn=self.Feedback))
-      except Exception, err: # pylint: disable-msg=W0703
-        Log("Job for %s failed: %s", iname, err)
-    if len(results) != len(jobs):
+    jex = cli.JobExecutor(cl=self.cl, feedback_fn=self.Feedback)
+    for ops, name in jobs:
+      jex.QueueJob(name, *ops) # pylint: disable-msg=W0142
+    try:
+      results = jex.GetResults()
+    except Exception, err: # pylint: disable-msg=W0703
+      Log("Jobs failed: %s", err)
       raise BurninFailure()
-    return results
+
+    if utils.any(results, lambda x: not x[0]):
+      raise BurninFailure()
+
+    return [i[1] for i in results]
 
   def ParseOptions(self):
     """Parses the command line options.
-- 
GitLab