Advanced asyncio: Solving Real-world Production Problems
summary
Builds a simplified chaos-monkey service that listens to pub/sub and restarts hosts, showing concrete code: uses asyncio.create_task and asyncio.gather(return_exceptions=True) to fan out work, uses loop.add_signal_handler and loop.set_exception_handler for graceful shutdown and global error capture, and demonstrates that asyncio.shield still gets cancelled during process shutdown (surprising). Covers threads with ThreadPoolExecutor and loop.run_coroutine_threadsafe, tests with pytest-asyncio and async_test, and profiles with cProfile → pyprof2calltree/KCacheGrind and line_profiler.
AI-written summary · about
chapters (24)
- 0:00Introduction
- 1:56asyncio
- 2:30Hello World Examples
- 5:00Simple Publisher
- 7:00Multiple Messages
- 8:51Finalization
- 10:54Review
- 13:21Signal Handler
- 14:55Shield
- 16:23Cleanup
- 17:27Handling exceptions
- 18:26Handling messages
- 20:03Working with threads
- 21:18Threadsafe API
- 22:24Testing
- 27:47Closing the Loop
- 30:38Debugger
- 31:14Debug Mode
- 33:04AAODebug
- 34:03Event Loop
- 34:54Kcash Grind
- 36:16Line Profiler
- 37:49Profiling
- 39:25Spotify
related talks
32mAdvanced 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
19mUnblocking the Loop: Mastering Python's I/O Loop Monitoring
23mPractical usage of asyncio
01h 00mCoroutine Concurrency in Python 3 with asyncio
