mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-21 12:28:44 +00:00
Implement job skipping on abort
This commit is contained in:
parent
24ade78c36
commit
482a936639
@ -141,6 +141,14 @@ class ExecutionContext(object):
|
|||||||
self.run_state.update_job(job)
|
self.run_state.update_job(job)
|
||||||
self.run_output.write_state()
|
self.run_output.write_state()
|
||||||
|
|
||||||
|
def skip_remaining_jobs(self):
|
||||||
|
while self.job_queue:
|
||||||
|
job = self.job_queue.pop(0)
|
||||||
|
job.status = JobStatus.SKIPPED
|
||||||
|
self.run_state.update_job(job)
|
||||||
|
self.completed_jobs.append(job)
|
||||||
|
self.write_state()
|
||||||
|
|
||||||
def write_state(self):
|
def write_state(self):
|
||||||
self.run_output.write_state()
|
self.run_output.write_state()
|
||||||
|
|
||||||
@ -276,8 +284,11 @@ class Runner(object):
|
|||||||
self.send(signal.RUN_INITIALIZED)
|
self.send(signal.RUN_INITIALIZED)
|
||||||
|
|
||||||
while self.context.job_queue:
|
while self.context.job_queue:
|
||||||
with signal.wrap('JOB_EXECUTION', self):
|
try:
|
||||||
self.run_next_job(self.context)
|
with signal.wrap('JOB_EXECUTION', self):
|
||||||
|
self.run_next_job(self.context)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
self.context.skip_remaining_jobs()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if (not getattr(e, 'logged', None) and
|
if (not getattr(e, 'logged', None) and
|
||||||
not isinstance(e, KeyboardInterrupt)):
|
not isinstance(e, KeyboardInterrupt)):
|
||||||
@ -347,6 +358,7 @@ class Runner(object):
|
|||||||
raise
|
raise
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
job.status = JobStatus.ABORTED
|
job.status = JobStatus.ABORTED
|
||||||
|
self.logger.info('Got CTRL-C. Aborting.')
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
job.status = JobStatus.FAILED
|
job.status = JobStatus.FAILED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user