mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-03-22 02:29:10 +00: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:
parent
b41c3a3ea2
commit
1ffbce68c4
@ -352,10 +352,12 @@ class Executor(object):
|
|||||||
self.logger.info('Starting run')
|
self.logger.info('Starting run')
|
||||||
runner = Runner(context, pm)
|
runner = Runner(context, pm)
|
||||||
signal.send(signal.RUN_STARTED, self)
|
signal.send(signal.RUN_STARTED, self)
|
||||||
runner.run()
|
try:
|
||||||
context.finalize()
|
runner.run()
|
||||||
self.execute_postamble(context, output)
|
finally:
|
||||||
signal.send(signal.RUN_COMPLETED, self)
|
context.finalize()
|
||||||
|
self.execute_postamble(context, output)
|
||||||
|
signal.send(signal.RUN_COMPLETED, self)
|
||||||
|
|
||||||
def execute_postamble(self, context, output):
|
def execute_postamble(self, context, output):
|
||||||
self.logger.info('Done.')
|
self.logger.info('Done.')
|
||||||
@ -441,9 +443,8 @@ class Runner(object):
|
|||||||
signal.connect(self._warning_signalled_callback, signal.WARNING_LOGGED)
|
signal.connect(self._warning_signalled_callback, signal.WARNING_LOGGED)
|
||||||
self.context.start_run()
|
self.context.start_run()
|
||||||
self.pm.initialize()
|
self.pm.initialize()
|
||||||
log.indent()
|
with log.indentcontext():
|
||||||
self.context.initialize_jobs()
|
self.context.initialize_jobs()
|
||||||
log.dedent()
|
|
||||||
self.context.write_state()
|
self.context.write_state()
|
||||||
|
|
||||||
def finalize_run(self):
|
def finalize_run(self):
|
||||||
|
@ -258,7 +258,7 @@ def format_duration(seconds, sep=' ', order=['day', 'hour', 'minute', 'second'])
|
|||||||
continue
|
continue
|
||||||
suffix = '' if value == 1 else 's'
|
suffix = '' if value == 1 else 's'
|
||||||
result.append('{} {}{}'.format(value, item, suffix))
|
result.append('{} {}{}'.format(value, item, suffix))
|
||||||
return sep.join(result)
|
return result and sep.join(result) or 'N/A'
|
||||||
|
|
||||||
|
|
||||||
def get_article(word):
|
def get_article(word):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user