tractor/tractor
Tyler Goodlet e0be3397d1 Raise "independent" task errors in an eg
The (rare) condition is heavily detailed in new comments in
the `cancel_trio()` callback but, more or less the idea here is to be
extra pedantic in raising an `Exceptiongroup` of errors from each task
(both `asyncio` and `trio`) whenever the 2 tasks raise "independently"
- in the sense that it's not obviously one side's task causing an error
(or cancellation) in the other. In this case we set the error for each
side on the `LinkedTaskChannel` (via new attrs described later).

As a synopsis, most of this work was refined out of supporting
`infected_aio=True` mode in the **root actor** and in particular as part
of getting that to work inside the `modden` daemon which at the time of
writing was still using the `i3ipc` lib and thus `asyncio`.

Impl deats,
- extend the `LinkedTaskChannel` field/API set (and type it),
  - `._trio_task: trio.Task` for test/user introspection.
- also "stage" some ideas for a more refined interface,
  - `.started()` to deliver the value yielded to the `trio.Task` parent.
   |_ also includes some todos for how to implement this design
      underneath.
  - `._aio_first: Any|None = None` to hold that value ^.
  - `.wait_aio_complete()` for syncing to the asyncio task.
- some detailed logging around "asyncio cancelled trio" case.
- Move `AsyncioCancelled` in this module.

Styling changes,
- generally more explicit var naming.
- some todos for getting modern and fancy with typing..

NB, Let it be known this commit msg was written on a friday with the
help of various "mr. white" solns.
2025-03-24 15:37:12 -04:00
..
_testing Move `mk_cmd()` to `._testing` 2025-03-24 15:37:12 -04:00
devx Yield a boxed-maybe-error from `open_crash_handler()` 2025-03-24 15:37:12 -04:00
experimental Drop now-deprecated deps on modern `trio`/Python 2025-03-16 16:06:24 -04:00
msg Draft a (pretty)`Struct.fields_diff()` 2025-03-24 15:37:12 -04:00
trionics Change masked `.pause()` line 2025-03-24 15:37:12 -04:00
__init__.py Finally implement peer-lookup optimization.. 2025-03-24 14:04:52 -04:00
_child.py Hide `._entry`/`._child` frames, tweak some more type annots 2025-03-20 23:22:45 -04:00
_clustering.py Passthrough runtime kwargs from `open_actor_cluster()` 2022-12-11 19:56:08 -05:00
_context.py Change masked `.pause()` line 2025-03-24 15:37:12 -04:00
_discovery.py Finally implement peer-lookup optimization.. 2025-03-24 14:04:52 -04:00
_entry.py Pass `infect_asyncio` setting via runtime-vars 2025-03-24 15:37:12 -04:00
_exceptions.py Accept err-type override in `is_multi_cancelled()` 2025-03-24 15:37:12 -04:00
_forkserver_override.py Re-license code base for distribution under AGPL 2021-12-14 23:33:27 -05:00
_ipc.py More formal `TransportClosed` reporting/raising 2025-03-24 14:04:52 -04:00
_mp_fixup_main.py Avoid importing mp for as long as possible 2022-02-17 11:55:26 -05:00
_multiaddr.py Fix doc string "its" typo.. 2025-03-20 19:50:31 -04:00
_portal.py More-n-more scops annots in logging 2025-03-24 14:04:52 -04:00
_root.py Expose `debug_filter` from `open_root_actor()` also 2025-03-24 15:37:12 -04:00
_rpc.py More formal `TransportClosed` reporting/raising 2025-03-24 14:04:52 -04:00
_runtime.py Pass `infect_asyncio` setting via runtime-vars 2025-03-24 15:37:12 -04:00
_spawn.py Use `._entry` proto-ed "lifetime ops" in logging 2025-03-24 14:04:52 -04:00
_state.py Pass `infect_asyncio` setting via runtime-vars 2025-03-24 15:37:12 -04:00
_streaming.py Reraise RAEs in `MsgStream.receive()`; truncate tbs 2025-03-24 14:04:52 -04:00
_supervise.py Pass `infect_asyncio` setting via runtime-vars 2025-03-24 15:37:12 -04:00
log.py Support passing pre-conf-ed `Logger` 2025-03-24 15:37:12 -04:00
to_asyncio.py Raise "independent" task errors in an eg 2025-03-24 15:37:12 -04:00