aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Bonnici <marc.bonnici@arm.com>2018-10-30 17:15:43 +0000
committersetrofim <setrofim@gmail.com>2018-12-07 09:55:17 +0000
commite81aaf342165b3f638870d96c0bfcba3277fa994 (patch)
tree911627f2a3de1a7cbac6c0bda89cf7f0935aa38a
parent2d7dc61686161b93476b2ade6b838b089aa1a7d4 (diff)
framework/output: Split out common Output functionality
In preparation for the creation of a DatabaseRunOut split out functionality that can be shared.
-rw-r--r--wa/framework/output.py51
1 files changed, 28 insertions, 23 deletions
diff --git a/wa/framework/output.py b/wa/framework/output.py
index a499564e..aa2d66c2 100644
--- a/wa/framework/output.py
+++ b/wa/framework/output.py
@@ -165,8 +165,35 @@ class Output(object):
def __str__(self):
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
+
+ @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):
+class RunOutput(Output, RunOutputCommon):
kind = 'run'
@@ -208,16 +235,6 @@ class RunOutput(Output):
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
def augmentations(self):
run_augs = set([])
for job in self.jobs:
@@ -302,18 +319,6 @@ class RunOutput(Output):
shutil.move(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):