1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-03 11:52:36 +01:00

fw: fix error logging

- Keep track of logged exceptions inside log_error itself.
- signal: log the exception, if there is one  in the finally clause of
  the  signal wrapper; this will ensure that the error will be logged
  closer to the command that originated.
- entrypoint: use log.log_error for top-level error logging, rather than
  the  entrypoint logger directly; this will ensure that errors are not
  repeated unnecessarily.
- Log CTRL-C message at zeroth indent level to make it easier to see in
  the  non-verbose output where it occurred.
This commit is contained in:
Sergei Trofimov
2018-02-28 15:18:58 +00:00
committed by Marc Bonnici
parent 6fe31d6cad
commit 04ab336afc
4 changed files with 24 additions and 15 deletions

View File

@@ -233,9 +233,7 @@ class ExecutionContext(object):
except WorkloadError as e:
job.set_status(Status.FAILED)
self.add_event(e.message)
if not getattr(e, 'logged', None):
log.log_error(e, self.logger)
e.logged = True
log.log_error(e, self.logger)
failed_ids.append(job.id)
if self.cm.run_config.bail_on_init_failure:
@@ -428,9 +426,7 @@ class Runner(object):
except Exception as e: # pylint: disable=broad-except
job.set_status(Status.FAILED)
context.add_event(e.message)
if not getattr(e, 'logged', None):
log.log_error(e, self.logger)
e.logged = True
log.log_error(e, self.logger)
if isinstance(e, ExecutionError):
raise e
elif isinstance(e, TargetError):
@@ -470,9 +466,7 @@ class Runner(object):
job.run(context)
except Exception as e:
job.set_status(Status.FAILED)
if not getattr(e, 'logged', None):
log.log_error(e, self.logger)
e.logged = True
log.log_error(e, self.logger)
if isinstance(e, TargetError) or isinstance(e, TimeoutError):
context.tm.verify_target_responsive()
raise e