diff options
Diffstat (limited to 'src/python/grpcio/tests/qps/benchmark_client.py')
-rw-r--r-- | src/python/grpcio/tests/qps/benchmark_client.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/python/grpcio/tests/qps/benchmark_client.py b/src/python/grpcio/tests/qps/benchmark_client.py index 1b100bb168..080281415d 100644 --- a/src/python/grpcio/tests/qps/benchmark_client.py +++ b/src/python/grpcio/tests/qps/benchmark_client.py @@ -30,11 +30,13 @@ """Defines test client behaviors (UNARY/STREAMING) (SYNC/ASYNC).""" import abc +import threading import time from concurrent import futures from six.moves import queue +import grpc from grpc.beta import implementations from grpc.framework.interfaces.face import face from src.proto.grpc.testing import messages_pb2 @@ -62,6 +64,13 @@ class BenchmarkClient: else: channel = implementations.insecure_channel(host, port) + connected_event = threading.Event() + def wait_for_ready(connectivity): + if connectivity == grpc.ChannelConnectivity.READY: + connected_event.set() + channel.subscribe(wait_for_ready, try_to_connect=True) + connected_event.wait() + if config.payload_config.WhichOneof('payload') == 'simple_params': self._generic = False self._stub = services_pb2.beta_create_BenchmarkService_stub(channel) |