Compare commits

..

2 Commits

Author SHA1 Message Date
Gud Boi e0ec09cf19 Flip `.tsp._history` logger to explicit mod-name (again) 2026-02-06 00:39:59 -05:00
Gud Boi 68a87ca45f Adjust `tractor.log` API compat
Update logging helpers to use new `tractor.log` API with `pkg_name=`
kwarg and add optional `tractor` "root logger" enabling.

Deats,
- change `piker.log.get_logger()` to use `pkg_name=` vs `_root_name=`.
- add `**tractor_log_kwargs` passthrough to both wrapper fns.
- add `with_tractor_log: bool` toggle to `.get_console_log()`.
- strip `'piker.'` prefix from logger names when present to avoid
  newly added `tractor.get_logger()` warnings.

Surroundingly,
- add `subsys` import to `.clearing._ems` for log name
- update all `get_console_log()` calls to use `level=` kwarg
- add assertion checks for logger names in `_setup_persistent_emsd()`

Additionally,,
- fix all type annotations: `str|None` vs `str | None`.
- add multiline style to conditional in `.cli.services()`.
- drop unused `Optional` import from `._actor_runtime`.
- drop a few "blank lines" in various function sigs.

Warning: this patch will require an equivalent dev-commit at the time of
writing in `tractor` itself, for now the `piker_pin` branch should be
sufficient to avoid breakage 🙏!

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code

k
2026-02-06 00:33:05 -05:00
4 changed files with 16 additions and 34 deletions

View File

@ -277,11 +277,7 @@ async def open_history_client(
if end_dt is None:
inow: int = round(time.time())
if (
(inow - times[-1])
>
timeframe
):
if (inow - times[-1]) > 60:
await tractor.pause()
start_dt = from_timestamp(times[0])

View File

@ -488,6 +488,7 @@ def con2fqme(
@async_lifo_cache()
async def get_mkt_info(
fqme: str,
proxy: MethodProxy | None = None,
) -> tuple[MktPair, ibis.ContractDetails]:
@ -549,7 +550,7 @@ async def get_mkt_info(
size_tick: Decimal = Decimal(
str(details.minSize).rstrip('0')
)
# ?TODO, there is also the Contract.sizeIncrement, bt wtf is it?
# |-> TODO: there is also the Contract.sizeIncrement, bt wtf is it?
# NOTE: this is duplicate from the .broker.norm_trade_records()
# routine, we should factor all this parsing somewhere..

View File

@ -67,9 +67,6 @@ def get_console_log(
name: str|None = None,
pkg_name: str|None = None,
with_tractor_log: bool = False,
# ?TODO, support a "log-spec" style `str|dict[str, str]` which
# dictates both the sublogger-key and a level?
# -> see similar idea in `modden`'s usage.
**tractor_log_kwargs,
) -> logging.Logger:
@ -88,21 +85,9 @@ def get_console_log(
pkg_name in name
):
name: str = name.lstrip(f'{_proj_name}.')
tll: str|None = None
if (
with_tractor_log is not False
):
tll = level
elif maybe_actor := tractor.current_actor(
err_on_no_runtime=False,
):
tll = maybe_actor.loglevel
if tll:
if with_tractor_log:
t_log = tractor.log.get_console_log(
level=tll,
level=level,
name='tractor', # <- XXX, force root tractor log!
**tractor_log_kwargs,
)

View File

@ -2205,7 +2205,7 @@ dev = [
{ name = "pytest", specifier = ">=8.3.5" },
{ name = "stackscope", specifier = ">=0.2.2,<0.3" },
{ name = "typing-extensions", specifier = ">=4.14.1" },
{ name = "xonsh", specifier = ">=0.22.2" },
{ name = "xonsh", specifier = ">=0.22.1" },
]
devx = [
{ name = "greenback", specifier = ">=1.2.1,<2" },
@ -2217,7 +2217,7 @@ repl = [
{ name = "prompt-toolkit", specifier = ">=3.0.50" },
{ name = "psutil", specifier = ">=7.0.0" },
{ name = "pyperclip", specifier = ">=1.9.0" },
{ name = "xonsh", specifier = ">=0.22.2" },
{ name = "xonsh", specifier = ">=0.22.1" },
]
testing = [
{ name = "pexpect", specifier = ">=4.9.0,<5" },
@ -2469,8 +2469,8 @@ wheels = [
[[package]]
name = "xonsh"
version = "0.22.3"
source = { git = "https://github.com/xonsh/xonsh.git?branch=main#b446946fd94c3913e002318db1d1b41ee4fa1f9a" }
version = "0.22.1"
source = { git = "https://github.com/xonsh/xonsh.git?branch=main#336658ff0919f8d7bb96d581136d37d470a8fe99" }
[[package]]
name = "yapic-json"