Asyncio event loop
Asyncio is Python's standard asynchronous I/O framework.
Basic coroutine
import asyncio
async def worker():
await asyncio.sleep(1)
print("done")
asyncio.run(worker())
Task groups
async with asyncio.TaskGroup() as tg:
tg.create_task(job1())
tg.create_task(job2())
Cancellation handling
Always catch CancelledError in long running background workers.