1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-06 10:51:13 +01:00

framework/execution: Factor out skip_job method

This also fixes the missing housekeeping when skipping a job due to phones_home
This commit is contained in:
Brendan Jackman 2017-10-23 16:38:59 +01:00
parent ccaeb5a142
commit 4a001713bb

View File

@ -174,12 +174,15 @@ 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_job(self, job):
job.status = Status.SKIPPED
self.run_state.update_job(job)
self.completed_jobs.append(job)
def skip_remaining_jobs(self): def skip_remaining_jobs(self):
while self.job_queue: while self.job_queue:
job = self.job_queue.pop(0) job = self.job_queue.pop(0)
job.status = Status.SKIPPED self.skip_job(job)
self.run_state.update_job(job)
self.completed_jobs.append(job)
self.write_state() self.write_state()
def write_state(self): def write_state(self):
@ -421,7 +424,7 @@ class Runner(object):
if job.workload.phones_home and not rc.allow_phone_home: if job.workload.phones_home and not rc.allow_phone_home:
self.logger.warning('Skipping job {} ({}) due to allow_phone_home=False' self.logger.warning('Skipping job {} ({}) due to allow_phone_home=False'
.format(job.id, job.workload.name)) .format(job.id, job.workload.name))
job.set_status(Status.SKIPPED) self.context.skip_job(job)
return return
job.set_status(Status.RUNNING) job.set_status(Status.RUNNING)