Search code examples
python-3.xpython-asyncio

Default executor asyncio


According to the documentation, when passing None to run_in_executor the default executor is used:

awaitable loop.run_in_executor(executor, func, *args) Arrange for func to be called in the specified executor.

The executor argument should be an concurrent.futures.Executor instance. The default executor is used if executor is None.

My question is, what is the default executor of asyncio?


Solution

  • My question is, what is the default executor of asyncio?

    As of this writing (Feb 2020, Python 3.9 alpha), it's a concurrent.futures.ThreadPoolExecutor with default settings.

    Previously one could also call set_default_executor to use a different kind of executor, but as of Python 3.8 it's guaranteed to be a ThreadPoolExecutor. However, its exact settings aren't documented, so they can change in a future Python release. For example, in Python 3.10 it sets the thread_name_prefix property.