Start `piker.toolz` subpkg for all our tooling B)
Since there's a growing list of top level mods which are more or less utils/tools for working with the runtime; begin to move them into a new subpkg starting with a new `.toolz.debug`. Start with, - a new `open_crash_handller()` for doing breakpoints around blocks that might error. - move in what was `piker._profile` into `.toolz.profile` and adjust all importing appropriately.account_tests
parent
5eb310cac9
commit
5e7916a0df
|
@ -1,5 +1,5 @@
|
|||
# piker: trading gear for hackers
|
||||
# Copyright (C) 2018-present Tyler Goodlet (in stewardship of piker0)
|
||||
# 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
|
||||
|
@ -13,10 +13,10 @@
|
|||
|
||||
# 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/>.
|
||||
"""
|
||||
'''
|
||||
Pre-(path)-graphics formatted x/y nd/1d rendering subsystem.
|
||||
|
||||
"""
|
||||
'''
|
||||
from __future__ import annotations
|
||||
from typing import (
|
||||
Optional,
|
||||
|
@ -39,7 +39,7 @@ if TYPE_CHECKING:
|
|||
from ._dataviz import (
|
||||
Viz,
|
||||
)
|
||||
from .._profile import Profiler
|
||||
from piker.toolz import Profiler
|
||||
|
||||
|
||||
class IncrementalFormatter(msgspec.Struct):
|
||||
|
|
|
@ -32,7 +32,7 @@ import numpy as np
|
|||
import polars as pl
|
||||
|
||||
from ._sharedmem import ShmArray
|
||||
from .._profile import (
|
||||
from ..toolz.profile import (
|
||||
Profiler,
|
||||
pg_profile_enabled,
|
||||
ms_slower_then,
|
||||
|
|
|
@ -37,10 +37,6 @@ from ._sharedmem import (
|
|||
ShmArray,
|
||||
_Token,
|
||||
)
|
||||
# from .._profile import (
|
||||
# Profiler,
|
||||
# pg_profile_enabled,
|
||||
# )
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# from pyqtgraph import PlotItem
|
||||
|
|
|
@ -51,7 +51,7 @@ from ._api import (
|
|||
_load_builtins,
|
||||
_Token,
|
||||
)
|
||||
from .._profile import Profiler
|
||||
from ..toolz import Profiler
|
||||
|
||||
log = get_logger(__name__)
|
||||
|
||||
|
|
|
@ -246,7 +246,7 @@ async def open_tsdb_client(
|
|||
# * the original data feed arch blurb:
|
||||
# - https://github.com/pikers/piker/issues/98
|
||||
#
|
||||
from .._profile import Profiler
|
||||
from ..toolz import Profiler
|
||||
profiler = Profiler(
|
||||
disabled=True, # not pg_profile_enabled(),
|
||||
delayed=False,
|
||||
|
|
|
@ -59,7 +59,6 @@ from anyio_marketstore import ( # noqa
|
|||
Params,
|
||||
)
|
||||
from piker.log import get_logger
|
||||
# from .._profile import Profiler
|
||||
|
||||
|
||||
log = get_logger(__name__)
|
||||
|
|
|
@ -67,7 +67,6 @@ from piker import config
|
|||
from piker.data import def_iohlcv_fields
|
||||
from piker.data import ShmArray
|
||||
from piker.log import get_logger
|
||||
# from .._profile import Profiler
|
||||
|
||||
|
||||
log = get_logger('storage.nativedb')
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
# 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/>.
|
||||
|
||||
'''
|
||||
Toolz for debug, profile and trace of the distributed runtime :surfer:
|
||||
|
||||
'''
|
||||
from .debug import (
|
||||
open_crash_handler,
|
||||
)
|
||||
from .profile import (
|
||||
Profiler,
|
||||
pg_profile_enabled,
|
||||
ms_slower_then,
|
||||
timeit,
|
||||
)
|
||||
|
||||
|
||||
__all__: list[str] = [
|
||||
'open_crash_handler',
|
||||
'pg_profile_enabled',
|
||||
'ms_slower_then',
|
||||
'Profiler',
|
||||
'timeit',
|
||||
]
|
|
@ -0,0 +1,40 @@
|
|||
# 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/>.
|
||||
|
||||
'''
|
||||
Debugger wrappers for `pdbp` as used by `tractor`.
|
||||
|
||||
'''
|
||||
from contextlib import contextmanager as cm
|
||||
|
||||
import pdbp
|
||||
|
||||
|
||||
# TODO: better naming and what additionals?
|
||||
# - optional runtime plugging?
|
||||
# - detection for sync vs. async code?
|
||||
# - specialized REPL entry when in distributed mode?
|
||||
@cm
|
||||
def open_crash_handler():
|
||||
'''
|
||||
Super basic crash handler using `pdbp` debugger.
|
||||
|
||||
'''
|
||||
try:
|
||||
yield
|
||||
except BaseException:
|
||||
pdbp.xpm()
|
||||
raise
|
|
@ -34,10 +34,13 @@ from PyQt5.QtGui import (
|
|||
QPainter,
|
||||
QPainterPath,
|
||||
)
|
||||
from .._profile import pg_profile_enabled, ms_slower_then
|
||||
from ._style import hcolor
|
||||
from ..log import get_logger
|
||||
from .._profile import Profiler
|
||||
from ..toolz.profile import (
|
||||
Profiler,
|
||||
pg_profile_enabled,
|
||||
ms_slower_then,
|
||||
)
|
||||
|
||||
|
||||
log = get_logger(__name__)
|
||||
|
|
|
@ -62,7 +62,7 @@ from ._curve import (
|
|||
)
|
||||
from ._render import Renderer
|
||||
from ..log import get_logger
|
||||
from .._profile import (
|
||||
from ..toolz.profile import (
|
||||
Profiler,
|
||||
pg_profile_enabled,
|
||||
ms_slower_then,
|
||||
|
|
|
@ -79,12 +79,12 @@ from .order_mode import (
|
|||
open_order_mode,
|
||||
OrderMode,
|
||||
)
|
||||
from .._profile import (
|
||||
from ..toolz import (
|
||||
pg_profile_enabled,
|
||||
ms_slower_then,
|
||||
Profiler,
|
||||
)
|
||||
from ..log import get_logger
|
||||
from .._profile import Profiler
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ._interaction import ChartView
|
||||
|
|
|
@ -66,7 +66,7 @@ from ..fsp._volume import (
|
|||
flow_rates,
|
||||
)
|
||||
from ..log import get_logger
|
||||
from .._profile import Profiler
|
||||
from ..toolz import Profiler
|
||||
|
||||
log = get_logger(__name__)
|
||||
|
||||
|
|
|
@ -39,8 +39,11 @@ import numpy as np
|
|||
import trio
|
||||
|
||||
from ..log import get_logger
|
||||
from .._profile import Profiler
|
||||
from .._profile import pg_profile_enabled, ms_slower_then
|
||||
from ..toolz import (
|
||||
Profiler,
|
||||
pg_profile_enabled,
|
||||
ms_slower_then,
|
||||
)
|
||||
from .view_mode import overlay_viewlists
|
||||
# from ._style import _min_points_to_show
|
||||
from ._editors import SelectRect
|
||||
|
|
|
@ -31,9 +31,12 @@ from PyQt5.QtCore import (
|
|||
from PyQt5.QtGui import QPainterPath
|
||||
|
||||
from ._curve import FlowGraphic
|
||||
from .._profile import pg_profile_enabled, ms_slower_then
|
||||
from ..toolz import (
|
||||
Profiler,
|
||||
pg_profile_enabled,
|
||||
ms_slower_then,
|
||||
)
|
||||
from ..log import get_logger
|
||||
from .._profile import Profiler
|
||||
|
||||
|
||||
log = get_logger(__name__)
|
||||
|
|
|
@ -39,7 +39,7 @@ from ..data._pathops import (
|
|||
xy_downsample,
|
||||
)
|
||||
from ..log import get_logger
|
||||
from .._profile import (
|
||||
from ..toolz import (
|
||||
Profiler,
|
||||
)
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import pyqtgraph as pg
|
|||
from ..data.types import Struct
|
||||
from ..data._timeseries import slice_from_time
|
||||
from ..log import get_logger
|
||||
from .._profile import Profiler
|
||||
from ..toolz import Profiler
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ._chart import ChartPlotWidget
|
||||
|
|
Loading…
Reference in New Issue