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.

Author achimnol
Recipients achimnol, asvetlov, gvanrossum, tinchester, yselivanov
Date 2022-02-25.19:08:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1645816082.04.0.928702722883.issue46843@roundup.psfhosted.org>
In-reply-to
Content
> And just a question: I'm just curious about what happens if belonging tasks see the cancellation raised from their inner tasks.  Sibling tasks should not be cancelled, and the outer task group should not be cancelled, unless the task group itself has requested cancellation.  Could the new cancellation counter help this?

To achieve this by distinguishing cancellation from inner/outer tasks, TaskGroup._on_task_done() should be modified to skip setting _on_completed_fut because it should keep running.  Swallowing exceptions in child tasks can be done without modifying TaskGroup, but this part requires changes of TaskGroup.

Another difference is the usage.  Instead of relying on the async context manager interface, we would call "TaskGroup.shutdown()" separately from either directly in signal handlers or from cleanup methods of long-lived objects that have task groups as attributes.

And I also want to perform two-phase cancellation: instead of cancelling all tasks immediately as in current _abort(), have a configurable grace period until they have chances to complete and then cancel with additional timeout on cancellation itself to prevent hangs.
History
Date User Action Args
2022-02-25 19:08:02achimnolsetrecipients: + achimnol, gvanrossum, asvetlov, yselivanov, tinchester
2022-02-25 19:08:02achimnolsetmessageid: <1645816082.04.0.928702722883.issue46843@roundup.psfhosted.org>
2022-02-25 19:08:02achimnollinkissue46843 messages
2022-02-25 19:08:01achimnolcreate