Advanced asyncio: Solving Real-World Production Problems
summary
Builds a Chaos Monkey–style service called Mayhem Mandrill and shows concrete code patterns that actually work: using asyncio.create_task and asyncio.gather to fan out work, attaching loop signal handlers for graceful shutdown with task cancellation and metric flush, adding a global exception handler and per-task exception handling, using run_coroutine_threadsafe for thread safety, testing with pytest-asyncio and coroutine mocks, and profiling with cProfile pyprof2calltree and kcachegrind to find slow callbacks.
AI-written summary · about
chapters (17)
- 0:00Start
- 4:41building mayhem mandrill
- 9:28unblocking: finalization tasks
- 11:18initial concurrency setup: tl;dr
- 12:43responding to signals
- 13:52signal handler
- 18:22exception handling
- 20:46threads and asyncio
- 21:33simple testing with pytest
- 22:40mocking coroutines
- 24:55testing create task
- 26:53testing the event loop
- 27:18manual debugging
- 27:47using debug mode: traceback context
- 28:22using debug mode: thread safety
- 28:40using debug mode: slow coros
- 29:50debugging asyncio code
related talks
40mAdvanced asyncio: Solving Real-world Production Problems
32mEnhancing AsyncIO for Complex Applications
28mIf an asyncio Task fails in the woods and nobody is around to see it, does i....
59mGet to grips with asyncio in Python 3
01h 29mStandardised Coroutine Concurrency in Python 3
23mPractical usage of asyncio
01h 00mCoroutine Concurrency in Python 3 with asyncio
50mUsing Asyncio in Python 3
