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 excessive logging on P2P retry #8511

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions distributed/shuffle/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@
import itertools
import pickle
import time
from collections.abc import Callable, Generator, Hashable, Iterable, Iterator, Sequence
from collections.abc import (
Callable,
Coroutine,
Generator,
Hashable,
Iterable,
Iterator,
Sequence,
)
from concurrent.futures import ThreadPoolExecutor
from dataclasses import dataclass, field
from enum import Enum
Expand Down Expand Up @@ -212,8 +220,11 @@
else:
shards_or_bytes = shards

def _send() -> Coroutine[Any, Any, None]:
return self._send(address, shards_or_bytes)

Check warning on line 224 in distributed/shuffle/_core.py

View check run for this annotation

Codecov / codecov/patch

distributed/shuffle/_core.py#L223-L224

Added lines #L223 - L224 were not covered by tests

return await retry(
partial(self._send, address, shards_or_bytes),
_send,
count=self.RETRY_COUNT,
delay_min=self.RETRY_DELAY_MIN,
delay_max=self.RETRY_DELAY_MAX,
Expand Down
13 changes: 9 additions & 4 deletions distributed/shuffle/tests/test_shuffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
from distributed.utils import Deadline
from distributed.utils_test import (
async_poll_for,
captured_logger,
cluster,
gen_cluster,
gen_test,
Expand Down Expand Up @@ -2642,10 +2643,14 @@ async def test_flaky_connect_recover_with_retry(c, s, a, b):
x = dd.shuffle.shuffle(df, "x")

rpc = await FlakyConnectionPool(failing_connects=1)

with mock.patch.object(a, "rpc", rpc):
await c.compute(x)
assert rpc.failed_attempts == 1
with captured_logger("distributed.utils_comm") as caplog:
with mock.patch.object(a, "rpc", rpc):
await c.compute(x)
assert rpc.failed_attempts == 1
# Assert that we do not log the binary payload (or any other excessive amount of data)
logs = caplog.getvalue()
assert len(logs) < 600
assert "Retrying" in logs

await check_worker_cleanup(a)
await check_worker_cleanup(b)
Expand Down
Loading