-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
The SDK provides a gather
function that concurrently runs zero or more awaitables, and blocks until all awaitables return successfully or any awaitable raises.
async def gather(*awaitables: Awaitable[Any]) -> list[Any]: ...
The name was chosen to match the asyncio
function that has the same behavior. See https://docs.python.org/3/library/asyncio-task.html#running-tasks-concurrently.
Other languages provide a more complete set of concurrency/composition primitives. For example, JavaScript provides Promise.all
, Promise.any
and Promise.race
:
all
: returns when all awaitables return successfully, or any awaitable raises (likegather
)any
: returns when any awaitable returns successfully, or all awaitables raiserace
: returns when any awaitable returns or raises
We should consider adding any
and race
, and aliasing gather
as all
.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Status
Developer preview