Add Python AsyncIO to the party

pull/21904/head
Lidi Zheng 5 years ago
parent 49980a6db1
commit 1ba37eebd2
  1. 2
      tools/run_tests/performance/build_performance.sh
  2. 20
      tools/run_tests/performance/run_worker_python_asyncio.sh
  3. 78
      tools/run_tests/performance/scenario_config.py

@ -72,6 +72,8 @@ do
# python workers are only run with python2.7 and building with multiple python versions is costly
python tools/run_tests/run_tests.py -l "$language" -c "$CONFIG" --compiler python2.7 --build_only -j 8
;;
"python_asyncio")
python tools/run_tests/run_tests.py -l "$language" -c "$CONFIG" --compiler python3.7 --build_only -j 8
*)
python tools/run_tests/run_tests.py -l "$language" -c "$CONFIG" --build_only -j 8
;;

@ -0,0 +1,20 @@
#!/bin/bash
# Copyright 2020 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -ex
cd "$(dirname "$0")/../../.."
PYTHONPATH=src/python/grpcio_tests:src/python/gens py37_native/bin/python src/python/grpcio_tests/tests_aio/benchmark/worker.py "$@"

@ -816,6 +816,83 @@ class PythonLanguage:
return 'python'
class PythonAsyncIOLanguage:
def __init__(self):
self.safename = 'python_asyncio'
def worker_cmdline(self):
return ['tools/run_tests/performance/run_worker_python_asyncio.sh']
def worker_port_offset(self):
return 1200
def scenarios(self):
yield _ping_pong_scenario('python_asyncio_generic_async_streaming_ping_pong',
rpc_type='STREAMING',
client_type='ASYNC_CLIENT',
server_type='ASYNC_GENERIC_SERVER',
use_generic_payload=True,
categories=[SMOKETEST, SCALABLE])
yield _ping_pong_scenario('python_asyncio_protobuf_async_streaming_ping_pong',
rpc_type='STREAMING',
client_type='ASYNC_CLIENT',
server_type='ASYNC_SERVER')
yield _ping_pong_scenario('python_asyncio_protobuf_async_unary_ping_pong',
rpc_type='UNARY',
client_type='ASYNC_CLIENT',
server_type='ASYNC_SERVER')
yield _ping_pong_scenario('python_asyncio_protobuf_async_unary_ping_pong',
rpc_type='UNARY',
client_type='ASYNC_CLIENT',
server_type='ASYNC_SERVER',
categories=[SMOKETEST, SCALABLE])
yield _ping_pong_scenario(
'python_asyncio_protobuf_async_unary_qps_unconstrained',
rpc_type='UNARY',
client_type='ASYNC_CLIENT',
server_type='ASYNC_SERVER',
unconstrained_client='async')
yield _ping_pong_scenario(
'python_asyncio_protobuf_async_streaming_qps_unconstrained',
rpc_type='STREAMING',
client_type='ASYNC_CLIENT',
server_type='ASYNC_SERVER',
unconstrained_client='async')
yield _ping_pong_scenario('python_asyncio_to_cpp_protobuf_async_unary_ping_pong',
rpc_type='UNARY',
client_type='ASYNC_CLIENT',
server_type='ASYNC_SERVER',
server_language='python_asyncio',
async_server_threads=1,
categories=[SMOKETEST, SCALABLE])
yield _ping_pong_scenario(
'python_asyncio_to_cpp_protobuf_sync_streaming_ping_pong',
rpc_type='STREAMING',
client_type='SYNC_CLIENT',
server_type='ASYNC_SERVER',
server_language='python_asyncio',
async_server_threads=1)
yield _ping_pong_scenario('python_asyncio_protobuf_async_unary_ping_pong_1MB',
rpc_type='UNARY',
client_type='ASYNC_CLIENT',
server_type='ASYNC_SERVER',
req_size=1024 * 1024,
resp_size=1024 * 1024,
categories=[SMOKETEST, SCALABLE])
def __str__(self):
return 'python_asyncio'
class RubyLanguage:
def __init__(self):
@ -1249,6 +1326,7 @@ LANGUAGES = {
'php7_protobuf_c': Php7Language(php7_protobuf_c=True),
'java': JavaLanguage(),
'python': PythonLanguage(),
'python_asyncio': PythonAsyncIOLanguage(),
'go': GoLanguage(),
'node': NodeLanguage(),
'node_purejs': NodeLanguage(node_purejs=True)

Loading…
Cancel
Save