aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Ken Payson <kpayson@google.com>2016-06-16 16:39:04 -0700
committerGravatar Ken Payson <kpayson@google.com>2016-06-16 16:39:04 -0700
commitbef286f034497ae5b391e00a1046e7c178d4ad32 (patch)
tree1922c2c0cf53160ae3627d4b28b81e7d2f33409f /src
parent1e52b1aadfabe911c1a238e186f590860a31d0de (diff)
Wait for channel to be connected for each client
Diffstat (limited to 'src')
-rw-r--r--src/python/grpcio/tests/qps/benchmark_client.py9
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)