Message413905
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. |
|
Date |
User |
Action |
Args |
2022-02-24 13:17:54 | achimnol | set | recipients:
+ achimnol, gvanrossum, asvetlov, yselivanov |
2022-02-24 13:17:54 | achimnol | set | messageid: <1645708674.1.0.251435744218.issue46843@roundup.psfhosted.org> |
2022-02-24 13:17:54 | achimnol | link | issue46843 messages |
2022-02-24 13:17:53 | achimnol | create | |
|