mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-11-04 00:52:08 +00:00 
			
		
		
		
	fw/execution: abort and unresponsive target handling
Make sure KeyboardInterrupt's and unresponsive target errors are caught and handled at appropriate points in the execution.
This commit is contained in:
		
				
					committed by
					
						
						Marc Bonnici
					
				
			
			
				
	
			
			
			
						parent
						
							04ab336afc
						
					
				
				
					commit
					79aaef9986
				
			@@ -420,14 +420,15 @@ class Runner(object):
 | 
			
		||||
            log.indent()
 | 
			
		||||
            self.do_run_job(job, context)
 | 
			
		||||
            job.set_status(Status.OK)
 | 
			
		||||
        except KeyboardInterrupt:
 | 
			
		||||
            job.set_status(Status.ABORTED)
 | 
			
		||||
            raise
 | 
			
		||||
        except Exception as e: # pylint: disable=broad-except
 | 
			
		||||
            job.set_status(Status.FAILED)
 | 
			
		||||
            context.add_event(e.message)
 | 
			
		||||
        except (Exception, KeyboardInterrupt) as e: # pylint: disable=broad-except
 | 
			
		||||
            log.log_error(e, self.logger)
 | 
			
		||||
            if isinstance(e, ExecutionError):
 | 
			
		||||
            if isinstance(e, KeyboardInterrupt):
 | 
			
		||||
                job.set_status(Status.ABORTED)
 | 
			
		||||
                raise e
 | 
			
		||||
            else:
 | 
			
		||||
                job.set_status(Status.FAILED)
 | 
			
		||||
                context.add_event(e.message)
 | 
			
		||||
            if isinstance(e, TargetNotRespondingError):
 | 
			
		||||
                raise e
 | 
			
		||||
            elif isinstance(e, TargetError):
 | 
			
		||||
                context.tm.verify_target_responsive()
 | 
			
		||||
@@ -464,6 +465,9 @@ class Runner(object):
 | 
			
		||||
            try:
 | 
			
		||||
                with signal.wrap('JOB_EXECUTION', self, context):
 | 
			
		||||
                    job.run(context)
 | 
			
		||||
            except KeyboardInterrupt:
 | 
			
		||||
                job.set_status(Status.ABORTED)
 | 
			
		||||
                raise
 | 
			
		||||
            except Exception as e:
 | 
			
		||||
                job.set_status(Status.FAILED)
 | 
			
		||||
                log.log_error(e, self.logger)
 | 
			
		||||
@@ -484,7 +488,6 @@ class Runner(object):
 | 
			
		||||
 | 
			
		||||
        except KeyboardInterrupt:
 | 
			
		||||
            job.set_status(Status.ABORTED)
 | 
			
		||||
            self.logger.info('Got CTRL-C. Aborting.')
 | 
			
		||||
            raise
 | 
			
		||||
        finally:
 | 
			
		||||
            # If setup was successfully completed, teardown must
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user