mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-11-04 00:52:08 +00:00 
			
		
		
		
	framework/execution: ensure output is always processed
Ensure that job output is processed even if a workload fails. This is because output processing includes things like extracting logs, which we still want to happen on failure. Job status is now also set correctly when an error occurs during output processing rather than actual running of the workload. Previously, the status would be correctly set to PARTIAL in the inner except clause, but the exception is then re-raised, and the status was "upgraded" to FAILED in the outer except clause.
This commit is contained in:
		
				
					committed by
					
						
						marcbonnici
					
				
			
			
				
	
			
			
			
						parent
						
							39e63f1358
						
					
				
				
					commit
					45d8be5228
				
			@@ -464,28 +464,30 @@ class Runner(object):
 | 
			
		||||
            job.setup(context)
 | 
			
		||||
 | 
			
		||||
        try:
 | 
			
		||||
            with signal.wrap('JOB_EXECUTION', self):
 | 
			
		||||
                job.run(context)
 | 
			
		||||
 | 
			
		||||
            try:
 | 
			
		||||
                with signal.wrap('JOB_OUTPUT_PROCESSED', self):
 | 
			
		||||
                    job.process_output(context)
 | 
			
		||||
                self.pm.process_job_output(context)
 | 
			
		||||
                self.pm.export_job_output(context)
 | 
			
		||||
            except Exception:
 | 
			
		||||
                job.set_status(Status.PARTIAL)
 | 
			
		||||
                raise
 | 
			
		||||
                with signal.wrap('JOB_EXECUTION', self):
 | 
			
		||||
                    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
 | 
			
		||||
                raise e
 | 
			
		||||
            finally:
 | 
			
		||||
                try:
 | 
			
		||||
                    with signal.wrap('JOB_OUTPUT_PROCESSED', self):
 | 
			
		||||
                        job.process_output(context)
 | 
			
		||||
                    self.pm.process_job_output(context)
 | 
			
		||||
                    self.pm.export_job_output(context)
 | 
			
		||||
                except Exception:
 | 
			
		||||
                    job.set_status(Status.PARTIAL)
 | 
			
		||||
                    raise
 | 
			
		||||
 | 
			
		||||
        except KeyboardInterrupt:
 | 
			
		||||
            job.set_status(Status.ABORTED)
 | 
			
		||||
            self.logger.info('Got CTRL-C. Aborting.')
 | 
			
		||||
            raise
 | 
			
		||||
        except Exception as e:
 | 
			
		||||
            job.set_status(Status.FAILED)
 | 
			
		||||
            if not getattr(e, 'logged', None):
 | 
			
		||||
                log.log_error(e, self.logger)
 | 
			
		||||
                e.logged = True
 | 
			
		||||
            raise e
 | 
			
		||||
        finally:
 | 
			
		||||
            # If setup was successfully completed, teardown must
 | 
			
		||||
            # run even if the job failed
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user