Merge pull request #22453 from lidizheng/aio-default-poller

[Aio] Change the default IO engine to POLLER
pull/22459/head
Lidi Zheng 5 years ago committed by GitHub
commit bc0aabc093
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/python/grpcio/grpc/_cython/_cygrpc/aio/grpc_aio.pyx.pxi

@ -14,18 +14,17 @@
import enum
cdef str _GRPC_ASYNCIO_ENGINE = os.environ.get('GRPC_ASYNCIO_ENGINE', 'default').upper()
cdef str _GRPC_ASYNCIO_ENGINE = os.environ.get('GRPC_ASYNCIO_ENGINE', 'poller').upper()
cdef _AioState _global_aio_state = _AioState()
class AsyncIOEngine(enum.Enum):
DEFAULT = 'default'
CUSTOM_IO_MANAGER = 'custom_io_manager'
POLLER = 'poller'
cdef _default_asyncio_engine():
return AsyncIOEngine.CUSTOM_IO_MANAGER
return AsyncIOEngine.POLLER
cdef grpc_completion_queue *global_completion_queue():
@ -76,10 +75,8 @@ cdef _actual_aio_initialization():
# Picks the engine for gRPC AsyncIO Stack
_global_aio_state.engine = AsyncIOEngine.__members__.get(
_GRPC_ASYNCIO_ENGINE,
AsyncIOEngine.DEFAULT,
_default_asyncio_engine(),
)
if _global_aio_state.engine is AsyncIOEngine.DEFAULT:
_global_aio_state.engine = _default_asyncio_engine()
_LOGGER.info('Using %s as I/O engine', _global_aio_state.engine)
# Initializes the process-level state accordingly

Loading…
Cancel
Save