1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-02 11:22:41 +01:00

framework: Have Job hold its own JobState

JobState, previously handled by RunState, is now held in the
Job.

Changes and accesses to a Job's status access the Job's
JobState directly, so that there is only one place now that each Job's
state data is tracked.

This also means there is no use for update_job in RunState.
This commit is contained in:
Jonathan Paynter
2020-07-01 10:36:52 +00:00
committed by Marc Bonnici
parent 8640f4f69a
commit 7c6ebfb49c
2 changed files with 14 additions and 12 deletions

View File

@@ -102,13 +102,7 @@ class RunState(Podable):
self.timestamp = datetime.utcnow()
def add_job(self, job):
job_state = JobState(job.id, job.label, job.iteration, job.status)
self.jobs[(job_state.id, job_state.iteration)] = job_state
def update_job(self, job):
state = self.jobs[(job.id, job.iteration)]
state.status = job.status
state.timestamp = datetime.utcnow()
self.jobs[(job.state.id, job.state.iteration)] = job.state
def get_status_counts(self):
counter = Counter()