From 949aa9c40594c7eaa4a3954a0e9959f94e411b4a Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 10 Dec 2021 12:48:05 -0500 Subject: [PATCH] Lol. should probably push the example code... --- examples/debugging/per_actor_debug.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 examples/debugging/per_actor_debug.py diff --git a/examples/debugging/per_actor_debug.py b/examples/debugging/per_actor_debug.py new file mode 100644 index 0000000..1db5698 --- /dev/null +++ b/examples/debugging/per_actor_debug.py @@ -0,0 +1,27 @@ +import trio +import tractor + +async def die(): + raise RuntimeError + + +async def main(): + async with tractor.open_nursery() as tn: + + debug_actor = await tn.start_actor( + 'debugged_boi', + enable_modules=[__name__], + debug_mode=True, + ) + crash_boi = await tn.start_actor( + 'crash_boi', + enable_modules=[__name__], + # debug_mode=True, + ) + + async with trio.open_nursery() as n: + n.start_soon(debug_actor.run, die) + n.start_soon(crash_boi.run, die) + +if __name__ == '__main__': + trio.run(main)