1
0
Fork 0
tractor/tractor
Tyler Goodlet c1e0328669 First try "relayed boxed errors", or "inceptions"
Since adding more complex inter-peer (actor) testing scenarios, we
definitely have an immediate need for `trio`'s style of "inceptions" but
for nesting `RemoteActorError`s as they're relayed through multiple
actor-IPC hops. So for example, a remote error relayed "through" some
proxy actor to another ends up packing a `RemoteActorError` into another
one such that there are 2 layers of RAEs with the first
containing/boxing an original src actor error (type).

In support of this extension to `RemoteActorError` we add:

- `get_err_type()` error type resolver helper (factored fromthe
  body of `unpack_error()`) to be used whenever rendering
  `.src_type`/`.boxed_type`.

- `.src_type_str: str` which is pulled from `.msgdata` and holds the
  above (eventually when unpacked) type as `str`.
- `._src_type: BaseException|None` for the original
  "source" actor's error as unpacked in any remote (actor's) env and
  exposed as a readonly property `.src_type`.

- `.boxed_type_str: str` the same as above but for the "last" boxed
  error's type; when the RAE is unpacked at its first hop this will
  be **the same as** `.src_type_str`.
- `._boxed_type: BaseException` which now similarly should be "rendered"
  from the below type-`str` field instead of passed in as a error-type
  via `boxed_type` (though we still do for the ctxc case atm, see
  notes).
 |_ new sanity checks in `.__init__()` mostly as a reminder to handle
   that ^ ctxc case ^ more elegantly at some point..
 |_ obvi we discard the previous `suberror_type` input arg.

- fully remove the `.type`/`.type_str` properties instead expecting
  usage of `.boxed_/.src_` equivalents.
- start deprecation of `.src_actor_uid` and make it delegate to new
  `.src_uid`
- add `.relay_uid` propery for the last relay/hop's actor uid.
- add `.relay_path: list[str]` which holds the per-hop updated sequence
  of relay actor uid's which consecutively did boxing of an RAE.
- only include `.src_uid` and `.relay_path` in reprol() output.
- factor field-to-str rendering into a new `_mk_fields_str()`
  and use it in `.__repr__()`/`.reprol()`.
- add an `.unwrap()` to (attempt to) render the src error.

- rework `pack_error()` to handle inceptions including,
  - packing the correct field-values for the new `boxed_type_str`, `relay_uid`,
    `src_uid`, `src_type_str`.
  - always updating the `relay_path` sequence with the uid of the
    current actor.

- adjust `unpack_error()` to match all these changes,
  - pulling `boxed_type_str` and passing any resolved `boxed_type` to
    `RemoteActorError.__init__()`.
  - use the new `Context.maybe_raise()` convenience method.

Adjust `._rpc` packing to `ContextCancelled(boxed_type=trio.Cancelled)`
and tweak some more log msg formats.
2025-03-20 20:35:02 -04:00
..
_testing Add (back) a `tractor._testing` sub-pkg 2025-03-16 15:28:28 -04:00
devx Woops, fix `_post_mortem()` type sig.. 2025-03-20 15:07:27 -04:00
experimental Drop now-deprecated deps on modern `trio`/Python 2025-03-16 16:06:24 -04:00
msg Make `NamespacePath` kinda support methods.. 2025-03-15 00:05:31 -04:00
trionics Drop now-deprecated deps on modern `trio`/Python 2025-03-16 16:06:24 -04:00
__init__.py Use `import <name> as <name>,` style over `__all__` in pkg mod 2025-03-20 19:50:31 -04:00
_child.py ._child: remove some unused imports.. 2025-03-14 13:56:25 -04:00
_clustering.py Passthrough runtime kwargs from `open_actor_cluster()` 2022-12-11 19:56:08 -05:00
_context.py Re-revert back to `.devx` subpkg after rebase.. 2025-03-20 15:07:27 -04:00
_discovery.py More spaceless union type annots 2025-03-20 19:50:31 -04:00
_entry.py Init-support for "multi homed" transports 2025-03-20 19:50:31 -04:00
_exceptions.py First try "relayed boxed errors", or "inceptions" 2025-03-20 20:35:02 -04:00
_forkserver_override.py Re-license code base for distribution under AGPL 2021-12-14 23:33:27 -05:00
_ipc.py Init-support for "multi homed" transports 2025-03-20 19:50:31 -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 Init-support for "multi homed" transports 2025-03-20 19:50:31 -04:00
_root.py More spaceless union type annots 2025-03-20 19:50:31 -04:00
_rpc.py First try "relayed boxed errors", or "inceptions" 2025-03-20 20:35:02 -04:00
_runtime.py Add a `._state._runtime_vars['_registry_addrs']` 2025-03-20 19:50:31 -04:00
_spawn.py Change remaining internals to use `Actor.reg_addrs` 2025-03-20 19:50:31 -04:00
_state.py Add a `._state._runtime_vars['_registry_addrs']` 2025-03-20 19:50:31 -04:00
_streaming.py Absorb EoCs via `Context.open_stream()` silently 2025-03-16 16:06:26 -04:00
_supervise.py Change remaining internals to use `Actor.reg_addrs` 2025-03-20 19:50:31 -04:00
log.py .log: more multi-line styling 2025-03-14 16:41:08 -04:00
to_asyncio.py Move `.to_asyncio` to modern optional value type annots 2025-03-20 15:07:27 -04:00