aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio/tests/qps
diff options
context:
space:
mode:
authorGravatar Ken Payson <kpayson@google.com>2016-06-08 13:06:44 -0700
committerGravatar Ken Payson <kpayson@google.com>2016-06-10 11:48:24 -0700
commit1efb6017ec1edb26706895dfe71f4d72ea387cf4 (patch)
treeeaede04a7db3e55c9c0954185192dc84231c2637 /src/python/grpcio/tests/qps
parent698d3e91ff42db3fe640cc369e8edf85abc5343d (diff)
Initial Python3 support
Notable Changes: -Convert all str types to byte types at cython layer (ascii encoding) -Use six for packages that have different names in Python2/Python3 -By default, unit tests are compiled/run in Python2.7 and Python3.4 -Ensure MACOSX_BUILD_TARGET is at least 10.7
Diffstat (limited to 'src/python/grpcio/tests/qps')
-rw-r--r--src/python/grpcio/tests/qps/benchmark_client.py5
-rw-r--r--src/python/grpcio/tests/qps/client_runner.py9
2 files changed, 7 insertions, 7 deletions
diff --git a/src/python/grpcio/tests/qps/benchmark_client.py b/src/python/grpcio/tests/qps/benchmark_client.py
index e2922347f9..1b100bb168 100644
--- a/src/python/grpcio/tests/qps/benchmark_client.py
+++ b/src/python/grpcio/tests/qps/benchmark_client.py
@@ -31,12 +31,9 @@
import abc
import time
-try:
- import Queue as queue # Python 2.x
-except ImportError:
- import queue # Python 3
from concurrent import futures
+from six.moves import queue
from grpc.beta import implementations
from grpc.framework.interfaces.face import face
diff --git a/src/python/grpcio/tests/qps/client_runner.py b/src/python/grpcio/tests/qps/client_runner.py
index 2d1d981733..1fd58687ad 100644
--- a/src/python/grpcio/tests/qps/client_runner.py
+++ b/src/python/grpcio/tests/qps/client_runner.py
@@ -34,7 +34,7 @@ ClientRunner invokes either periodically or in response to some event.
"""
import abc
-import thread
+import threading
import time
@@ -61,15 +61,18 @@ class OpenLoopClientRunner(ClientRunner):
super(OpenLoopClientRunner, self).__init__(client)
self._is_running = False
self._interval_generator = interval_generator
+ self._dispatch_thread = threading.Thread(
+ target=self._dispatch_requests, args=())
def start(self):
self._is_running = True
self._client.start()
- thread.start_new_thread(self._dispatch_requests, ())
-
+ self._dispatch_thread.start()
+
def stop(self):
self._is_running = False
self._client.stop()
+ self._dispatch_thread.join()
self._client = None
def _dispatch_requests(self):