Hi,

Using Python gRPC, I would like to be able to cancel a long-running 
unary-stream call from the client side, when a `threading.Event` is set.

    def application(stub: StreamsStub, event: threading.Event):
        stream = stub.Application(ApplicationStreamRequest())
        try:
            for resp in stream:
                print(resp)
        except grpc.RpcError as e:
            print(e)

For the time being I am cancelling the stream using the `channel.close()` 
method, but of course this closes all connections rather than just this 
stream.

Could someone suggest how I can use the event to cancel the stream 
iterator? 

Thanks, Mark

(cross post from SO: 
https://stackoverflow.com/questions/55160210/python-grpc-cancel-unary-stream-call-from-client-side
)

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/2b7ed001-d5b9-452b-b4dd-fbcb905687b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to