Revision 2c035435 tools/burnin
b/tools/burnin | ||
---|---|---|
347 | 347 |
self._SetDebug(ops) |
348 | 348 |
return self.MaybeRetry(rval, "opcode", self._ExecOp, *ops) |
349 | 349 |
|
350 |
def ExecOrQueue(self, name, ops): |
|
350 |
def ExecOrQueue(self, name, ops, post_process=None):
|
|
351 | 351 |
"""Execute an opcode and manage the exec buffer.""" |
352 | 352 |
if self.opts.parallel: |
353 | 353 |
self._SetDebug(ops) |
354 |
self.queued_ops.append((ops, name)) |
|
354 |
self.queued_ops.append((ops, name, post_process))
|
|
355 | 355 |
else: |
356 |
return self.ExecOp(self.queue_retry, *ops) # pylint: disable-msg=W0142 |
|
356 |
val = self.ExecOp(self.queue_retry, *ops) # pylint: disable-msg=W0142 |
|
357 |
if post_process is not None: |
|
358 |
post_process() |
|
359 |
return val |
|
357 | 360 |
|
358 | 361 |
def StartBatch(self, retry): |
359 | 362 |
"""Start a new batch of jobs. |
... | ... | |
391 | 394 |
""" |
392 | 395 |
self.ClearFeedbackBuf() |
393 | 396 |
jex = cli.JobExecutor(cl=self.cl, feedback_fn=self.Feedback) |
394 |
for ops, name in jobs: |
|
397 |
for ops, name, _ in jobs:
|
|
395 | 398 |
jex.QueueJob(name, *ops) # pylint: disable-msg=W0142 |
396 | 399 |
try: |
397 | 400 |
results = jex.GetResults() |
... | ... | |
399 | 402 |
Log("Jobs failed: %s", err) |
400 | 403 |
raise BurninFailure() |
401 | 404 |
|
402 |
if utils.any(results, lambda x: not x[0]): |
|
405 |
fail = False |
|
406 |
val = [] |
|
407 |
for (_, name, post_process), (success, result) in zip(jobs, results): |
|
408 |
if success: |
|
409 |
if post_process: |
|
410 |
try: |
|
411 |
post_process() |
|
412 |
except Exception, err: # pylint: disable-msg=W0703 |
|
413 |
Log("Post process call for job %s failed: %s", name, err) |
|
414 |
fail = True |
|
415 |
val.append(result) |
|
416 |
else: |
|
417 |
fail = True |
|
418 |
|
|
419 |
if fail: |
|
403 | 420 |
raise BurninFailure() |
404 | 421 |
|
405 |
return [i[1] for i in results]
|
|
422 |
return val
|
|
406 | 423 |
|
407 | 424 |
def ParseOptions(self): |
408 | 425 |
"""Parses the command line options. |
Also available in: Unified diff