Skip to content

Commit

Permalink
store aggregated results in separate folder
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Oviedo <mikeovi@amazon.com>
  • Loading branch information
OVI3D0 committed Oct 16, 2024
1 parent 2596bb8 commit d04f9f2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion osbenchmark/aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def aggregate(self) -> None:

aggregated_results = self.build_aggregated_results()
file_test_exe_store = FileTestExecutionStore(self.config)
file_test_exe_store.store_test_execution(aggregated_results)
file_test_exe_store.store_aggregated_execution(aggregated_results)
else:
raise ValueError("Incompatible test execution results")

Expand Down
8 changes: 8 additions & 0 deletions osbenchmark/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1549,6 +1549,14 @@ def store_test_execution(self, test_execution):
io.ensure_dir(test_execution_path)
with open(self._test_execution_file(), mode="wt", encoding="utf-8") as f:
f.write(json.dumps(doc, indent=True, ensure_ascii=False))

def store_aggregated_execution(self, test_execution):
doc = test_execution.as_dict()
aggregated_execution_path = paths.aggregated_results_root(self.cfg, test_execution_id=test_execution.test_execution_id)
io.ensure_dir(aggregated_execution_path)
aggregated_file = os.path.join(aggregated_execution_path, "test_execution.json")
with open(aggregated_file, mode="wt", encoding="utf-8") as f:
f.write(json.dumps(doc, indent=True, ensure_ascii=False))

def _test_execution_file(self, test_execution_id=None):
return os.path.join(paths.test_execution_root(cfg=self.cfg, test_execution_id=test_execution_id), "test_execution.json")
Expand Down
4 changes: 4 additions & 0 deletions osbenchmark/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def test_execution_root(cfg, test_execution_id=None):
test_execution_id = cfg.opts("system", "test_execution.id")
return os.path.join(test_excecutions_root(cfg), test_execution_id)

def aggregated_results_root(cfg, test_execution_id=None):
if not test_execution_id:
test_execution_id = cfg.opts("system", "test_execution.id")
return os.path.join(cfg.opts("node", "root.dir"), "aggregated_results", test_execution_id)

def install_root(cfg=None):
install_id = cfg.opts("system", "install.id")
Expand Down

0 comments on commit d04f9f2

Please sign in to comment.