aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio_tests/tests/interop/server.py
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2016-08-18 10:00:18 -0700
committerGravatar GitHub <noreply@github.com>2016-08-18 10:00:18 -0700
commitf4112fc06e126ae4adc4dce99d71d021ff36bf9a (patch)
tree9dcd6f609dffdde48e726e8e83f6ddc70c185e4c /src/python/grpcio_tests/tests/interop/server.py
parent9770206fc41ee51e26bc9d3dedb5a69f2a8c0dc4 (diff)
parente1ee20bde6c30f0aa5a6f5309d20971ccd0122a7 (diff)
Merge pull request #7741 from nicolasnoble/manual-upmerge
Manual upmerge from v1.0.x to master.
Diffstat (limited to 'src/python/grpcio_tests/tests/interop/server.py')
-rw-r--r--src/python/grpcio_tests/tests/interop/server.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/python/grpcio_tests/tests/interop/server.py b/src/python/grpcio_tests/tests/interop/server.py
index ab2c3c708f..1ae83bc57d 100644
--- a/src/python/grpcio_tests/tests/interop/server.py
+++ b/src/python/grpcio_tests/tests/interop/server.py
@@ -30,10 +30,11 @@
"""The Python implementation of the GRPC interoperability test server."""
import argparse
+from concurrent import futures
import logging
import time
-from grpc.beta import implementations
+import grpc
from src.proto.grpc.testing import test_pb2
from tests.interop import methods
@@ -51,12 +52,13 @@ def serve():
default=False, type=resources.parse_bool)
args = parser.parse_args()
- server = test_pb2.beta_create_TestService_server(methods.TestService())
+ server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
+ test_pb2.add_TestServiceServicer_to_server(methods.TestService(), server)
if args.use_tls:
private_key = resources.private_key()
certificate_chain = resources.certificate_chain()
- credentials = implementations.ssl_server_credentials(
- [(private_key, certificate_chain)])
+ credentials = grpc.ssl_server_credentials(
+ ((private_key, certificate_chain),))
server.add_secure_port('[::]:{}'.format(args.port), credentials)
else:
server.add_insecure_port('[::]:{}'.format(args.port))
@@ -68,7 +70,7 @@ def serve():
time.sleep(_ONE_DAY_IN_SECONDS)
except BaseException as e:
logging.info('Caught exception "%s"; stopping server...', e)
- server.stop(0)
+ server.stop(None)
logging.info('Server stopped; exiting.')
if __name__ == '__main__':