1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-03 20:02:39 +01:00

fw/execution: handle error on run initialize

- Use indentcontext inside initialize_run to make sure log level
  is dedented on error.
- Ensure Executor postamble always runs, event if runner errors.
- Fix format_duration() to handle sub-second timedeltas.
This commit is contained in:
Sergei Trofimov
2018-05-10 11:44:03 +01:00
committed by Marc Bonnici
parent b41c3a3ea2
commit 1ffbce68c4
2 changed files with 9 additions and 8 deletions

View File

@@ -352,10 +352,12 @@ class Executor(object):
self.logger.info('Starting run')
runner = Runner(context, pm)
signal.send(signal.RUN_STARTED, self)
runner.run()
context.finalize()
self.execute_postamble(context, output)
signal.send(signal.RUN_COMPLETED, self)
try:
runner.run()
finally:
context.finalize()
self.execute_postamble(context, output)
signal.send(signal.RUN_COMPLETED, self)
def execute_postamble(self, context, output):
self.logger.info('Done.')
@@ -441,9 +443,8 @@ class Runner(object):
signal.connect(self._warning_signalled_callback, signal.WARNING_LOGGED)
self.context.start_run()
self.pm.initialize()
log.indent()
self.context.initialize_jobs()
log.dedent()
with log.indentcontext():
self.context.initialize_jobs()
self.context.write_state()
def finalize_run(self):