Skip to content

Commit

Permalink
Allow collection of performance reports
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikmakait committed Oct 24, 2024
1 parent 2f9350c commit 79e1615
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
30 changes: 30 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,3 +910,33 @@ def _memray_profile(client):
s3.put(archive, s3_performance_url)

yield _memray_profile


@pytest.fixture
def performance_report(
pytestconfig,
s3,
s3_performance_url,
s3_storage_options,
test_run_benchmark,
tmp_path,
):
if not test_run_benchmark:
yield
else:
if not pytestconfig.getoption("--performance-report"):
yield
else:

@contextlib.contextmanager
def _performance_report():
try:
filename = f"{s3_performance_url}/performance_report.html.gz"
with distributed.performance_report(
filename=filename, storage_options=s3_storage_options
):
yield
finally:
test_run_benchmark.performance_report_url = filename

yield _performance_report
8 changes: 6 additions & 2 deletions tests/geospatial/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ def cluster_name(request, scale):


@pytest.fixture()
def client_factory(cluster_name, github_cluster_tags, benchmark_all, memray_profile):
def client_factory(
cluster_name, github_cluster_tags, benchmark_all, memray_profile, performance_report
):
import contextlib

@contextlib.contextmanager
Expand All @@ -43,7 +45,9 @@ def _(n_workers, env=None, **cluster_kwargs):
with cluster.get_client() as client:
# FIXME https://github.com/coiled/platform/issues/103
client.wait_for_workers(n_workers)
with memray_profile(client), benchmark_all(client):
with performance_report(), memray_profile(client), benchmark_all(
client
):
yield client

return _

0 comments on commit 79e1615

Please sign in to comment.