diff --git a/examples/debugging/multi_daemon_subactors.py b/examples/debugging/multi_daemon_subactors.py index ea5fe00..80ef933 100644 --- a/examples/debugging/multi_daemon_subactors.py +++ b/examples/debugging/multi_daemon_subactors.py @@ -4,9 +4,15 @@ import trio async def breakpoint_forever(): "Indefinitely re-enter debugger in child actor." - while True: - yield 'yo' - await tractor.breakpoint() + try: + while True: + yield 'yo' + await tractor.breakpoint() + except BaseException: + tractor.log.get_console_log().exception( + 'Cancelled while trying to enter pause point!' + ) + raise async def name_error(): @@ -19,7 +25,7 @@ async def main(): """ async with tractor.open_nursery( debug_mode=True, - loglevel='error', + loglevel='cancel', ) as n: p0 = await n.start_actor('bp_forever', enable_modules=[__name__]) diff --git a/examples/debugging/multi_nested_subactors_error_up_through_nurseries.py b/examples/debugging/multi_nested_subactors_error_up_through_nurseries.py index 348a5ee..8df52e3 100644 --- a/examples/debugging/multi_nested_subactors_error_up_through_nurseries.py +++ b/examples/debugging/multi_nested_subactors_error_up_through_nurseries.py @@ -45,6 +45,7 @@ async def spawn_until(depth=0): ) +# TODO: notes on the new boxed-relayed errors through proxy actors async def main(): """The main ``tractor`` routine. diff --git a/examples/debugging/per_actor_debug.py b/examples/debugging/per_actor_debug.py index 1db5698..c1bf5ca 100644 --- a/examples/debugging/per_actor_debug.py +++ b/examples/debugging/per_actor_debug.py @@ -23,5 +23,6 @@ async def main(): n.start_soon(debug_actor.run, die) n.start_soon(crash_boi.run, die) + if __name__ == '__main__': trio.run(main) diff --git a/examples/debugging/root_actor_breakpoint_forever.py b/examples/debugging/root_actor_breakpoint_forever.py index 3536a75..88a6e0e 100644 --- a/examples/debugging/root_actor_breakpoint_forever.py +++ b/examples/debugging/root_actor_breakpoint_forever.py @@ -2,10 +2,13 @@ import trio import tractor -async def main(): +async def main( + registry_addrs: tuple[str, int]|None = None +): async with tractor.open_root_actor( debug_mode=True, + # loglevel='runtime', ): while True: await tractor.breakpoint() diff --git a/examples/debugging/subactor_error.py b/examples/debugging/subactor_error.py index e38c161..d7aee44 100644 --- a/examples/debugging/subactor_error.py +++ b/examples/debugging/subactor_error.py @@ -3,16 +3,26 @@ import tractor async def name_error(): - getattr(doggypants) + getattr(doggypants) # noqa (on purpose) async def main(): async with tractor.open_nursery( debug_mode=True, - ) as n: + # loglevel='transport', + ) as an: - portal = await n.run_in_actor(name_error) - await portal.result() + # TODO: ideally the REPL arrives at this frame in the parent, + # ABOVE the @api_frame of `Portal.run_in_actor()` (which + # should eventually not even be a portal method ... XD) + # await tractor.pause() + p: tractor.Portal = await an.run_in_actor(name_error) + + # with this style, should raise on this line + await p.result() + + # with this alt style should raise at `open_nusery()` + # return await p.result() if __name__ == '__main__': diff --git a/examples/debugging/sync_bp.py b/examples/debugging/sync_bp.py index 23469d6..efa4e40 100644 --- a/examples/debugging/sync_bp.py +++ b/examples/debugging/sync_bp.py @@ -7,7 +7,7 @@ def sync_pause( error: bool = False, ): if use_builtin: - breakpoint() + breakpoint(hide_tb=False) else: tractor.pause_from_sync() @@ -20,18 +20,20 @@ def sync_pause( async def start_n_sync_pause( ctx: tractor.Context, ): - # sync to requesting peer + actor: tractor.Actor = tractor.current_actor() + + # sync to parent-side task await ctx.started() - actor: tractor.Actor = tractor.current_actor() print(f'entering SYNC PAUSE in {actor.uid}') sync_pause() print(f'back from SYNC PAUSE in {actor.uid}') async def main() -> None: - async with tractor.open_nursery( + # NOTE: required for pausing from sync funcs + maybe_enable_greenback=True, debug_mode=True, ) as an: