Skip to content

Commit 3d2685c

Browse files
authored
Ensure memray profiler runs on all workers (#9095)
1 parent 9c8cd91 commit 3d2685c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

distributed/diagnostics/memray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def memray_workers(
131131
"""
132132
directory = pathlib.Path(directory)
133133
client = get_client()
134-
scheduler_info = client.scheduler_info()
134+
scheduler_info = client.scheduler_info(n_workers=-1)
135135
worker_addr = scheduler_info["workers"]
136136
worker_names = {
137137
addr: winfo["name"] for addr, winfo in scheduler_info["workers"].items()

distributed/diagnostics/tests/test_memray.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,20 @@
66

77
pytestmark = pytest.mark.extra_packages
88

9+
from distributed import Client, LocalCluster
910
from distributed.diagnostics.memray import memray_scheduler, memray_workers
1011

1112

13+
def test_all_workers(tmp_path, loop):
14+
n_workers = 7
15+
with LocalCluster(n_workers=n_workers, loop=loop) as cluster:
16+
with Client(cluster, loop=loop) as client:
17+
with memray_workers(tmp_path):
18+
pass
19+
20+
assert len(list(tmp_path.glob("*.html"))) == n_workers
21+
22+
1223
@pytest.mark.parametrize("fetch_reports_parallel", [True, False, 1])
1324
def test_basic_integration_workers(client, tmp_path, fetch_reports_parallel):
1425
with memray_workers(tmp_path, fetch_reports_parallel=fetch_reports_parallel):

0 commit comments

Comments
 (0)