1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-31 10:11:17 +00:00

framework/output: add target_info to RunOutput

Make TargetInfo an attribute of run output, replacing the read/write
methods for the targetfile. Instead, always load it on creation, if
targetfile exists (useful for external scripts), and have a method to
set it after creation (uselful during WA run, where the output is
created before connecting to the target).
This commit is contained in:
Sergei Trofimov 2017-12-13 11:43:40 +00:00 committed by marcbonnici
parent 3ab0aa04de
commit 4a239790d2
2 changed files with 6 additions and 7 deletions

View File

@ -290,7 +290,7 @@ class Executor(object):
self.target_manager = TargetManager(config.run_config.device,
config.run_config.device_config,
output.basepath)
output.write_target_info(self.target_manager.get_target_info())
output.set_target_info(self.target_manager.get_target_info())
self.logger.info('Initializing execution context')
context = ExecutionContext(config_manager, self.target_manager, output)

View File

@ -147,6 +147,7 @@ class RunOutput(Output):
self.info = None
self.state = None
self.result = None
self.target_info = None
self.jobs = []
if (not os.path.isfile(self.statefile) or
not os.path.isfile(self.infofile)):
@ -159,6 +160,8 @@ class RunOutput(Output):
self.info = RunInfo.from_pod(read_pod(self.infofile))
self.state = RunState.from_pod(read_pod(self.statefile))
# TODO: propulate the jobs from info in the state
if os.path.isfile(self.targetfile):
self.target_info = TargetInfo.from_pod(read_pod(self.targetfile))
def write_info(self):
write_pod(self.info.to_pod(), self.infofile)
@ -174,14 +177,10 @@ class RunOutput(Output):
return None
return ConfigManager.from_pod(read_pod(self.configfile))
def write_target_info(self, ti):
def set_target_info(self, ti):
self.target_info = ti
write_pod(ti.to_pod(), self.targetfile)
def read_target_config(self):
if not os.path.isfile(self.targetfile):
return None
return TargetInfo.from_pod(read_pod(self.targetfile))
def write_job_specs(self, job_specs):
job_specs[0].to_pod()
js_pod = {'jobs': [js.to_pod() for js in job_specs]}