Python client interceptor with retry

605 views
Skip to first unread message

Kristof

unread,
Jan 27, 2020, 5:30:40 PM1/27/20
to grpc.io
Hi 👋 

As far as I can tell the python client implementation doesn't yet support retries (is there a timeline).

Despite this, GitHub issues and documentation suggest that a retry mechanism is possible to implement in a python client with an interceptor.

As this seems like a generic problem that is applicable to all kinds of gRPC clients, somebody must have already implemented it open source.

Do you guys know of code examples on how to implement retry in a python interceptor?

Thanks

K

Richard Belleville

unread,
Jan 29, 2020, 2:05:00 PM1/29/20
to grpc.io
Kristof,

I don't currently have a timeline for in-library support for retries, but implementing it using interceptors isn't too difficult. Here's an example of an interceptor a member of the community shared a while ago.

Thanks,
Richard

James Wu

unread,
Jun 3, 2021, 5:42:58 PM6/3/21
to grpc.io
When I tried to adapt example interceptor as a stream-stream interceptor, it didn't quite work.

response = continuation(client_call_details, request)
isinstance(response, grpc.RpcError) # Returns True as expected
response.code() # Blocks

Is this expected? Is there a way to implement a retry interceptor for a unary-stream and stream-stream RPC?
Reply all
Reply to author
Forward
0 new messages