Skip to content

Instantly share code, notes, and snippets.

View antonsteenvoorden's full-sized avatar
👉
🪨🌲

Anton S antonsteenvoorden

👉
🪨🌲
View GitHub Profile
@evertrol
evertrol / gist:47325e62f8caae1b72ee
Last active February 16, 2021 13:16
Asyncio: cancel a set of coroutines from another coroutine, by stopping the event loop
"""Example to cancel a set of asyncio coroutines (futures),
using one coroutine to signal the event loop to stop.
"""
import asyncio
import logging
from datetime import datetime
from concurrent.futures import CancelledError