async_utils
zeus.utils.async_utils
Utilities for asyncio.
create_task
create_task(coroutine, logger=None)
Create an asyncio.Task
but ensure that exceptions are logged.
Reference: https://quantlane.com/blog/ensure-asyncio-task-exceptions-get-logged/
Parameters:
Name | Type | Description | Default |
---|---|---|---|
coroutine |
Coroutine[Any, Any, T]
|
The coroutine to be wrapped. |
required |
logger |
Logger | None
|
The logger to be used for logging exceptions. If |
None
|
Source code in zeus/utils/async_utils.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
_handle_task_exception
_handle_task_exception(task, logger)
Print out exception and tracebook when a task dies with an exception.
Source code in zeus/utils/async_utils.py
37 38 39 40 41 42 43 44 45 46 |
|