PyDocs

Nav

Networking and Interprocess Communication

TaskGroup

asyncio

class · Added in 3.11 (source) not WASI
Asynchronous context manager for managing groups of tasks.

Example use:

    async with asyncio.TaskGroup() as group:
        task1 = group.create_task(some_coroutine(...))
        task2 = group.create_task(other_coroutine(...))
    print("Both tasks have completed now.")

All tasks are awaited when the context manager exits.

Any exceptions other than `asyncio.CancelledError` raised within
a task will cancel all remaining tasks and wait for them to exit.
The exceptions are then combined and raised as an `ExceptionGroup`.
Members of TaskGroup

c

cancel
Cancel the task group
create_task
Create a new task in this group and return it.
0 Examples
No examples for asyncio/TaskGroup.
See Also
No see-alsos for asyncio/TaskGroup
0 Notes
No notes for TaskGroup