tractor/debugging/mp_debug.py

29 lines
612 B
Python
Raw Permalink Normal View History

2020-07-23 17:34:03 +00:00
import tractor
import trio
async def bubble():
print('IN BUBBLE')
await trio.sleep(.1)
await tractor.breakpoint()
async def bail():
getattr(doggy)
async def main():
"""The main ``tractor`` routine.
"""
async with tractor.open_nursery() as n:
2020-07-24 19:17:41 +00:00
portal = await n.run_in_actor('future_self', bubble)
# portal = await n.run_in_actor('future_self', bail)
2020-07-23 17:34:03 +00:00
# The ``async with`` will unblock here since the 'some_linguist'
# actor has completed its main task ``cellar_door``.
if __name__ == '__main__':
2020-07-24 19:17:41 +00:00
tractor.run(main, loglevel='trace', debug_mode=True)