You cannot immediately terminate the asyncio event loop, or kill all running tasks. Instead, we must enumerate all running tasks and request that …
Asyncio Non-Blocking Logging With aiologger
You can log without blocking in asyncio programs by using aiologger. In this tutorial, you will discover how to log in asyncio programs without …
Continue Reading about Asyncio Non-Blocking Logging With aiologger →
Asyncio Log Long-Running Blocking Calls With aiodebug
You can identify and log asyncio tasks that block the event loop for too long. Calling Python functions in asyncio programs rather than awaiting …
Continue Reading about Asyncio Log Long-Running Blocking Calls With aiodebug →
Asyncio CancelledError Can Be Consumed
Asyncio tasks can suppress requests to be canceled and actively consume CancelledError exceptions. Although consuming CancelledError exceptions is …
Continue Reading about Asyncio CancelledError Can Be Consumed →
4 Ways to Suppress Asyncio CancelledError
You can suppress CancelledError exceptions in asyncio by handling them within the task or in the caller that canceled the task. Alternatively, they …
Continue Reading about 4 Ways to Suppress Asyncio CancelledError →
How to Lint (Static Analysis) Asyncio Code
You can identify common problems in asyncio programs using popular Python static analysis tools such as pylint and flake8. In this tutorial, you …
Continue Reading about How to Lint (Static Analysis) Asyncio Code →
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
You may get a warning when running your asyncio program that looks like: "RuntimeWarning: Enable tracemalloc to get the object allocation …
Continue Reading about RuntimeWarning: Enable tracemalloc to get the object allocation traceback →
Asyncio Log Exceptions
You can log exceptions in asyncio programs by calling logging.exception() within tasks or when awaiting tasks. We can also configure the event loop …
Configure, Suppress, and Log Asyncio Warnings
You can configure, suppress, and log warnings emitted by asyncio programs. By default, the asyncio event loop will emit warnings in situations that …
Continue Reading about Configure, Suppress, and Log Asyncio Warnings →