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:38:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1645817904.39.0.00920523542065.issue46843@roundup.psfhosted.org>
In-reply-to
Content
Short summary:

PersistentTaskGroup shares the followings from TaskGroup:
- It uses WeakSet to keep track of child tasks.
- After exiting the async context manager scope (or the shutdown procedure), it ensures that all tasks are complete or cancelled.

PersistentTaskGroup differs in that:
- It keeps running after all tasks successfully finish unless it is explicitly shutdown or the parent task is cancelled.
- It is one of the main use cases that shutdown() method is called separately.  The shutdown procedure may be triggered from different task contexts.
- It provides two-phase cancellation with a configurable grace period.
- It does not propagate unhandled exceptions and cancellations from child tasks to the outside of the task group and sibling tasks but calls a customizable fallback exception handler. -> This could be done without modifying TaskGroup.

The API looks similar to TaskGroup with minor modification.
The semantics of a PersistentTaskGroup more resembles a nested event loop, in that it has its own set of tasks, it keeps running until closed, and it has its own fallback exception handler.

Note that current aiotools implementation lacks many details, such as two-phase cancellation.  I'm going to implement more soon.
History
Date User Action Args
2022-02-25 19:38:24achimnolsetrecipients: + achimnol, gvanrossum, asvetlov, yselivanov, tinchester
2022-02-25 19:38:24achimnolsetmessageid: <1645817904.39.0.00920523542065.issue46843@roundup.psfhosted.org>
2022-02-25 19:38:24achimnollinkissue46843 messages
2022-02-25 19:38:24achimnolcreate