using custom executor for grpc client for handling requests and response.

407 views
Skip to first unread message

Deepu Varma

unread,
Dec 28, 2021, 11:51:35 AM12/28/21
to grpc.io
Hii I have created grpc channel with host and load balancer here.

1)created channel
self.channel = grpc.insecure_channel(
self.host, options=[("grpc.lb_policy_name", "round_robin")]
)

2)created stub
self.blocking_stub = policy_pb2_grpc.ServiceStub(self.channel)

and I have used this stub along with metadata and timeout with request 
to call the service 

My question here is how can I add executor with custom threads from 
client side ?

I have seen java code to use custom executor but how can we do in python ?

Thanks.

Lidi Zheng

unread,
Dec 29, 2021, 1:19:22 PM12/29/21
to grpc.io
Sorry, that's not supported by Python yet. We do have an ongoing work on EventEngine API (https://github.com/grpc/proposal/pull/245) that can cover this functionality in future.

On the other hand, you are free to spawn your threads with the Python thread pool, the gRPC channel is safe to be used in multiple threads.


Reply all
Reply to author
Forward
0 new messages