Update method naming & use os.path.join

pull/21904/head
Lidi Zheng 5 years ago
parent dbdb2cc5c9
commit c0e1dbc445
  1. 9
      src/python/grpcio_tests/tests_aio/benchmark/benchmark_client.py
  2. 3
      src/python/grpcio_tests/tests_aio/benchmark/worker_servicer.py

@ -108,14 +108,14 @@ class UnaryAsyncBenchmarkClient(BenchmarkClient):
await self._stub.UnaryCall(self._request)
self._record_query_time(time.monotonic() - start_time)
async def _infinite_sender(self) -> None:
async def _send_indefinitely(self) -> None:
while self._running:
await self._send_request()
async def run(self) -> None:
await super().run()
self._running = True
senders = (self._infinite_sender() for _ in range(self._concurrency))
senders = (self._send_indefinitely() for _ in range(self._concurrency))
await asyncio.gather(*senders)
self._stopped.set()
@ -133,7 +133,7 @@ class StreamingAsyncBenchmarkClient(BenchmarkClient):
self._running = None
self._stopped = asyncio.Event()
async def _one_streamming_call(self):
async def _one_streaming_call(self):
call = self._stub.StreamingCall()
while self._running:
start_time = time.time()
@ -145,8 +145,7 @@ class StreamingAsyncBenchmarkClient(BenchmarkClient):
async def run(self):
await super().run()
self._running = True
senders = (
self._one_streamming_call() for _ in range(self._concurrency))
senders = (self._one_streaming_call() for _ in range(self._concurrency))
await asyncio.gather(*senders)
self._stopped.set()

@ -32,7 +32,8 @@ from tests.unit.framework.common import get_socket
from tests_aio.benchmark import benchmark_client, benchmark_servicer
_NUM_CORES = multiprocessing.cpu_count()
_WORKER_ENTRY_FILE = os.path.split(os.path.abspath(__file__))[0] + '/worker.py'
_WORKER_ENTRY_FILE = os.path.join(
os.path.split(os.path.abspath(__file__))[0], '/worker.py')
_LOGGER = logging.getLogger(__name__)

Loading…
Cancel
Save