Skip to content

Commit

Permalink
Issue #5 apply upload_assets on real benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Jul 26, 2024
1 parent 101d4ce commit 14c7444
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/benchmarks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ jobs:
mkdir report
mkdir tmp_path_root
pytest \
--dummy \
--random-subset=1 \
-k max_ndvi_fail_intentionally \
--html report/report.html --self-contained-html \
--track-metrics-report=report/metrics.json \
--basetemp=tmp_path_root
Expand Down
14 changes: 11 additions & 3 deletions qa/benchmarks/tests/test_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
],
)
def test_run_benchmark(
scenario: BenchmarkScenario, connection_factory, tmp_path: Path, track_metric
scenario: BenchmarkScenario,
connection_factory,
tmp_path: Path,
track_metric,
upload_assets,
):
connection: openeo.Connection = connection_factory(url=scenario.backend)

Expand All @@ -39,8 +43,12 @@ def test_run_benchmark(

# Download actual results
actual_dir = tmp_path / "actual"
job.get_results().download_files(target=actual_dir, include_stac_metadata=True)
# TODO: upload actual results to somewhere?
paths = job.get_results().download_files(
target=actual_dir, include_stac_metadata=True
)

# Upload assets on failure
upload_assets(*paths)

# Compare actual results with reference data
reference_dir = download_reference_data(
Expand Down
9 changes: 5 additions & 4 deletions qa/tools/apex_algorithm_qa_tools/pytest_upload_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ def upload_assets(pytestconfig, tmp_path) -> Callable[[Path], None]:
"""
uploader = pytestconfig.pluginmanager.get_plugin(_PLUGIN_NAME)

def collect(path: Path):
assert path.is_relative_to(tmp_path)
name = str(path.relative_to(tmp_path))
uploader.collector.collect(path=path, name=name)
def collect(*paths: Path):
for path in paths:
assert path.is_relative_to(tmp_path)
name = str(path.relative_to(tmp_path))
uploader.collector.collect(path=path, name=name)

return collect

0 comments on commit 14c7444

Please sign in to comment.