Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky test_worker_metrics #8069

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 8 additions & 5 deletions distributed/tests/test_worker_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ async def test_task_lifecycle(c, s, a, b):
del x, y, z
await async_poll_for(lambda: not a.state.tasks, timeout=5) # For hygene only

expect = [
# Note: use set instead of list to account for rare, but harmless, race conditions
expect = {
# a.gather_dep(worker=b.address, keys=["z"])
("gather-dep", "decompress", "seconds"),
("gather-dep", "deserialize", "seconds"),
Expand Down Expand Up @@ -112,8 +113,8 @@ async def test_task_lifecycle(c, s, a, b):
("get-data", "serialize", "seconds"),
("get-data", "compress", "seconds"),
("get-data", "network", "seconds"),
]
assert list(get_digests(a)) == expect
}
assert set(get_digests(a)) == expect

assert get_digests(a, allow="count") == {
("execute", span_id(s), "z", "disk-read", "count"): 2,
Expand Down Expand Up @@ -552,11 +553,13 @@ async def test_send_metrics_to_scheduler(c, s, a, b):
("execute", None, "x", "memory-read", "count"),
("execute", None, "x", "memory-read", "bytes"),
]
assert list(a_metrics) == list(b_metrics) == expect_worker
expect_scheduler = [
k[:1] + k[2:] if k[0] == "execute" else k for k in expect_worker
]
assert list(s_metrics) == expect_scheduler

# Note: use set instead of list to account for rare, but harmless, race conditions
assert set(a_metrics) == set(b_metrics) == set(expect_worker)
assert set(s_metrics) == set(expect_scheduler)

for wk, sk in zip(expect_worker, expect_scheduler):
if not WINDOWS:
Expand Down