From f627fedf74736d6265f8a8935081906ed1cd512f Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 8 Mar 2023 15:25:20 -0500 Subject: [PATCH] Move all docker and external db code to `piker.service` --- piker/cli/__init__.py | 4 ++-- piker/data/cli.py | 4 ++-- piker/service/__init__.py | 4 ++-- piker/{data => service}/_ahab.py | 0 piker/{data => service}/elastic.py | 0 piker/{data => service}/marketstore.py | 5 ++--- 6 files changed, 8 insertions(+), 9 deletions(-) rename piker/{data => service}/_ahab.py (100%) rename piker/{data => service}/elastic.py (100%) rename piker/{data => service}/marketstore.py (99%) diff --git a/piker/cli/__init__.py b/piker/cli/__init__.py index b4d13505..63b8321a 100644 --- a/piker/cli/__init__.py +++ b/piker/cli/__init__.py @@ -206,8 +206,8 @@ def services(config, tl, ports): def _load_clis() -> None: - from ..data import marketstore # noqa - from ..data import elastic + from ..service import marketstore # noqa + from ..service import elastic from ..data import cli # noqa from ..brokers import cli # noqa from ..ui import cli # noqa diff --git a/piker/data/cli.py b/piker/data/cli.py index 7c8b9a68..cb081c6e 100644 --- a/piker/data/cli.py +++ b/piker/data/cli.py @@ -144,7 +144,7 @@ def storesh( async with open_piker_runtime( 'storesh', - enable_modules=['piker.data._ahab'], + enable_modules=['piker.service._ahab'], ): symbol = symbols[0] @@ -194,7 +194,7 @@ def storage( async with open_piker_runtime( 'tsdb_storage', - enable_modules=['piker.data._ahab'], + enable_modules=['piker.service._ahab'], ): symbol = symbols[0] async with open_tsdb_client(symbol) as storage: diff --git a/piker/service/__init__.py b/piker/service/__init__.py index 6788b764..04ec4c28 100644 --- a/piker/service/__init__.py +++ b/piker/service/__init__.py @@ -362,8 +362,8 @@ async def open_pikerd( Services.debug_mode = debug_mode if tsdb: - from piker.data._ahab import start_ahab - from piker.data.marketstore import start_marketstore + from ._ahab import start_ahab + from .marketstore import start_marketstore log.info('Spawning `marketstore` supervisor') ctn_ready, config, (cid, pid) = await service_nursery.start( diff --git a/piker/data/_ahab.py b/piker/service/_ahab.py similarity index 100% rename from piker/data/_ahab.py rename to piker/service/_ahab.py diff --git a/piker/data/elastic.py b/piker/service/elastic.py similarity index 100% rename from piker/data/elastic.py rename to piker/service/elastic.py diff --git a/piker/data/marketstore.py b/piker/service/marketstore.py similarity index 99% rename from piker/data/marketstore.py rename to piker/service/marketstore.py index 6e3ed78f..5613bd8d 100644 --- a/piker/data/marketstore.py +++ b/piker/service/marketstore.py @@ -26,7 +26,6 @@ from __future__ import annotations from contextlib import asynccontextmanager as acm from datetime import datetime -from pprint import pformat from typing import ( Any, Optional, @@ -55,7 +54,7 @@ if TYPE_CHECKING: import docker from ._ahab import DockerContainer -from .feed import maybe_open_feed +from ..data.feed import maybe_open_feed from ..log import get_logger, get_console_log from .._profile import Profiler @@ -136,7 +135,7 @@ def start_marketstore( # create dirs when dne if not os.path.isdir(config._config_dir): - Path(config._config_dir).mkdir(parents=True, exist_ok=True) + Path(config._config_dir).mkdir(parents=True, exist_ok=True) if not os.path.isdir(mktsdir): os.mkdir(mktsdir)