mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-31 15:12:25 +00:00 
			
		
		
		
	fw/job: add workload to INFO logging
Add workload label to the INFO-level log messages produced by the job.
This commit is contained in:
		
				
					committed by
					
						 Marc Bonnici
						Marc Bonnici
					
				
			
			
				
	
			
			
			
						parent
						
							5b15b115a7
						
					
				
				
					commit
					f946f13838
				
			| @@ -46,7 +46,7 @@ class Job(object): | |||||||
|         self._status = Status.NEW |         self._status = Status.NEW | ||||||
|  |  | ||||||
|     def load(self, target, loader=pluginloader): |     def load(self, target, loader=pluginloader): | ||||||
|         self.logger.info('Loading job {}'.format(self.id)) |         self.logger.info('Loading job {}'.format(self)) | ||||||
|         if self.iteration == 1: |         if self.iteration == 1: | ||||||
|             self.workload = loader.get_workload(self.spec.workload_name, |             self.workload = loader.get_workload(self.spec.workload_name, | ||||||
|                                                 target, |                                                 target, | ||||||
| @@ -62,7 +62,7 @@ class Job(object): | |||||||
|         self.output = output |         self.output = output | ||||||
|  |  | ||||||
|     def initialize(self, context): |     def initialize(self, context): | ||||||
|         self.logger.info('Initializing job {} [{}]'.format(self.id, self.iteration)) |         self.logger.info('Initializing job {}'.format(self)) | ||||||
|         with signal.wrap('WORKLOAD_INITIALIZED', self, context): |         with signal.wrap('WORKLOAD_INITIALIZED', self, context): | ||||||
|             self.workload.logger.context = context |             self.workload.logger.context = context | ||||||
|             self.workload.initialize(context) |             self.workload.initialize(context) | ||||||
| @@ -97,16 +97,16 @@ class Job(object): | |||||||
|             pm.enable(processor) |             pm.enable(processor) | ||||||
|  |  | ||||||
|     def configure_target(self, context): |     def configure_target(self, context): | ||||||
|         self.logger.info('Configuring target for job {} [{}]'.format(self.id, self.iteration)) |         self.logger.info('Configuring target for job {}'.format(self)) | ||||||
|         context.tm.commit_runtime_parameters(self.spec.runtime_parameters) |         context.tm.commit_runtime_parameters(self.spec.runtime_parameters) | ||||||
|  |  | ||||||
|     def setup(self, context): |     def setup(self, context): | ||||||
|         self.logger.info('Setting up job {} [{}]'.format(self.id, self.iteration)) |         self.logger.info('Setting up job {}'.format(self)) | ||||||
|         with signal.wrap('WORKLOAD_SETUP', self, context): |         with signal.wrap('WORKLOAD_SETUP', self, context): | ||||||
|             self.workload.setup(context) |             self.workload.setup(context) | ||||||
|  |  | ||||||
|     def run(self, context): |     def run(self, context): | ||||||
|         self.logger.info('Running job {} [{}]'.format(self.id, self.iteration)) |         self.logger.info('Running job {}'.format(self)) | ||||||
|         with signal.wrap('WORKLOAD_EXECUTION', self, context): |         with signal.wrap('WORKLOAD_EXECUTION', self, context): | ||||||
|             start_time = datetime.utcnow() |             start_time = datetime.utcnow() | ||||||
|             try: |             try: | ||||||
| @@ -118,7 +118,7 @@ class Job(object): | |||||||
|         if not context.tm.is_responsive: |         if not context.tm.is_responsive: | ||||||
|             self.logger.info('Target unresponsive; not processing job output.') |             self.logger.info('Target unresponsive; not processing job output.') | ||||||
|             return |             return | ||||||
|         self.logger.info('Processing output for job {} [{}]'.format(self.id, self.iteration)) |         self.logger.info('Processing output for job {}'.format(self)) | ||||||
|         if self.status != Status.FAILED: |         if self.status != Status.FAILED: | ||||||
|             with signal.wrap('WORKLOAD_RESULT_EXTRACTION', self, context): |             with signal.wrap('WORKLOAD_RESULT_EXTRACTION', self, context): | ||||||
|                 self.workload.extract_results(context) |                 self.workload.extract_results(context) | ||||||
| @@ -130,7 +130,7 @@ class Job(object): | |||||||
|         if not context.tm.is_responsive: |         if not context.tm.is_responsive: | ||||||
|             self.logger.info('Target unresponsive; not tearing down.') |             self.logger.info('Target unresponsive; not tearing down.') | ||||||
|             return |             return | ||||||
|         self.logger.info('Tearing down job {} [{}]'.format(self.id, self.iteration)) |         self.logger.info('Tearing down job {}'.format(self)) | ||||||
|         with signal.wrap('WORKLOAD_TEARDOWN', self, context): |         with signal.wrap('WORKLOAD_TEARDOWN', self, context): | ||||||
|             self.workload.teardown(context) |             self.workload.teardown(context) | ||||||
|  |  | ||||||
| @@ -138,7 +138,7 @@ class Job(object): | |||||||
|         if not context.tm.is_responsive: |         if not context.tm.is_responsive: | ||||||
|             self.logger.info('Target unresponsive; not finalizing.') |             self.logger.info('Target unresponsive; not finalizing.') | ||||||
|             return |             return | ||||||
|         self.logger.info('Finalizing job {} [{}]'.format(self.id, self.iteration)) |         self.logger.info('Finalizing job {} '.format(self)) | ||||||
|         with signal.wrap('WORKLOAD_FINALIZED', self, context): |         with signal.wrap('WORKLOAD_FINALIZED', self, context): | ||||||
|             self.workload.finalize(context) |             self.workload.finalize(context) | ||||||
|  |  | ||||||
| @@ -146,3 +146,9 @@ class Job(object): | |||||||
|         status = Status(status) |         status = Status(status) | ||||||
|         if force or self.status < status: |         if force or self.status < status: | ||||||
|             self.status = status |             self.status = status | ||||||
|  |  | ||||||
|  |     def __str__(self): | ||||||
|  |         return '{} ({}) [{}]'.format(self.id, self.label, self.iteration) | ||||||
|  |  | ||||||
|  |     def __repr__(self): | ||||||
|  |         return 'Job({})'.format(self) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user