Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/frequenz/core/asyncio/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# License: MIT
# Copyright © 2024 Frequenz Energy-as-a-Service GmbH

"""General purpose async tools.

This module provides general purpose async tools that can be used to simplify the
development of asyncio-based applications.

The module provides the following classes and functions:

- [cancel_and_await][frequenz.core.asyncio.cancel_and_await]: A function that cancels a
task and waits for it to finish, handling `CancelledError` exceptions.
- [PersistentTaskGroup][frequenz.core.asyncio.PersistentTaskGroup]: An alternative to
[`asyncio.TaskGroup`][] to manage tasks that run until explicitly stopped.
- [Service][frequenz.core.asyncio.Service]: An interface for services running in the
background.
- [ServiceBase][frequenz.core.asyncio.ServiceBase]: A base class for implementing
services running in the background.
- [TaskCreator][frequenz.core.asyncio.TaskCreator]: A protocol for creating tasks.
"""

from ._service import Service, ServiceBase
from ._task_group import PersistentTaskGroup
from ._util import TaskCreator, TaskReturnT, cancel_and_await

__all__ = [
"PersistentTaskGroup",
"Service",
"ServiceBase",
"TaskCreator",
"TaskReturnT",
"cancel_and_await",
]
Loading