mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-03-01 08:18:37 +00:00
fw/job: only finalize if initialized
Only run finalize() for a job if initialize has succeed. finalize() should be able to assume that initialize() has succeed, without needing to check that that file have been created, variables set, etc.
This commit is contained in:
parent
f946f13838
commit
c0049d0a86
@ -28,6 +28,10 @@ class Job(object):
|
|||||||
def status(self):
|
def status(self):
|
||||||
return self._status
|
return self._status
|
||||||
|
|
||||||
|
@property
|
||||||
|
def has_been_initialized(self):
|
||||||
|
return self._has_been_initialized
|
||||||
|
|
||||||
@status.setter
|
@status.setter
|
||||||
def status(self, value):
|
def status(self, value):
|
||||||
self._status = value
|
self._status = value
|
||||||
@ -43,6 +47,7 @@ class Job(object):
|
|||||||
self.output = None
|
self.output = None
|
||||||
self.run_time = None
|
self.run_time = None
|
||||||
self.retries = 0
|
self.retries = 0
|
||||||
|
self._has_been_initialized = False
|
||||||
self._status = Status.NEW
|
self._status = Status.NEW
|
||||||
|
|
||||||
def load(self, target, loader=pluginloader):
|
def load(self, target, loader=pluginloader):
|
||||||
@ -67,6 +72,7 @@ class Job(object):
|
|||||||
self.workload.logger.context = context
|
self.workload.logger.context = context
|
||||||
self.workload.initialize(context)
|
self.workload.initialize(context)
|
||||||
self.set_status(Status.PENDING)
|
self.set_status(Status.PENDING)
|
||||||
|
self._has_been_initialized = True
|
||||||
context.update_job_state(self)
|
context.update_job_state(self)
|
||||||
|
|
||||||
def configure_augmentations(self, context, pm):
|
def configure_augmentations(self, context, pm):
|
||||||
@ -135,6 +141,8 @@ class Job(object):
|
|||||||
self.workload.teardown(context)
|
self.workload.teardown(context)
|
||||||
|
|
||||||
def finalize(self, context):
|
def finalize(self, context):
|
||||||
|
if not self._has_been_initialized:
|
||||||
|
return
|
||||||
if not context.tm.is_responsive:
|
if not context.tm.is_responsive:
|
||||||
self.logger.info('Target unresponsive; not finalizing.')
|
self.logger.info('Target unresponsive; not finalizing.')
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user