~/talk

Advanced asyncio: Solving Real-world Production Problems

Talkat EuroPython 2019 · 2019-07-08..07-14· [python, testing]
slides:none on file

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

  1. 0:00Introduction
  2. 1:56asyncio
  3. 2:30Hello World Examples
  4. 5:00Simple Publisher
  5. 7:00Multiple Messages
  6. 8:51Finalization
  7. 10:54Review
  8. 13:21Signal Handler
  9. 14:55Shield
  10. 16:23Cleanup
  11. 17:27Handling exceptions
  12. 18:26Handling messages
  13. 20:03Working with threads
  14. 21:18Threadsafe API
  15. 22:24Testing
  16. 27:47Closing the Loop
  17. 30:38Debugger
  18. 31:14Debug Mode
  19. 33:04AAODebug
  20. 34:03Event Loop
  21. 34:54Kcash Grind
  22. 36:16Line Profiler
  23. 37:49Profiling
  24. 39:25Spotify
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.