This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: feature request: asyncio.gather/wait cancel children on first exception
Type: Stage: resolved
Components: asyncio Versions: Python 3.8
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Introduce task groups to asyncio and change task cancellation semantics
View: 46752
Assigned To: Nosy List: asvetlov, iritkatriel, thehesiod, yselivanov
Priority: normal Keywords:

Created on 2018-02-02 23:29 by thehesiod, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg311527 - (view) Author: Alexander Mohr (thehesiod) * Date: 2018-02-02 23:29
currently gather/wait allow you to return on the first exception and leave the children executing.

A very common use case that I have is of launching multiple tasks, and if any of them fail, then all should fail..otherwise the other tasks would continue running w/o anyone listening for the results.  To accomplish this I wrote a method like the following: https://gist.github.com/thehesiod/524a1f005d0f3fb61a8952f272d8709e.  I think it would be useful to many others as on optional perhaps a parameter to each of these methods.

What do you guys think?
msg311528 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-02-02 23:31
I think it's a good idea and I wanted to implement it by copying TaskGroups from curio in 3.7.  But then I saw Trio's nurseries and I have a few ideas about slightly different design inspired by both curio and Trio :)

I have some very WIP code that I plan to finish in a few weeks. I'll update this issue then.
msg415672 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-03-21 10:25
Task groups are implemented under Issue46752.
History
Date User Action Args
2022-04-11 14:58:57adminsetgithub: 76935
2022-03-30 21:21:54iritkatrielsetstatus: pending -> closed
stage: resolved
2022-03-21 10:25:32iritkatrielsetstatus: open -> pending

nosy: + iritkatriel
messages: + msg415672

superseder: Introduce task groups to asyncio and change task cancellation semantics
resolution: duplicate
2018-02-02 23:31:43yselivanovsetmessages: + msg311528
2018-02-02 23:29:02thehesiodcreate