tractor/examples/debugging/subactor_bp_in_ctxt.py

31 lines
541 B
Python
Raw Normal View History

2022-01-27 04:38:33 +00:00
import tractor
import trio
@tractor.context
async def just_bp(
ctx: tractor.Context,
) -> None:
await tractor.breakpoint()
await ctx.started('yo bpin here')
async def main():
async with tractor.open_nursery(
debug_mode=True,
) as n:
p = await n.start_actor(
'bp_boi',
enable_modules=[__name__],
)
async with p.open_context(
just_bp,
) as (ctx, first):
await trio.sleep_forever()
if __name__ == '__main__':
trio.run(main)