Async Python Patterns
Implements advanced asynchronous programming patterns in Python using safe gather, timeouts, and robust cancellation handling.
This skill provides a standardized framework for writing resilient asynchronous code in Python. It introduces the 'safe_gather' pattern, which enhances the standard asyncio.gather by providing fail-fast cancellation, built-in timeout support, and cleaner handling of concurrent operations. It offers guidance on when to use specific async primitives, how to manage partial results, and provides clear migration paths for existing codebases to improve reliability and performance in high-concurrency environments.
주요 기능
01Fail-fast concurrency that cancels remaining tasks on the first exception
02Standardized safe_gather implementation for cleaner cancellation handling
03Specific patterns for initialization, data fetching, and graceful shutdown
040 GitHub stars
05Integrated timeout support for all asynchronous gather operations
06Guidance on partial results processing using return_exceptions
사용 사례
01Migrating fragile asyncio.gather calls to a more robust fail-fast implementation
02Adding global timeouts to groups of concurrent API requests or database operations
03Implementing safe cleanup and shutdown procedures for complex asynchronous services