Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinkedTaskChannel.subscribe(), explicit asyncio task cancel logging, test_trioisms.py #304

Merged
merged 15 commits into from Apr 12, 2022

Conversation

goodboy
Copy link
Owner

@goodboy goodboy commented Feb 24, 2022

Basically 2 parts:

  • some better error logging and a somewhat involved scenario test that includes use of,
    • a sub-actor managed "service nursery" that can be used to service new async requests from a parent actor
    • broadcast channel usage for by multiple such "service tasks" within the sub-actor
    • ensuring errors in any service task cancels the others
    • making sure it all works with *infected asyncio` mode
  • a new to_asyncio.LinkedTaskChannel.subscribe() which gives task-oriented broadcast functionality semantically equivalent to MsgStream.subscribe()
    • this makes it possible for multiple trio-side tasks to consume asyncio-side task msgs in tandem

This work was originally inspired as part of debugging a case in piker's service manager that ended up leading to python-trio/trio#2258.

Included is a test that demonstrates the current trio behaviour in a new test_trioisms.py for tracking such situations in the future.


TODO:

  • at least one test for the new LinkedTaskChannel.subscribe() support
  • nooz file

@goodboy goodboy changed the title asyncio task explicit task cancels Explicit asyncio task cancel logging Feb 24, 2022
@goodboy goodboy changed the title Explicit asyncio task cancel logging LinkedTaskChannel.subscribe() and Explicit asyncio` task cancel logging Apr 11, 2022
@goodboy goodboy changed the title LinkedTaskChannel.subscribe() and Explicit asyncio` task cancel logging LinkedTaskChannel.subscribe() and Explicit asyncio task cancel logging Apr 11, 2022
When an `asyncio` side task errors or is cancelled we now explicitly
report the traceback and task name if possible as well as the source
reason for the error (some come from the `trio` side).

Further, properly set any `trio` side exception (after unwrapping it
from the `outcome.Error`) on the future that runs the `trio` guest run.
@goodboy goodboy mentioned this pull request Apr 12, 2022
2 tasks
@goodboy goodboy changed the title LinkedTaskChannel.subscribe() and Explicit asyncio task cancel logging LinkedTaskChannel.subscribe(), explicit asyncio task cancel logging, test_trioisms.py Apr 12, 2022
@goodboy goodboy force-pushed the aio_explicit_task_cancels branch 2 times, most recently from 0392e74 to edfb25e Compare April 12, 2022 19:38
@goodboy
Copy link
Owner Author

goodboy commented Apr 12, 2022

Lul no idea but now windows wants to pass, k.

@goodboy goodboy merged commit bfe99f2 into master Apr 12, 2022
@goodboy goodboy deleted the aio_explicit_task_cancels branch April 12, 2022 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant