qps_worker.py
Go to the documentation of this file.
1 # Copyright 2016 gRPC authors.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 """The entry point for the qps worker."""
15 
16 import argparse
17 import logging
18 import time
19 
20 import grpc
21 
22 from src.proto.grpc.testing import worker_service_pb2_grpc
23 from tests.qps import worker_server
24 from tests.unit import test_common
25 
26 
27 def run_worker_server(driver_port, server_port):
28  server = test_common.test_server()
29  servicer = worker_server.WorkerServer(server_port)
30  worker_service_pb2_grpc.add_WorkerServiceServicer_to_server(
31  servicer, server)
32  server.add_insecure_port('[::]:{}'.format(driver_port))
33  server.start()
34  servicer.wait_for_quit()
35  server.stop(0)
36 
37 
38 if __name__ == '__main__':
39  logging.basicConfig(level=logging.DEBUG)
40  parser = argparse.ArgumentParser(
41  description='gRPC Python performance testing worker')
42  parser.add_argument(
43  '--driver_port',
44  type=int,
45  dest='driver_port',
46  help='The port for the worker to expose for driver communication')
47  parser.add_argument(
48  '--server_port',
49  type=int,
50  default=None,
51  dest='server_port',
52  help='The port for the server if not specified by server config message'
53  )
54  args = parser.parse_args()
55 
56  run_worker_server(args.driver_port, args.server_port)
http2_test_server.format
format
Definition: http2_test_server.py:118
tests.qps.qps_worker.run_worker_server
def run_worker_server(driver_port, server_port)
Definition: qps_worker.py:27
tests.qps
Definition: src/python/grpcio_tests/tests/qps/__init__.py:1
tests.unit
Definition: src/python/grpcio_tests/tests/unit/__init__.py:1
tests.qps.worker_server.WorkerServer
Definition: worker_server.py:35


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:59