Joongi Kim <m...@daybreaker.info> added the comment:
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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46843> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com