2021-02-24 18:39:14 +00:00
|
|
|
import trio
|
2020-02-09 07:01:39 +00:00
|
|
|
import tractor
|
|
|
|
|
|
|
|
|
|
|
2021-04-27 13:14:08 +00:00
|
|
|
async def cellar_door():
|
2020-12-21 14:09:55 +00:00
|
|
|
assert not tractor.is_root_process()
|
|
|
|
|
return "Dang that's beautiful"
|
2020-02-09 07:01:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
async def main():
|
|
|
|
|
"""The main ``tractor`` routine.
|
|
|
|
|
"""
|
2026-07-06 16:11:39 +00:00
|
|
|
# spawn a subactor, run ``cellar_door()`` as its lone task,
|
|
|
|
|
# block until its result arrives and the subactor is reaped.
|
|
|
|
|
print(
|
|
|
|
|
await tractor.to_actor.run(
|
2020-12-21 14:09:55 +00:00
|
|
|
cellar_door,
|
|
|
|
|
name='some_linguist',
|
|
|
|
|
)
|
2026-07-06 16:11:39 +00:00
|
|
|
)
|
2020-02-09 07:01:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2021-02-24 18:39:14 +00:00
|
|
|
trio.run(main)
|