Message413961
I ended up with the following conclusion:
- The new abstraction should not cancel sibling tasks and itself upon unhandled execption but loudly report such errors (and the fallback error handler should be customizable).
- Nesting task groups will give additional benefits such as orderly shutdown of different task groups. Empty up message queues before shutting down netweork connections, etc.
You may take my suggestion as "let's have a hierarchical nested virtual event loops to group tasks". PersistentTaskGroup actually shares many characteristics with the event loop while itself is not an event loop.
So I came up with WeakSet with task decorators to handle exceptions by my own, and this is the current rudimentary implementation of PersistentTaskGroup in aiotools.
And I discovered from the additional search results that the same pattern ---managing sporadic tasks using WeakSet and writing a proper cancellation loop of them---appear quite commonly in many different asyncio applications and libraries.
So that's why I think this should be an intrinsic/essential abstraction. |
|
Date |
User |
Action |
Args |
2022-02-25 04:58:36 | achimnol | set | recipients:
+ achimnol, gvanrossum, asvetlov, yselivanov |
2022-02-25 04:58:36 | achimnol | set | messageid: <1645765116.66.0.384556133567.issue46843@roundup.psfhosted.org> |
2022-02-25 04:58:36 | achimnol | link | issue46843 messages |
2022-02-25 04:58:36 | achimnol | create | |
|