Delegate `.toolz.open_crash_handler()` to `tractor.devx`

Means we can drop `.toolz.debug` module outright.
distribute_dis
Tyler Goodlet 2024-01-16 10:25:55 -05:00
parent 264246d89b
commit e4ce79f720
3 changed files with 12 additions and 62 deletions

View File

@ -482,7 +482,7 @@ def search(
):
return await func()
from cornerboi._debug import open_crash_handler
from piker.toolz import open_crash_handler
with open_crash_handler():
quotes = trio.run(
main,
@ -506,9 +506,11 @@ def search(
@click.option('--delete', '-d', flag_value=True, help='Delete section')
@click.pass_obj
def brokercfg(config, section, value, delete):
"""If invoked with no arguments, open an editor to edit broker configs file
or get / update an individual section.
"""
'''
If invoked with no arguments, open an editor to edit broker
configs file or get / update an individual section.
'''
from .. import config
if section:

View File

@ -18,24 +18,12 @@
Toolz for debug, profile and trace of the distributed runtime :surfer:
'''
from .debug import (
open_crash_handler,
from tractor.devx import (
open_crash_handler as open_crash_handler,
)
from .profile import (
Profiler,
pg_profile_enabled,
ms_slower_then,
timeit,
Profiler as Profiler,
pg_profile_enabled as pg_profile_enabled,
ms_slower_then as ms_slower_then,
timeit as timeit,
)
# TODO: other mods to include?
# - DROP .trionics, already moved into tractor
# - move in `piker.calc`
__all__: list[str] = [
'open_crash_handler',
'pg_profile_enabled',
'ms_slower_then',
'Profiler',
'timeit',
]

View File

@ -1,40 +0,0 @@
# 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