Easy, thanks very much. I should have looked at the code for the _Rendezvous object, rather than getting frustrated with the documentation.
On Friday, 15 March 2019 08:26:59 UTC+1, Lidi Zheng wrote: > > Can you try “stream.cancel()”? The “cancel()” method is available for both > client context and server context. See *class *grpc.*RpcContext in * > *https://grpc.io/grpc/python/grpc.html#client-side-context > <https://grpc.io/grpc/python/grpc.html#client-side-context>.* > > On Thu, Mar 14, 2019 at 23:54 Mark Nuttall-Smith <[email protected] > <javascript:>> wrote: > >> 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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> 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 >> >> <https://groups.google.com/d/msgid/grpc-io/2b7ed001-d5b9-452b-b4dd-fbcb905687b3%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- 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/ed676a15-2b99-42e3-a5fd-38e5e76f7e6f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
