2022-01-27 04:38:33 +00:00
|
|
|
import tractor
|
|
|
|
import trio
|
|
|
|
|
|
|
|
|
2022-02-07 12:02:39 +00:00
|
|
|
async def gen():
|
|
|
|
yield 'yo'
|
|
|
|
await tractor.breakpoint()
|
|
|
|
yield 'yo'
|
|
|
|
|
|
|
|
|
2022-01-27 04:38:33 +00:00
|
|
|
@tractor.context
|
|
|
|
async def just_bp(
|
|
|
|
ctx: tractor.Context,
|
|
|
|
) -> None:
|
|
|
|
|
|
|
|
await ctx.started('yo bpin here')
|
2022-02-07 12:02:39 +00:00
|
|
|
await tractor.breakpoint()
|
|
|
|
|
2022-02-09 15:05:21 +00:00
|
|
|
# TODO: bps and errors in this call..
|
2022-02-07 12:02:39 +00:00
|
|
|
# async for val in gen():
|
|
|
|
# print(val)
|
|
|
|
|
|
|
|
await trio.sleep(0.5)
|
|
|
|
|
2022-02-09 15:05:21 +00:00
|
|
|
# THIS CAUSES AN UNRECOVERABLE HANG
|
|
|
|
# without latest ``pdbpp``:
|
2022-02-07 12:02:39 +00:00
|
|
|
assert 0
|
|
|
|
|
2022-01-27 04:38:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def main():
|
|
|
|
async with tractor.open_nursery(
|
2022-02-09 15:05:21 +00:00
|
|
|
# loglevel='transport',
|
2022-01-27 04:38:33 +00:00
|
|
|
debug_mode=True,
|
|
|
|
) as n:
|
|
|
|
p = await n.start_actor(
|
|
|
|
'bp_boi',
|
|
|
|
enable_modules=[__name__],
|
2022-02-07 12:02:39 +00:00
|
|
|
# debug_mode=True,
|
2022-01-27 04:38:33 +00:00
|
|
|
)
|
|
|
|
async with p.open_context(
|
|
|
|
just_bp,
|
|
|
|
) as (ctx, first):
|
|
|
|
|
2022-02-07 12:02:39 +00:00
|
|
|
# await tractor.breakpoint()
|
|
|
|
# breakpoint()
|
2022-01-27 04:38:33 +00:00
|
|
|
await trio.sleep_forever()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
trio.run(main)
|