mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-21 20:38:57 +00:00
fw: fix job logging indent
- Have the job manage the indent of each of its stages - Switch output_processor to using indentcontext - Move the "Configuring augmentations" log line into Job -- the rest of the stages are logged there, but this was done by the Executor for some reason.
This commit is contained in:
parent
98219bbba9
commit
9226a3b92a
@ -454,10 +454,9 @@ class Runner(object):
|
||||
self.pm.process_run_output(self.context)
|
||||
self.pm.export_run_output(self.context)
|
||||
self.pm.finalize()
|
||||
log.indent()
|
||||
with log.indentcontext():
|
||||
for job in self.context.completed_jobs:
|
||||
job.finalize(self.context)
|
||||
log.dedent()
|
||||
signal.disconnect(self._error_signalled_callback, signal.ERROR_LOGGED)
|
||||
signal.disconnect(self._warning_signalled_callback, signal.WARNING_LOGGED)
|
||||
|
||||
@ -500,7 +499,6 @@ class Runner(object):
|
||||
job.set_status(Status.RUNNING)
|
||||
self.send(signal.JOB_STARTED)
|
||||
|
||||
self.logger.info('Configuring augmentations')
|
||||
job.configure_augmentations(context, self.pm)
|
||||
|
||||
with signal.wrap('JOB_TARGET_CONFIG', self, context):
|
||||
|
@ -4,6 +4,7 @@ from datetime import datetime
|
||||
|
||||
from wa.framework import pluginloader, signal, instrument
|
||||
from wa.framework.configuration.core import Status
|
||||
from wa.utils.log import indentcontext
|
||||
|
||||
# Because of use of Enum (dynamic attrs)
|
||||
# pylint: disable=no-member
|
||||
@ -68,6 +69,7 @@ class Job(object):
|
||||
|
||||
def initialize(self, context):
|
||||
self.logger.info('Initializing job {}'.format(self))
|
||||
with indentcontext():
|
||||
with signal.wrap('WORKLOAD_INITIALIZED', self, context):
|
||||
self.workload.logger.context = context
|
||||
self.workload.initialize(context)
|
||||
@ -76,6 +78,8 @@ class Job(object):
|
||||
context.update_job_state(self)
|
||||
|
||||
def configure_augmentations(self, context, pm):
|
||||
self.logger.info('Configuring augmentations')
|
||||
with indentcontext():
|
||||
instruments_to_enable = set()
|
||||
output_processors_to_enable = set()
|
||||
enabled_instruments = set(i.name for i in instrument.get_enabled())
|
||||
@ -125,6 +129,7 @@ class Job(object):
|
||||
self.logger.info('Target unresponsive; not processing job output.')
|
||||
return
|
||||
self.logger.info('Processing output for job {}'.format(self))
|
||||
with indentcontext():
|
||||
if self.status != Status.FAILED:
|
||||
with signal.wrap('WORKLOAD_RESULT_EXTRACTION', self, context):
|
||||
self.workload.extract_results(context)
|
||||
@ -137,6 +142,7 @@ class Job(object):
|
||||
self.logger.info('Target unresponsive; not tearing down.')
|
||||
return
|
||||
self.logger.info('Tearing down job {}'.format(self))
|
||||
with indentcontext():
|
||||
with signal.wrap('WORKLOAD_TEARDOWN', self, context):
|
||||
self.workload.teardown(context)
|
||||
|
||||
@ -147,6 +153,7 @@ class Job(object):
|
||||
self.logger.info('Target unresponsive; not finalizing.')
|
||||
return
|
||||
self.logger.info('Finalizing job {} '.format(self))
|
||||
with indentcontext():
|
||||
with signal.wrap('WORKLOAD_FINALIZED', self, context):
|
||||
self.workload.finalize(context)
|
||||
|
||||
|
@ -4,7 +4,7 @@ from wa.framework import pluginloader
|
||||
from wa.framework.exception import ConfigError
|
||||
from wa.framework.instrument import is_installed
|
||||
from wa.framework.plugin import Plugin
|
||||
from wa.utils.log import log_error, indent, dedent
|
||||
from wa.utils.log import log_error, indentcontext
|
||||
from wa.utils.misc import isiterable
|
||||
from wa.utils.types import identifier
|
||||
|
||||
@ -115,8 +115,7 @@ class ProcessorManager(object):
|
||||
context.run_output, context.target_info)
|
||||
|
||||
def do_for_each_proc(self, method_name, message, *args):
|
||||
try:
|
||||
indent()
|
||||
with indentcontext():
|
||||
for proc in self.processors:
|
||||
if proc.is_enabled:
|
||||
proc_func = getattr(proc, method_name, None)
|
||||
@ -129,8 +128,6 @@ class ProcessorManager(object):
|
||||
if isinstance(e, KeyboardInterrupt):
|
||||
raise
|
||||
log_error(e, self.logger)
|
||||
finally:
|
||||
dedent()
|
||||
|
||||
def _enable_output_processor(self, inst):
|
||||
inst = self.get_output_processor(inst)
|
||||
|
Loading…
x
Reference in New Issue
Block a user