aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-06-16 17:47:31 -0700
committerGravatar GitHub <noreply@github.com>2016-06-16 17:47:31 -0700
commit8615cce1eff5ae1ed1656d5025831ec1e04c2a69 (patch)
tree12c3f0669e647279a8863f801d9e1364d99a9a32 /src/python/grpcio
parentc2b55afffd16af369a37e5c0738201cf8a5ceebf (diff)
parentbef286f034497ae5b391e00a1046e7c178d4ad32 (diff)
Merge pull request #6943 from kpayson64/python_qps_wait
Wait for channel to be connected on QPS Client
Diffstat (limited to 'src/python/grpcio')
-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)