Add subsys log to new `.data._util`

rekt_pps
Tyler Goodlet 2023-04-18 18:17:45 -04:00
parent 06b80ff9ed
commit 53a41ba93d
10 changed files with 47 additions and 41 deletions

View File

@ -25,7 +25,7 @@ sharing live streams over a network.
import tractor import tractor
import trio import trio
from ..log import ( from ._util import (
get_console_log, get_console_log,
) )
from ._normalize import iterticks from ._normalize import iterticks

View File

@ -42,10 +42,7 @@ from numba import (
# float64, optional, int64, # float64, optional, int64,
) )
from ..log import get_logger from ._util import log
log = get_logger(__name__)
def ds_m4( def ds_m4(

View File

@ -38,8 +38,8 @@ from tractor.trionics import (
import trio import trio
from trio_typing import TaskStatus from trio_typing import TaskStatus
from ..log import ( from ._util import (
get_logger, log,
get_console_log, get_console_log,
) )
from ..service import maybe_spawn_daemon from ..service import maybe_spawn_daemon
@ -50,8 +50,6 @@ if TYPE_CHECKING:
) )
from .feed import _FeedsBus from .feed import _FeedsBus
log = get_logger(__name__)
# highest frequency sample step is 1 second by default, though in # highest frequency sample step is 1 second by default, though in
# the future we may want to support shorter periods or a dynamic style # the future we may want to support shorter periods or a dynamic style

View File

@ -32,14 +32,11 @@ import numpy as np
from numpy.lib import recfunctions as rfn from numpy.lib import recfunctions as rfn
import tractor import tractor
from ..log import get_logger from ._util import log
from ._source import base_iohlc_dtype from ._source import base_iohlc_dtype
from .types import Struct from .types import Struct
log = get_logger(__name__)
# how much is probably dependent on lifestyle # how much is probably dependent on lifestyle
_secs_in_day = int(60 * 60 * 24) _secs_in_day = int(60 * 60 * 24)
# we try for a buncha times, but only on a run-every-other-day kinda week. # we try for a buncha times, but only on a run-every-other-day kinda week.

View File

@ -1,5 +1,5 @@
# piker: trading gear for hackers # piker: trading gear for hackers
# Copyright (C) 2018-present Tyler Goodlet (in stewardship for piker0) # Copyright (C) 2018-present Tyler Goodlet (in stewardship for pikers)
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU Affero General Public License as published by
@ -18,22 +18,10 @@
numpy data source coversion helpers. numpy data source coversion helpers.
""" """
from __future__ import annotations from __future__ import annotations
from decimal import (
Decimal,
ROUND_HALF_EVEN,
)
from typing import Any
from bidict import bidict from bidict import bidict
import numpy as np import numpy as np
from .types import Struct
from ..accounting._mktinfo import (
# mkfqsn,
unpack_fqsn,
# digits_to_dec,
float_digits,
)
ohlc_fields = [ ohlc_fields = [
('time', float), ('time', float),

View File

@ -0,0 +1,34 @@
# 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/>.
'''
Data layer module commons.
'''
from functools import partial
from ..log import (
get_logger,
get_console_log,
)
subsys: str = 'piker.data'
log = get_logger(subsys)
get_console_log = partial(
get_console_log,
name=subsys,
)

View File

@ -44,12 +44,9 @@ from trio_websocket._impl import (
ConnectionTimeout, ConnectionTimeout,
) )
from ..log import get_logger from ._util import log
from .types import Struct from .types import Struct
log = get_logger(__name__)
class NoBsWs: class NoBsWs:
''' '''

View File

@ -32,14 +32,11 @@ from ..service.marketstore import (
) )
from ..cli import cli from ..cli import cli
from .. import watchlists as wl from .. import watchlists as wl
from ..log import ( from ._util import (
get_logger, log,
) )
log = get_logger(__name__)
@cli.command() @cli.command()
@click.option( @click.option(
'--url', '--url',

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """
abstractions for organizing, managing and generally operating-on Public abstractions for organizing, managing and generally operating-on
real-time data processing data-structures. real-time data processing data-structures.
"Streams, flumes, cascades and flows.." "Streams, flumes, cascades and flows.."
@ -35,8 +35,8 @@ from ..accounting._mktinfo import (
MktPair, MktPair,
Symbol, Symbol,
) )
from ..log import ( from ._util import (
get_logger, log,
) )
from .types import Struct from .types import Struct
from ._sharedmem import ( from ._sharedmem import (
@ -53,8 +53,6 @@ if TYPE_CHECKING:
# from pyqtgraph import PlotItem # from pyqtgraph import PlotItem
from .feed import Feed from .feed import Feed
log = get_logger(__name__)
# TODO: ideas for further abstractions as per # TODO: ideas for further abstractions as per
# https://github.com/pikers/piker/issues/216 and # https://github.com/pikers/piker/issues/216 and

View File

@ -23,7 +23,7 @@ Api layer likely in here...
from types import ModuleType from types import ModuleType
from importlib import import_module from importlib import import_module
from ..log import get_logger from ._util import get_logger
log = get_logger(__name__) log = get_logger(__name__)