Use a single log for entire `.service` subsys
parent
3bf48ab597
commit
a462de6f2d
|
@ -20,6 +20,7 @@ Actor-runtime service orchestration machinery.
|
||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from ._util import log
|
||||||
from ._mngr import Services
|
from ._mngr import Services
|
||||||
from ._registry import ( # noqa
|
from ._registry import ( # noqa
|
||||||
_tractor_kwargs,
|
_tractor_kwargs,
|
||||||
|
|
|
@ -34,8 +34,8 @@ from contextlib import (
|
||||||
import tractor
|
import tractor
|
||||||
import trio
|
import trio
|
||||||
|
|
||||||
from ..log import (
|
from ._util import (
|
||||||
get_logger,
|
log, # sub-sys logger
|
||||||
get_console_log,
|
get_console_log,
|
||||||
)
|
)
|
||||||
from ._mngr import (
|
from ._mngr import (
|
||||||
|
@ -47,8 +47,6 @@ from ._registry import ( # noqa
|
||||||
open_registry,
|
open_registry,
|
||||||
)
|
)
|
||||||
|
|
||||||
log = get_logger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
def get_tractor_runtime_kwargs() -> dict[str, Any]:
|
def get_tractor_runtime_kwargs() -> dict[str, Any]:
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -48,14 +48,12 @@ from requests.exceptions import (
|
||||||
ReadTimeout,
|
ReadTimeout,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..log import (
|
from ._util import (
|
||||||
get_logger,
|
log, # sub-sys logger
|
||||||
get_console_log,
|
get_console_log,
|
||||||
)
|
)
|
||||||
from .. import config
|
from .. import config
|
||||||
|
|
||||||
log = get_logger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class DockerNotStarted(Exception):
|
class DockerNotStarted(Exception):
|
||||||
'Prolly you dint start da daemon bruh'
|
'Prolly you dint start da daemon bruh'
|
||||||
|
|
|
@ -30,8 +30,8 @@ from contextlib import (
|
||||||
|
|
||||||
import tractor
|
import tractor
|
||||||
|
|
||||||
from ..log import (
|
from ._util import (
|
||||||
get_logger,
|
log, # sub-sys logger
|
||||||
get_console_log,
|
get_console_log,
|
||||||
)
|
)
|
||||||
from ..brokers import get_brokermod
|
from ..brokers import get_brokermod
|
||||||
|
@ -41,8 +41,6 @@ from ._mngr import (
|
||||||
from ._actor_runtime import maybe_open_pikerd
|
from ._actor_runtime import maybe_open_pikerd
|
||||||
from ._registry import find_service
|
from ._registry import find_service
|
||||||
|
|
||||||
log = get_logger(__name__)
|
|
||||||
|
|
||||||
# `brokerd` enabled modules
|
# `brokerd` enabled modules
|
||||||
# NOTE: keeping this list as small as possible is part of our caps-sec
|
# NOTE: keeping this list as small as possible is part of our caps-sec
|
||||||
# model and should be treated with utmost care!
|
# model and should be treated with utmost care!
|
||||||
|
|
|
@ -28,12 +28,10 @@ import trio
|
||||||
from trio_typing import TaskStatus
|
from trio_typing import TaskStatus
|
||||||
import tractor
|
import tractor
|
||||||
|
|
||||||
from ..log import (
|
from ._util import (
|
||||||
get_logger,
|
log, # sub-sys logger
|
||||||
)
|
)
|
||||||
|
|
||||||
log = get_logger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
# TODO: factor this into a ``tractor.highlevel`` extension
|
# TODO: factor this into a ``tractor.highlevel`` extension
|
||||||
# pack for the library.
|
# pack for the library.
|
||||||
|
|
|
@ -28,13 +28,10 @@ from typing import (
|
||||||
|
|
||||||
import tractor
|
import tractor
|
||||||
|
|
||||||
|
from ._util import (
|
||||||
from ..log import (
|
log, # sub-sys logger
|
||||||
get_logger,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
log = get_logger(__name__)
|
|
||||||
|
|
||||||
_default_registry_host: str = '127.0.0.1'
|
_default_registry_host: str = '127.0.0.1'
|
||||||
_default_registry_port: int = 6116
|
_default_registry_port: int = 6116
|
||||||
_default_reg_addr: tuple[str, int] = (
|
_default_reg_addr: tuple[str, int] = (
|
||||||
|
|
|
@ -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,
|
||||||
|
)
|
|
@ -20,21 +20,17 @@ from typing import (
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
import asks
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
import docker
|
import docker
|
||||||
from ._ahab import DockerContainer
|
from ._ahab import DockerContainer
|
||||||
|
|
||||||
from piker.log import (
|
from . import log # sub-sys logger
|
||||||
get_logger,
|
from ._util import (
|
||||||
get_console_log
|
get_console_log,
|
||||||
)
|
)
|
||||||
|
|
||||||
import asks
|
|
||||||
|
|
||||||
|
|
||||||
log = get_logger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
# container level config
|
# container level config
|
||||||
_config = {
|
_config = {
|
||||||
|
@ -92,7 +88,7 @@ def start_elasticsearch(
|
||||||
'http://localhost:19200/_cat/health',
|
'http://localhost:19200/_cat/health',
|
||||||
params={'format': 'json'}
|
params={'format': 'json'}
|
||||||
)).json()
|
)).json()
|
||||||
kog.info(
|
log.info(
|
||||||
'ElasticSearch cntr health:\n'
|
'ElasticSearch cntr health:\n'
|
||||||
f'{health}'
|
f'{health}'
|
||||||
)
|
)
|
||||||
|
|
|
@ -54,14 +54,14 @@ if TYPE_CHECKING:
|
||||||
import docker
|
import docker
|
||||||
from ._ahab import DockerContainer
|
from ._ahab import DockerContainer
|
||||||
|
|
||||||
|
from ._util import (
|
||||||
|
log, # sub-sys logger
|
||||||
|
get_console_log,
|
||||||
|
)
|
||||||
from ..data.feed import maybe_open_feed
|
from ..data.feed import maybe_open_feed
|
||||||
from ..log import get_logger, get_console_log
|
|
||||||
from .._profile import Profiler
|
from .._profile import Profiler
|
||||||
|
|
||||||
|
|
||||||
log = get_logger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
# ahabd-supervisor and container level config
|
# ahabd-supervisor and container level config
|
||||||
_config = {
|
_config = {
|
||||||
'grpc_listen_port': 5995,
|
'grpc_listen_port': 5995,
|
||||||
|
@ -703,7 +703,7 @@ async def open_tsdb_client(
|
||||||
|
|
||||||
# profiler('Finished db arrays diffs')
|
# 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)}')
|
# log.info(f'Existing tsdb symbol set:\n{pformat(syms)}')
|
||||||
# profiler(f'listed symbols {syms}')
|
# profiler(f'listed symbols {syms}')
|
||||||
yield storage
|
yield storage
|
||||||
|
|
Loading…
Reference in New Issue