mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-30 22:54:18 +00:00 
			
		
		
		
	output_processors: Move variable initialization to __init__
				
					
				
			In the case of a failure in the initialization of one output_processor the remaining `initialize` methods may not get called causing variables to not be initialized correctly.
This commit is contained in:
		| @@ -85,8 +85,9 @@ class CpuStatesProcessor(OutputProcessor): | |||||||
|                   """), |                   """), | ||||||
|     ] |     ] | ||||||
|  |  | ||||||
|     def initialize(self, context): |     def __init__(self, *args, **kwargs): | ||||||
|         self.iteration_reports = OrderedDict()  # pylint: disable=attribute-defined-outside-init |         super(CpuStatesProcessor, self).__init__(*args, **kwargs) | ||||||
|  |         self.iteration_reports = OrderedDict() | ||||||
|  |  | ||||||
|     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 | ||||||
|         trace_file = output.get_artifact_path('trace-cmd-txt') |         trace_file = output.get_artifact_path('trace-cmd-txt') | ||||||
|   | |||||||
| @@ -49,6 +49,11 @@ class CsvReportProcessor(OutputProcessor): | |||||||
|                   """), |                   """), | ||||||
|     ] |     ] | ||||||
|  |  | ||||||
|  |     def __init__(self, *args, **kwargs): | ||||||
|  |         super(CsvReportProcessor, self).__init__(*args, **kwargs) | ||||||
|  |         self.outputs_so_far = [] | ||||||
|  |         self.artifact_added = False | ||||||
|  |  | ||||||
|     def validate(self): |     def validate(self): | ||||||
|         super(CsvReportProcessor, self).validate() |         super(CsvReportProcessor, self).validate() | ||||||
|         if self.use_all_classifiers and self.extra_columns: |         if self.use_all_classifiers and self.extra_columns: | ||||||
| @@ -56,11 +61,6 @@ class CsvReportProcessor(OutputProcessor): | |||||||
|                   'use_all_classifiers is True' |                   'use_all_classifiers is True' | ||||||
|             raise ConfigError(msg) |             raise ConfigError(msg) | ||||||
|  |  | ||||||
|     def initialize(self, context): |  | ||||||
|         # pylint: disable=attribute-defined-outside-init |  | ||||||
|         self.outputs_so_far = [] |  | ||||||
|         self.artifact_added = False |  | ||||||
|  |  | ||||||
|     # pylint: disable=unused-argument |     # pylint: disable=unused-argument | ||||||
|     def process_job_output(self, output, target_info, run_output): |     def process_job_output(self, output, target_info, run_output): | ||||||
|         self.outputs_so_far.append(output) |         self.outputs_so_far.append(output) | ||||||
|   | |||||||
| @@ -108,7 +108,8 @@ class SqliteResultProcessor(OutputProcessor): | |||||||
|  |  | ||||||
|     ] |     ] | ||||||
|  |  | ||||||
|     def initialize(self, context): |     def __init__(self, *args, **kwargs): | ||||||
|  |         super(SqliteResultProcessor, self).__init__(*args, **kwargs) | ||||||
|         self._last_spec = None |         self._last_spec = None | ||||||
|         self._run_oid = None |         self._run_oid = None | ||||||
|         self._spec_oid = None |         self._spec_oid = None | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user