-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |