2020-10-16 03:15:20 +00:00
|
|
|
import tractor
|
|
|
|
import trio
|
|
|
|
|
|
|
|
|
|
|
|
async def breakpoint_forever():
|
|
|
|
"Indefinitely re-enter debugger in child actor."
|
|
|
|
while True:
|
|
|
|
yield 'yo'
|
|
|
|
await tractor.breakpoint()
|
|
|
|
|
|
|
|
|
|
|
|
async def name_error():
|
|
|
|
"Raise a ``NameError``"
|
|
|
|
getattr(doggypants)
|
|
|
|
|
|
|
|
|
|
|
|
async def main():
|
|
|
|
"""Test breakpoint in a streaming actor.
|
|
|
|
"""
|
2021-02-23 11:48:15 +00:00
|
|
|
async with tractor.open_nursery(
|
|
|
|
debug_mode=True,
|
|
|
|
loglevel='error',
|
|
|
|
) as n:
|
2020-10-16 03:15:20 +00:00
|
|
|
|
2021-02-23 11:48:15 +00:00
|
|
|
p0 = await n.start_actor('bp_forever', enable_modules=[__name__])
|
|
|
|
p1 = await n.start_actor('name_error', enable_modules=[__name__])
|
2020-10-16 03:15:20 +00:00
|
|
|
|
|
|
|
# retreive results
|
2020-12-21 14:09:55 +00:00
|
|
|
stream = await p0.run(breakpoint_forever)
|
|
|
|
await p1.run(name_error)
|
2020-10-16 03:15:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2021-02-23 11:48:15 +00:00
|
|
|
trio.run(main)
|