mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-12 07:59:04 +00:00
framework/output: Split out common Output functionality
In preparation for the creation of a DatabaseRunOut split out functionality that can be shared.
This commit is contained in:
parent
2d7dc61686
commit
e81aaf3421
@ -165,8 +165,35 @@ class Output(object):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return os.path.basename(self.basepath)
|
return os.path.basename(self.basepath)
|
||||||
|
|
||||||
|
class RunOutputCommon(object):
|
||||||
|
''' Split out common functionality to form a second base of
|
||||||
|
the RunOutput classes
|
||||||
|
'''
|
||||||
|
@property
|
||||||
|
def run_config(self):
|
||||||
|
if self._combined_config:
|
||||||
|
return self._combined_config.run_config
|
||||||
|
|
||||||
class RunOutput(Output):
|
@property
|
||||||
|
def settings(self):
|
||||||
|
if self._combined_config:
|
||||||
|
return self._combined_config.settings
|
||||||
|
|
||||||
|
def get_job_spec(self, spec_id):
|
||||||
|
for spec in self.job_specs:
|
||||||
|
if spec.id == spec_id:
|
||||||
|
return spec
|
||||||
|
return None
|
||||||
|
|
||||||
|
def list_workloads(self):
|
||||||
|
workloads = []
|
||||||
|
for job in self.jobs:
|
||||||
|
if job.label not in workloads:
|
||||||
|
workloads.append(job.label)
|
||||||
|
return workloads
|
||||||
|
|
||||||
|
|
||||||
|
class RunOutput(Output, RunOutputCommon):
|
||||||
|
|
||||||
kind = 'run'
|
kind = 'run'
|
||||||
|
|
||||||
@ -207,16 +234,6 @@ class RunOutput(Output):
|
|||||||
path = os.path.join(self.basepath, '__failed')
|
path = os.path.join(self.basepath, '__failed')
|
||||||
return ensure_directory_exists(path)
|
return ensure_directory_exists(path)
|
||||||
|
|
||||||
@property
|
|
||||||
def run_config(self):
|
|
||||||
if self._combined_config:
|
|
||||||
return self._combined_config.run_config
|
|
||||||
|
|
||||||
@property
|
|
||||||
def settings(self):
|
|
||||||
if self._combined_config:
|
|
||||||
return self._combined_config.settings
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def augmentations(self):
|
def augmentations(self):
|
||||||
run_augs = set([])
|
run_augs = set([])
|
||||||
@ -302,18 +319,6 @@ class RunOutput(Output):
|
|||||||
shutil.move(job_output.basepath, failed_path)
|
shutil.move(job_output.basepath, failed_path)
|
||||||
job_output.basepath = failed_path
|
job_output.basepath = failed_path
|
||||||
|
|
||||||
def get_job_spec(self, spec_id):
|
|
||||||
for spec in self.job_specs:
|
|
||||||
if spec.id == spec_id:
|
|
||||||
return spec
|
|
||||||
return None
|
|
||||||
|
|
||||||
def list_workloads(self):
|
|
||||||
workloads = []
|
|
||||||
for job in self.jobs:
|
|
||||||
if job.label not in workloads:
|
|
||||||
workloads.append(job.label)
|
|
||||||
return workloads
|
|
||||||
|
|
||||||
|
|
||||||
class JobOutput(Output):
|
class JobOutput(Output):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user