mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-21 12:28:44 +00:00
fw/execution: abort and unresponsive target handling
Make sure KeyboardInterrupt's and unresponsive target errors are caught and handled at appropriate points in the execution.
This commit is contained in:
parent
04ab336afc
commit
79aaef9986
@ -420,14 +420,15 @@ class Runner(object):
|
|||||||
log.indent()
|
log.indent()
|
||||||
self.do_run_job(job, context)
|
self.do_run_job(job, context)
|
||||||
job.set_status(Status.OK)
|
job.set_status(Status.OK)
|
||||||
except KeyboardInterrupt:
|
except (Exception, KeyboardInterrupt) as e: # pylint: disable=broad-except
|
||||||
job.set_status(Status.ABORTED)
|
|
||||||
raise
|
|
||||||
except Exception as e: # pylint: disable=broad-except
|
|
||||||
job.set_status(Status.FAILED)
|
|
||||||
context.add_event(e.message)
|
|
||||||
log.log_error(e, self.logger)
|
log.log_error(e, self.logger)
|
||||||
if isinstance(e, ExecutionError):
|
if isinstance(e, KeyboardInterrupt):
|
||||||
|
job.set_status(Status.ABORTED)
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
job.set_status(Status.FAILED)
|
||||||
|
context.add_event(e.message)
|
||||||
|
if isinstance(e, TargetNotRespondingError):
|
||||||
raise e
|
raise e
|
||||||
elif isinstance(e, TargetError):
|
elif isinstance(e, TargetError):
|
||||||
context.tm.verify_target_responsive()
|
context.tm.verify_target_responsive()
|
||||||
@ -464,6 +465,9 @@ class Runner(object):
|
|||||||
try:
|
try:
|
||||||
with signal.wrap('JOB_EXECUTION', self, context):
|
with signal.wrap('JOB_EXECUTION', self, context):
|
||||||
job.run(context)
|
job.run(context)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
job.set_status(Status.ABORTED)
|
||||||
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
job.set_status(Status.FAILED)
|
job.set_status(Status.FAILED)
|
||||||
log.log_error(e, self.logger)
|
log.log_error(e, self.logger)
|
||||||
@ -484,7 +488,6 @@ class Runner(object):
|
|||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
job.set_status(Status.ABORTED)
|
job.set_status(Status.ABORTED)
|
||||||
self.logger.info('Got CTRL-C. Aborting.')
|
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
# If setup was successfully completed, teardown must
|
# If setup was successfully completed, teardown must
|
||||||
|
Loading…
x
Reference in New Issue
Block a user