Initialize credentials after IO engine set

pull/22343/head
Lidi Zheng 5 years ago
parent 3779b12203
commit 82050ae192
  1. 4
      src/python/grpcio/grpc/_cython/_cygrpc/aio/grpc_aio.pyx.pxi
  2. 5
      src/python/grpcio/grpc/experimental/aio/__init__.py
  3. 3
      src/python/grpcio_tests/tests_aio/unit/_test_base.py

@ -114,7 +114,7 @@ cdef _actual_aio_shutdown():
raise ValueError('Unsupported engine type [%s]' % _global_aio_state.engine)
cdef init_grpc_aio():
cpdef init_grpc_aio():
"""Initialis the gRPC AsyncIO module.
Expected to be invoked on critical class constructors.
@ -126,7 +126,7 @@ cdef init_grpc_aio():
_actual_aio_initialization()
cdef shutdown_grpc_aio():
cpdef shutdown_grpc_aio():
"""Shuts down the gRPC AsyncIO module.
Expected to be invoked on critical class destructors.

@ -20,7 +20,8 @@ created. AsyncIO doesn't provide thread safety for most of its APIs.
from typing import Any, Optional, Sequence, Tuple
import grpc
from grpc._cython.cygrpc import (EOF, AbortError, BaseError, InternalError,
from grpc._cython.cygrpc import (init_grpc_aio, shutdown_grpc_aio, EOF,
AbortError, BaseError, InternalError,
UsageError)
from ._base_call import (Call, RpcContext, StreamStreamCall, StreamUnaryCall,
@ -39,6 +40,8 @@ from ._channel import insecure_channel, secure_channel
################################### __all__ #################################
__all__ = (
'init_grpc_aio',
'shutdown_grpc_aio',
'AioRpcError',
'RpcContext',
'Call',

@ -64,3 +64,6 @@ class AioTestBase(unittest.TestCase):
return _async_to_sync_decorator(attr, self._TEST_LOOP)
# For other attributes, let them pass.
return attr
aio.init_grpc_aio()

Loading…
Cancel
Save