Skip to content

Conversation

@redvelvets
Copy link

@redvelvets redvelvets commented Aug 25, 2025

Currently, kickoff_for_each_async stops execution entirely if any single task fails.
In some scenarios, we want partial failures not to block other tasks, for example:

  • Parallel processing of multiple requests where only a few may fail
  • Collecting all task results for statistics or further processing

Solution (What / How)

  • Add a new parameter fail_fast: bool to kickoff_for_each_async, default is True

  • Behavior:

    • fail_fast=True → preserve existing behavior: exception immediately aborts execution
    • fail_fast=False → use asyncio.gather(..., return_exceptions=True) to collect all task results, including exceptions
  • Backward compatible: default behavior unchanged if parameter is not passed

results = await asyncio.gather(*tasks)

if passed

results = await asyncio.gather(*tasks, return_exceptions=True)

Compatibility / Impact

  • Default is True, so existing calls behave as before
  • When fail_fast=False, the returned list may contain Exception objects, which the caller should handle

@github-actions
Copy link

This PR is stale because it has been open for 45 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant