[issue46844] Context-based TaskGroup for legacy libraries
Joongi Kim
report at bugs.python.org
Thu Feb 24 02:27:33 EST 2022
Joongi Kim <me at daybreaker.info> added the comment:
An example would be like:
tg = asyncio.TaskGroup()
...
async with tg:
with asyncio.TaskGroupBinder(tg): # just a hypothetical API
asyncio.create_task(...) # equivalent to tg.create_task(...)
await some_library.some_work() # all tasks are bound to tg
asyncio.create_task(...) # fire-and-forget (not bound to tg)
If TaskGroup supports enumeration/counting of its own tasks and asyncio allows enumeration of TaskGroups just like asyncio.Task.all_tasks(), we could extend aiomonitor to provide per-taskgroup statistics.
In my projects, we have multiple cases to find and fix bugs in customer sites using aiomonitor and I'm willing to improve aiomonitor to support task groups as well.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46844>
_______________________________________
More information about the Python-bugs-list
mailing list