Skip to content

Commit

Permalink
Add example that triggers bug #302
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed Feb 17, 2022
1 parent d29e2d3 commit 0fca574
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions examples/open_context_and_sleep.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import trio
import click
import tractor
import pydantic
# from multiprocessing import shared_memory


@tractor.context
async def just_sleep(

ctx: tractor.Context,
**kwargs,

) -> None:
'''
Test a small ping-pong 2-way streaming server.
'''
await ctx.started()
await trio.sleep_forever()


async def main() -> None:

proc = await trio.open_process( (
'python',
'-c',
'import trio; trio.run(trio.sleep_forever)',
))
await proc.wait()
# await trio.sleep_forever()
# async with tractor.open_nursery() as n:

# portal = await n.start_actor(
# 'rpc_server',
# enable_modules=[__name__],
# )

# async with portal.open_context(
# just_sleep, # taken from pytest parameterization
# ) as (ctx, sent):
# await trio.sleep_forever()



if __name__ == '__main__':
import time
# time.sleep(999)
trio.run(main)

0 comments on commit 0fca574

Please sign in to comment.