The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#) https://grpc.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Sergii Tkachenko de6ed9ba9f
[Python] Migrate from yapf to black (#33138)
2 years ago
..
README.md Add retry example for gRPC Python (#26829) 3 years ago
async_retry_client.py [Python] Migrate from yapf to black (#33138) 2 years ago
flaky_server.py [Python] Migrate from yapf to black (#33138) 2 years ago
helloworld.proto Add retry example for gRPC Python (#26829) 3 years ago
retry_client.py [Python] Migrate from yapf to black (#33138) 2 years ago

README.md

Retry Example in gRPC Python

Prerequisite

  • grpcio >= 1.39.0
  • grpcio-tools >= 1.39.0

Running the example

In terminal 1, start the flaky server:

python3 flaky_server.py

In terminal 2, start the retry clients:

python3 retry_client.py
# Or
python3 async_retry_client.py

Expect results

The client RPC will succeed, even with server injecting multiple errors. Here is an example server log:

$ python3 flaky_server.py
INFO:root:Starting flaky server on [::]:50051
INFO:root:Injecting error to RPC from ipv6:[::1]:54471
INFO:root:Successfully responding to RPC from ipv6:[::1]:54473
INFO:root:Injecting error to RPC from ipv6:[::1]:54491
INFO:root:Injecting error to RPC from ipv6:[::1]:54581
INFO:root:Injecting error to RPC from ipv6:[::1]:54581
INFO:root:Injecting error to RPC from ipv6:[::1]:54581
INFO:root:Injecting error to RPC from ipv6:[::1]:54581
INFO:root:Successfully responding to RPC from ipv6:[::1]:54581
INFO:root:Injecting error to RPC from ipv6:[::1]:55474
INFO:root:Injecting error to RPC from ipv6:[::1]:55474
INFO:root:Injecting error to RPC from ipv6:[::1]:55474
INFO:root:Injecting error to RPC from ipv6:[::1]:55474
INFO:root:Successfully responding to RPC from ipv6:[::1]:55474
INFO:root:Injecting error to RPC from ipv6:[::1]:55533
INFO:root:Injecting error to RPC from ipv6:[::1]:55533
INFO:root:Injecting error to RPC from ipv6:[::1]:55533
INFO:root:Successfully responding to RPC from ipv6:[::1]:55533