Use a single log for entire `.service` subsys

rekt_pps
Tyler Goodlet 2023-03-22 12:07:08 -04:00
parent 3bf48ab597
commit a462de6f2d
9 changed files with 54 additions and 35 deletions

View File

@ -20,6 +20,7 @@ Actor-runtime service orchestration machinery.
"""
from __future__ import annotations
from ._util import log
from ._mngr import Services
from ._registry import ( # noqa
_tractor_kwargs,

View File

@ -34,8 +34,8 @@ from contextlib import (
import tractor
import trio
from ..log import (
get_logger,
from ._util import (
log, # sub-sys logger
get_console_log,
)
from ._mngr import (
@ -47,8 +47,6 @@ from ._registry import ( # noqa
open_registry,
)
log = get_logger(__name__)
def get_tractor_runtime_kwargs() -> dict[str, Any]:
'''

View File

@ -48,14 +48,12 @@ from requests.exceptions import (
ReadTimeout,
)
from ..log import (
get_logger,
from ._util import (
log, # sub-sys logger
get_console_log,
)
from .. import config
log = get_logger(__name__)
class DockerNotStarted(Exception):
'Prolly you dint start da daemon bruh'

View File

@ -30,8 +30,8 @@ from contextlib import (
import tractor
from ..log import (
get_logger,
from ._util import (
log, # sub-sys logger
get_console_log,
)
from ..brokers import get_brokermod
@ -41,8 +41,6 @@ from ._mngr import (
from ._actor_runtime import maybe_open_pikerd
from ._registry import find_service
log = get_logger(__name__)
# `brokerd` enabled modules
# NOTE: keeping this list as small as possible is part of our caps-sec
# model and should be treated with utmost care!

View File

@ -28,12 +28,10 @@ import trio
from trio_typing import TaskStatus
import tractor
from ..log import (
get_logger,
from ._util import (
log, # sub-sys logger
)
log = get_logger(__name__)
# TODO: factor this into a ``tractor.highlevel`` extension
# pack for the library.

View File

@ -28,13 +28,10 @@ from typing import (
import tractor
from ..log import (
get_logger,
from ._util import (
log, # sub-sys logger
)
log = get_logger(__name__)
_default_registry_host: str = '127.0.0.1'
_default_registry_port: int = 6116
_default_reg_addr: tuple[str, int] = (

View File

@ -0,0 +1,33 @@
# piker: trading gear for hackers
# Copyright (C) Tyler Goodlet (in stewardship for pikers)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
Sub-sys module commons.
"""
from functools import partial
from ..log import (
get_logger,
get_console_log,
)
subsys: str = 'piker.service'
log = get_logger(subsys)
get_console_log = partial(
get_console_log,
name=subsys,
)

View File

@ -20,21 +20,17 @@ from typing import (
TYPE_CHECKING,
)
import asks
if TYPE_CHECKING:
import docker
from ._ahab import DockerContainer
from piker.log import (
get_logger,
get_console_log
from . import log # sub-sys logger
from ._util import (
get_console_log,
)
import asks
log = get_logger(__name__)
# container level config
_config = {
@ -92,7 +88,7 @@ def start_elasticsearch(
'http://localhost:19200/_cat/health',
params={'format': 'json'}
)).json()
kog.info(
log.info(
'ElasticSearch cntr health:\n'
f'{health}'
)

View File

@ -54,14 +54,14 @@ if TYPE_CHECKING:
import docker
from ._ahab import DockerContainer
from ._util import (
log, # sub-sys logger
get_console_log,
)
from ..data.feed import maybe_open_feed
from ..log import get_logger, get_console_log
from .._profile import Profiler
log = get_logger(__name__)
# ahabd-supervisor and container level config
_config = {
'grpc_listen_port': 5995,
@ -703,7 +703,7 @@ async def open_tsdb_client(
# profiler('Finished db arrays diffs')
syms = await storage.client.list_symbols()
_ = await storage.client.list_symbols()
# log.info(f'Existing tsdb symbol set:\n{pformat(syms)}')
# profiler(f'listed symbols {syms}')
yield storage