3 ms·
>run_in_executor that can be spelled as asyncio.to_thread() won't help utilizing cpu for pure Python code That isn't true. If you use a ProcessPoolExecutor as
by noident 2y ago
>run_in_executor that can be spelled as asyncio.to_thread() won't help utilizing cpu for pure Python code
That isn't true. If you use a ProcessPoolExecutor as the target instead of the default executor, you will use multiple processes in pure Python code.
- d0mine 2y agothe default executor must be ThreadPoolExecutor. But you are right you can pass ProcessPoolExecutor too. https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.run_in_executor https://docs.python.org/3/library/asyncio-eventloop.html#asy...