Skip to content

Commit

Permalink
Limit max number of retries in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
borzunov committed Oct 22, 2023
1 parent f4ee2ab commit 5c63682
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ jobs:
export no_proxy=*
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
# Limit default ClientConfig.max_retries to see tracebacks instead of retrying indefinitely
export PETALS_MAX_RETRIES=10
pytest tests --durations=0 --durations-min=1.0 -v
# [Step 3] Check if benchmarks work (their results here are meaningless since it's a tiny swarm of CPU servers)
Expand Down
6 changes: 5 additions & 1 deletion src/petals/client/config.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import dataclasses
import os
from typing import Optional, Sequence, Union

from hivemind import PeerID

from petals.constants import PUBLIC_INITIAL_PEERS

_max_retries = os.getenv("PETALS_MAX_RETRIES")
DEFAULT_MAX_RETRIES = int(_max_retries) if isinstance(_max_retries, str) else None


@dataclasses.dataclass
class ClientConfig:
Expand All @@ -21,7 +25,7 @@ class ClientConfig:
request_timeout: float = 3 * 60 # timeout for forward/backward/inference requests
update_period: float = 60 # refresh DHT information once in this many seconds

max_retries: Optional[int] = None # max number retries before the client raises an exception (default: inf)
max_retries: Optional[int] = DEFAULT_MAX_RETRIES # max number of retries before an exception (default: inf)
min_backoff: float = 1 # after a repeated failure, sleep for this many seconds times 2 ** (num_failures - 1)
max_backoff: float = 60 # limit maximal sleep time between retries to this value
ban_timeout: float = 15 # when a remote peer fails to respond, prevent routing to that peer for this many seconds
Expand Down

0 comments on commit 5c63682

Please sign in to comment.