2021-02-24 18:39:14 +00:00
|
|
|
import trio
|
2020-02-09 07:01:39 +00:00
|
|
|
import tractor
|
|
|
|
|
|
|
|
tractor.log.get_console_log("INFO")
|
|
|
|
|
2021-02-24 18:39:14 +00:00
|
|
|
|
2020-02-09 07:01:39 +00:00
|
|
|
async def main(service_name):
|
|
|
|
|
|
|
|
async with tractor.open_nursery() as an:
|
|
|
|
await an.start_actor(service_name)
|
|
|
|
|
2024-07-04 23:40:11 +00:00
|
|
|
async with tractor.get_registry('127.0.0.1', 1616) as portal:
|
2020-02-09 07:01:39 +00:00
|
|
|
print(f"Arbiter is listening on {portal.channel}")
|
|
|
|
|
|
|
|
async with tractor.wait_for_actor(service_name) as sockaddr:
|
|
|
|
print(f"my_service is found at {sockaddr}")
|
|
|
|
|
|
|
|
await an.cancel()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2021-02-24 18:39:14 +00:00
|
|
|
trio.run(main, 'some_actor_name')
|