From 2c51ad2a0da7302d6c8d0104aef236ac33412e84 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 18 Feb 2022 12:17:41 -0500 Subject: [PATCH] Revive `ms-shell` sub-cmd --- piker/data/cli.py | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/piker/data/cli.py b/piker/data/cli.py index 3839fe65..5b9c854d 100644 --- a/piker/data/cli.py +++ b/piker/data/cli.py @@ -111,20 +111,27 @@ def ms_stream(config: dict, names: List[str], url: str): ) @click.option( '--port', - default=5995 + default=5993 ) @click.pass_obj def ms_shell(config, tl, host, port): - """Start an IPython shell ready to query the local marketstore db. - """ - async def main(): - async with open_marketstore_client(host, port) as client: - query = client.query # noqa - # TODO: write magics to query marketstore - from IPython import embed - embed() + ''' + Start an IPython shell ready to query the local marketstore db. - tractor.run(main) + ''' + from piker.data.marketstore import backfill_history + from piker._daemon import open_piker_runtime + async def main(): + async with open_piker_runtime( + 'ms_shell', + enable_modules=['piker.data._ahab'], + ): + await backfill_history() + # TODO: write magics to query marketstore + # from IPython import embed + # embed() + + trio.run(main) @cli.command()