Skip to content

Commit

Permalink
Add retry invoker
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnugraha committed Apr 4, 2024
1 parent 97c24b3 commit f6832e8
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/py/flwr/client/client_interceptor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import unittest
from concurrent import futures
from typing import Optional, Sequence, Tuple, Union
from flwr.common.retry_invoker import RetryInvoker, exponential

import grpc

Expand Down Expand Up @@ -149,9 +150,19 @@ def setUp(self) -> None:

def test_client_auth_create_node(self) -> None:
"""Test client authentication during create node."""
retry_invoker = RetryInvoker(
wait_gen_factory=exponential,
recoverable_exceptions=grpc.RpcError,
max_tries=None,
max_time=None,
on_giveup=lambda retry_state: (),
on_success=lambda retry_state: (),
on_backoff=lambda retry_state: (),
)
with self._connection(
self._address,
True,
retry_invoker,
GRPC_MAX_MESSAGE_LENGTH,
None,
(self._client_interceptor),
Expand All @@ -171,9 +182,19 @@ def test_client_auth_create_node(self) -> None:

def test_client_auth_delete_node(self) -> None:
"""Test client authentication during delete node."""
retry_invoker = RetryInvoker(
wait_gen_factory=exponential,
recoverable_exceptions=grpc.RpcError,
max_tries=None,
max_time=None,
on_giveup=lambda retry_state: (),
on_success=lambda retry_state: (),
on_backoff=lambda retry_state: (),
)
with self._connection(
self._address,
True,
retry_invoker,
GRPC_MAX_MESSAGE_LENGTH,
None,
(self._client_interceptor),
Expand Down

0 comments on commit f6832e8

Please sign in to comment.