Skip to content
Snippets Groups Projects
Commit b9fda30a authored by r.jaepel's avatar r.jaepel
Browse files

Add .results_path to Case()

parent 63c88e7f
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,7 @@ class Case:
self.name = name
self.study = study
self.options = options
self._results_branch = None
@property
def status_file(self):
......@@ -87,13 +88,26 @@ class Case:
@property
def has_results_for_this_run(self):
if self.results_branch == "not found":
return False
else:
return True
@property
def results_branch(self):
if self._results_branch is None:
self._results_branch = self._get_results_branch()
return self._results_branch
def _get_results_branch(self):
output_log = self.study.output_log
for log_entry in output_log:
if (self.study.current_commit_hash == log_entry.project_repo_commit_hash
and self.options.hash == log_entry.options_hash):
return True
return log_entry.output_repo_branch
return False
return "not found"
def run_study(self, force=False):
"""Run specified study commands in the given repository."""
......@@ -128,3 +142,23 @@ class Case:
print(f"Command execution failed: {e}")
self.status = 'failed'
return
@property
def _results_path(self):
return self.study.path / (self.study._output_folder + "_cached") / self.results_branch
def load(self, ):
if self.results_branch is None:
print(f"No results available for Case({self.study.path, self.options.hash[:7]})")
return None
if self._results_path.exists():
return
self.study.copy_data_to_cache(self.results_branch)
@property
def results_path(self):
self.load()
return self._results_branch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment