4 ms·
The thing with event loops in python is that they are not a single, all-governing scheduler (as e.g. in the BEAM). ev loops instead are a mid-layer concept tha
by uniqueuid 2y ago
The thing with event loops in python is that they are not a single, all-governing scheduler (as e.g. in the BEAM).
ev loops instead are a mid-layer concept that sits below other infrastructure such as threads and processes. And (perhaps somewhat frustratingly) it is not too uncommon to have multiple ev loops in parallel. See for example the proxy.py project, which offers to run one async loop per process for a speedup.
As a result, there are some incentives to swap out the loop itself, e.g. for faster implementations like uvloop, because they are somewhat pluggable anyways.
- mapcars 2y ago> all-governing scheduler (as e.g. in the BEAM). Does this also mean they have preemptive multitasking like in BEAM?
- blegr 2y agoGood design dictates that you start one loop and build the whole program around it, no? The docs for asyncio.run say as much.
- kodablah 2y agoYes, that is good design and the event loop should basically be shared process-wide (asyncio objects are usually not thread safe and cannot be shared across event loops). Temporal only does custom event loops in isolated workflows.