Expose `debug_filter` from `open_root_actor()` also
Such that actor-runtime graceful cancel handling can be used throughout any process tree.hilevel_serman
parent
0e39b3902f
commit
c63b94f61f
|
@ -95,6 +95,13 @@ async def open_root_actor(
|
||||||
|
|
||||||
hide_tb: bool = True,
|
hide_tb: bool = True,
|
||||||
|
|
||||||
|
# XXX, proxied directly to `.devx._debug._maybe_enter_pm()`
|
||||||
|
# for REPL-entry logic.
|
||||||
|
debug_filter: Callable[
|
||||||
|
[BaseException|BaseExceptionGroup],
|
||||||
|
bool,
|
||||||
|
] = lambda err: not is_multi_cancelled(err),
|
||||||
|
|
||||||
# TODO, a way for actors to augment passing derived
|
# TODO, a way for actors to augment passing derived
|
||||||
# read-only state to sublayers?
|
# read-only state to sublayers?
|
||||||
# extra_rt_vars: dict|None = None,
|
# extra_rt_vars: dict|None = None,
|
||||||
|
@ -379,6 +386,7 @@ async def open_root_actor(
|
||||||
Exception,
|
Exception,
|
||||||
BaseExceptionGroup,
|
BaseExceptionGroup,
|
||||||
) as err:
|
) as err:
|
||||||
|
|
||||||
# XXX NOTE XXX see equiv note inside
|
# XXX NOTE XXX see equiv note inside
|
||||||
# `._runtime.Actor._stream_handler()` where in the
|
# `._runtime.Actor._stream_handler()` where in the
|
||||||
# non-root or root-that-opened-this-mahually case we
|
# non-root or root-that-opened-this-mahually case we
|
||||||
|
@ -387,11 +395,15 @@ async def open_root_actor(
|
||||||
entered: bool = await _debug._maybe_enter_pm(
|
entered: bool = await _debug._maybe_enter_pm(
|
||||||
err,
|
err,
|
||||||
api_frame=inspect.currentframe(),
|
api_frame=inspect.currentframe(),
|
||||||
|
debug_filter=debug_filter,
|
||||||
)
|
)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
not entered
|
not entered
|
||||||
and
|
and
|
||||||
not is_multi_cancelled(err)
|
not is_multi_cancelled(
|
||||||
|
err,
|
||||||
|
)
|
||||||
):
|
):
|
||||||
logger.exception('Root actor crashed\n')
|
logger.exception('Root actor crashed\n')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue