From 7ca05238af47f1822b42821a50e47fd8c6cfdd7d Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 21 Mar 2021 21:56:06 -0400 Subject: [PATCH] Port pikerd entry to drop `tractor.run()` --- piker/cli/__init__.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/piker/cli/__init__.py b/piker/cli/__init__.py index 50f38346..f8f37095 100644 --- a/piker/cli/__init__.py +++ b/piker/cli/__init__.py @@ -4,6 +4,7 @@ CLI commons. import os import click +import trio import tractor from ..log import get_console_log, get_logger, colorize_json @@ -35,13 +36,14 @@ _context_defaults = dict( def pikerd(loglevel, host, tl): """Spawn the piker broker-daemon. """ - from .._daemon import _data_mods + from .._daemon import _data_mods, open_pikerd get_console_log(loglevel) - tractor.run_daemon( - rpc_module_paths=_data_mods, - name='brokerd', - loglevel=loglevel if tl else None, - ) + + async def main(): + async with open_pikerd(loglevel): + await trio.sleep_forever() + + trio.run(main) @click.group(context_settings=_context_defaults)