mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-21 20:38:57 +00:00
Expose context in OP initialize and finalize
Expose the context to the initialize and finalize functions for Output Processors. This was found to be necessary for the upcoming PostgreSQL Output Processor.
This commit is contained in:
parent
4c4fd2a267
commit
718f2c1c90
@ -106,7 +106,7 @@ class ProcessCommand(Command):
|
|||||||
pm.install(proc, pc)
|
pm.install(proc, pc)
|
||||||
|
|
||||||
pm.validate()
|
pm.validate()
|
||||||
pm.initialize()
|
pm.initialize(pc)
|
||||||
|
|
||||||
pc.run_output = run_output
|
pc.run_output = run_output
|
||||||
pc.target_info = run_output.target_info
|
pc.target_info = run_output.target_info
|
||||||
@ -139,7 +139,7 @@ class ProcessCommand(Command):
|
|||||||
self.logger.info('Processing run')
|
self.logger.info('Processing run')
|
||||||
pm.process_run_output(pc)
|
pm.process_run_output(pc)
|
||||||
pm.export_run_output(pc)
|
pm.export_run_output(pc)
|
||||||
pm.finalize()
|
pm.finalize(pc)
|
||||||
|
|
||||||
run_output.write_result()
|
run_output.write_result()
|
||||||
self.logger.info('Done.')
|
self.logger.info('Done.')
|
||||||
|
@ -516,7 +516,7 @@ class Runner(object):
|
|||||||
signal.connect(self._error_signalled_callback, signal.ERROR_LOGGED)
|
signal.connect(self._error_signalled_callback, signal.ERROR_LOGGED)
|
||||||
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(self.context)
|
||||||
with log.indentcontext():
|
with log.indentcontext():
|
||||||
self.context.initialize_jobs()
|
self.context.initialize_jobs()
|
||||||
self.context.write_state()
|
self.context.write_state()
|
||||||
@ -532,7 +532,7 @@ class Runner(object):
|
|||||||
with signal.wrap('RUN_OUTPUT_PROCESSED', self):
|
with signal.wrap('RUN_OUTPUT_PROCESSED', self):
|
||||||
self.pm.process_run_output(self.context)
|
self.pm.process_run_output(self.context)
|
||||||
self.pm.export_run_output(self.context)
|
self.pm.export_run_output(self.context)
|
||||||
self.pm.finalize()
|
self.pm.finalize(self.context)
|
||||||
signal.disconnect(self._error_signalled_callback, signal.ERROR_LOGGED)
|
signal.disconnect(self._error_signalled_callback, signal.ERROR_LOGGED)
|
||||||
signal.disconnect(self._warning_signalled_callback, signal.WARNING_LOGGED)
|
signal.disconnect(self._warning_signalled_callback, signal.WARNING_LOGGED)
|
||||||
|
|
||||||
|
@ -40,10 +40,10 @@ class OutputProcessor(Plugin):
|
|||||||
msg = 'Instrument "{}" is required by {}, but is not installed.'
|
msg = 'Instrument "{}" is required by {}, but is not installed.'
|
||||||
raise ConfigError(msg.format(instrument, self.name))
|
raise ConfigError(msg.format(instrument, self.name))
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self, context):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def finalize(self):
|
def finalize(self, context):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@ -104,13 +104,13 @@ class ProcessorManager(object):
|
|||||||
for proc in self.processors:
|
for proc in self.processors:
|
||||||
proc.validate()
|
proc.validate()
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self, context):
|
||||||
for proc in self.processors:
|
for proc in self.processors:
|
||||||
proc.initialize()
|
proc.initialize(context)
|
||||||
|
|
||||||
def finalize(self):
|
def finalize(self, context):
|
||||||
for proc in self.processors:
|
for proc in self.processors:
|
||||||
proc.finalize()
|
proc.finalize(context)
|
||||||
|
|
||||||
def process_job_output(self, context):
|
def process_job_output(self, context):
|
||||||
self.do_for_each_proc('process_job_output', 'Processing using "{}"',
|
self.do_for_each_proc('process_job_output', 'Processing using "{}"',
|
||||||
|
@ -85,7 +85,7 @@ class CpuStatesProcessor(OutputProcessor):
|
|||||||
"""),
|
"""),
|
||||||
]
|
]
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self, context):
|
||||||
self.iteration_reports = OrderedDict() # pylint: disable=attribute-defined-outside-init
|
self.iteration_reports = OrderedDict() # pylint: disable=attribute-defined-outside-init
|
||||||
|
|
||||||
def process_job_output(self, output, target_info, run_output): # pylint: disable=unused-argument
|
def process_job_output(self, output, target_info, run_output): # pylint: disable=unused-argument
|
||||||
|
@ -56,7 +56,7 @@ class CsvReportProcessor(OutputProcessor):
|
|||||||
'use_all_classifiers is True'
|
'use_all_classifiers is True'
|
||||||
raise ConfigError(msg)
|
raise ConfigError(msg)
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self, context):
|
||||||
# pylint: disable=attribute-defined-outside-init
|
# pylint: disable=attribute-defined-outside-init
|
||||||
self.outputs_so_far = []
|
self.outputs_so_far = []
|
||||||
self.artifact_added = False
|
self.artifact_added = False
|
||||||
|
@ -108,7 +108,7 @@ class SqliteResultProcessor(OutputProcessor):
|
|||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self, context):
|
||||||
self._last_spec = None
|
self._last_spec = None
|
||||||
self._run_oid = None
|
self._run_oid = None
|
||||||
self._spec_oid = None
|
self._spec_oid = None
|
||||||
|
@ -56,7 +56,7 @@ class TargzProcessor(OutputProcessor):
|
|||||||
'''),
|
'''),
|
||||||
]
|
]
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self, context):
|
||||||
if self.delete_output:
|
if self.delete_output:
|
||||||
self.logger.debug('Registering RUN_FINALIZED handler.')
|
self.logger.debug('Registering RUN_FINALIZED handler.')
|
||||||
signal.connect(self.delete_output_directory, signal.RUN_FINALIZED, priority=-100)
|
signal.connect(self.delete_output_directory, signal.RUN_FINALIZED, priority=-100)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user