From 5bf9f05c4bc55262b65c0b3bdebc2c20d6ae0ee5 Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Tue, 14 Apr 2015 14:38:59 +0100 Subject: [PATCH] Updating result object to track their output directories. Also, context.result will no result in context.run_result when not executing a job. --- wlauto/core/execution.py | 7 ++++--- wlauto/core/result.py | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/wlauto/core/execution.py b/wlauto/core/execution.py index abd5ea36..f2bf7876 100644 --- a/wlauto/core/execution.py +++ b/wlauto/core/execution.py @@ -133,7 +133,7 @@ class ExecutionContext(object): @property def result(self): - return getattr(self.current_job, 'result', None) + return getattr(self.current_job, 'result', self.run_result) def __init__(self, device, config): self.device = device @@ -172,17 +172,18 @@ class ExecutionContext(object): self.output_directory = self.run_output_directory self.resolver = ResourceResolver(self.config) self.run_info = RunInfo(self.config) - self.run_result = RunResult(self.run_info) + self.run_result = RunResult(self.run_info, self.run_output_directory) def next_job(self, job): """Invoked by the runner when starting a new iteration of workload execution.""" self.current_job = job self.job_iteration_counts[self.spec.id] += 1 - self.current_job.result.iteration = self.current_iteration if not self.aborted: outdir_name = '_'.join(map(str, [self.spec.label, self.spec.id, self.current_iteration])) self.output_directory = _d(os.path.join(self.run_output_directory, outdir_name)) self.iteration_artifacts = [wa for wa in self.workload.artifacts] + self.current_job.result.iteration = self.current_iteration + self.current_job.result.output_directory = self.output_directory def end_job(self): if self.current_job.result.status == IterationResult.ABORTED: diff --git a/wlauto/core/result.py b/wlauto/core/result.py index 900cbeb9..58df6212 100644 --- a/wlauto/core/result.py +++ b/wlauto/core/result.py @@ -191,12 +191,13 @@ class RunResult(object): else: return self.UNKNOWN # should never happen - def __init__(self, run_info): + def __init__(self, run_info, output_directory=None): self.info = run_info self.iteration_results = [] self.artifacts = [] self.events = [] self.non_iteration_errors = False + self.output_directory = output_directory class RunEvent(object): @@ -255,6 +256,7 @@ class IterationResult(object): self.workload = spec.workload self.iteration = None self.status = self.NOT_STARTED + self.output_directory = None self.events = [] self.metrics = [] self.artifacts = []