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, yselivanov
Date 2022-02-24.13:17:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1645708674.1.0.251435744218.issue46843@roundup.psfhosted.org>
In-reply-to
Content
So I have more things in mind.

Basically PersistentTaskGroup resemble TaskGroup in that:
 - It has the same "create_task()" method.
 - It has an explicit "cancel()" or "shutdown()" method.
 - Exiting of the context manager means that all tasks of it have either completed or cancelled.

TaskGroup is intended to be used for a short-lived set of tasks, while PersistentTaskGroup is intended for a long-running set of tasks though individual tasks may be short-lived.  Thus, adding globally accessible monitoring facility for plain TaskGroup would not be that useful.  In contrast, it is super-useful to have a monitoring feature in PersistentTaskGroup!

In aiomonitor, we can enumerate the currently running asyncio tasks by reading asyncio.Task.all_tasks().  This has saved my life several times when debugging real-world server applications.  I think we can go further by having asyncio.PersistentTaskGroup.all_task_groups() which works in the same way.  If we make different modules and libraries to use different persistent task groups, then we could keep track of their task statistics separately.
History
Date User Action Args
2022-02-24 13:17:54achimnolsetrecipients: + achimnol, gvanrossum, asvetlov, yselivanov
2022-02-24 13:17:54achimnolsetmessageid: <1645708674.1.0.251435744218.issue46843@roundup.psfhosted.org>
2022-02-24 13:17:54achimnollinkissue46843 messages
2022-02-24 13:17:53achimnolcreate