Compare commits

..

31 Commits

Author SHA1 Message Date
Gud Boi c974ce242c Less newlines in `._rpc` log msg 2026-02-11 22:14:06 -05:00
Gud Boi 7c9be6a772 Use test-harness `loglevel` in inter-peer suite 2026-02-11 22:14:06 -05:00
Gud Boi 1bd2bf9e41 Hide private fields in `Struct.pformat()` output
Skip fields starting with `_` in pretty-printed struct output
to avoid cluttering displays with internal/private state (and/or accessing
private properties which have errors Bp).

Deats,
- add `if k[0] == '_': continue` check to skip private fields
- change nested `if isinstance(v, Struct)` to `elif` since we
  now have early-continue for private fields
- mv `else:` comment to clarify it handles top-level fields
- fix indentation of `yield` statement to only output
  non-private, non-nested fields

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-02-11 22:14:06 -05:00
Gud Boi caba8beccd Tried out an alt approach for `.to_asyncio` crashes
This change is masked out now BUT i'm leaving it in for reference.

I was debugging a multi-actor fault where the primary source actor was
an infected-aio-subactor (`brokerd.ib`) and it seemed like the REPL was only
entering on the `trio` side (at a `.open_channel_from()`) and not
eventually breaking in the `asyncio.Task`. But, since (changing
something?) it seems to be working now, it's just that the `trio` side
seems to sometimes handle before the (source/causing and more
child-ish) `asyncio`-task, which is a bit odd and not expected..
We could likely refine (maybe with an inter-loop-task REPL lock?) this
at some point and ensure a child-`asyncio` task which errors always
grabs the REPL **first**?

Lowlevel deats/further-todos,
- add (masked) `maybe_open_crash_handler()` block around
  `asyncio.Task` execution with notes about weird parent-addr
  delivery bug in `test_sync_pause_from_aio_task`
  * yeah dunno what that's about but made a bug; seems to be IPC
    serialization of the `TCPAddress` struct somewhere??
- add inter-loop lock TODO for avoiding aio-task clobbering
  trio-tasks when both crash in debug-mode

Also,
- change import from `tractor.devx.debug` to `tractor.devx`
- adjust `get_logger()` call to use new implicit mod-name detection
  added to `.log.get_logger()`, i.e. sin `name=__name__`.
- some teensie refinements to `open_channel_from()`:
  * swap return type annotation for  to `tuple[LinkedTaskChannel, Any]`
    (was `Any`).
  * update doc-string to clarify started-value delivery
  * add err-log before `.pause()` in what should be an unreachable path.
  * add todo to swap the `(first, chan)` pair to match that of ctx..

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])

[claude-code-gh]: https://github.com/anthropics/claude-code
2026-02-11 22:14:06 -05:00
Gud Boi 40e0cf51cd Add `uds` to `._multiaddr`, tweak typing 2026-02-11 22:14:06 -05:00
Gud Boi dcc187b57e Add `multiaddr` and bump up some deps
Since we're planning to use it for (discovery) addressing, allowing
replacement of the hacky (pretend) attempt in `tractor._multiaddr` Bp

Also pin some deps,
- make us py312+
- use `pdbp` with my frame indexing fix.
- mv to latest `xonsh` for the fancy cmd/suggestion injections.

Bump lock file to match obvi!
2026-02-11 22:14:06 -05:00
Gud Boi 421d13604f Bump `ruff.toml` to target py313 2026-02-11 22:14:06 -05:00
Tyler Goodlet d9f980388b Use `platformdirs` for `.config.get_rt_dir()`
Thanks to the `tox`-dev community for such a lovely pkg which seems to
solves all the current cross-platform user-dir problems B)

Also this,
- now passes `platformdirs.user_runtime_dir(appname='tractor')`
  and allows caller to pass an optional `subdir` under `tractor/`
  if desired.
- drops the `.config._rtdir: Path` mod var.
- bumps the lock file with the new dep.
2026-02-11 22:13:40 -05:00
Tyler Goodlet a7eee7655d Extend `.to_asyncio.LinkedTaskChannel` for aio side
With methods to comms similar to those that exist for the `trio` side,
- `.get()` which proxies verbatim to the `._to_aio: asyncio.Queue`,
- `.send_nowait()` which thin-wraps to `._to_trio: trio.MemorySendChannel`.

Obviously the more correct design is to break up the channel type into
a pair of handle types, one for each "side's" task in each event-loop,
that's hopefully coming shortly in a follow up patch B)

Also,
- fill in some missing doc strings, tweak some explanation comments and
  update todos.
- adjust the `test_aio_errors_and_channel_propagates_and_closes()` suite
  to use the new `chan` fn-sig-API with `.open_channel_from()` including
  the new methods for msg comms; ensures everything added here works e2e.
2026-02-11 22:13:40 -05:00
Tyler Goodlet 2dddedada9 Hide `._rpc._invoke()` frame, again.. 2026-02-11 22:13:40 -05:00
Tyler Goodlet 1772b8ec2c Explain the `infect_asyncio: bool` param to pass in RTE msg 2026-02-11 22:13:40 -05:00
Tyler Goodlet 5836c7e88c Toss in masked `.set_trace()` for unshielded `.pause()` debug 2026-02-11 22:13:40 -05:00
Gud Boi f03730efa2 Unmask `ClosedResourceError` handling in `._transport`
Unmask the CRE case block for peer-closed socket errors which already
had a TODO about reproducing the condition. It appears this case can
happen during inter-actor comms teardowns in `piker`, but i haven't been
able to figure out exactly what reproduces it yet..

So activate the block again for that 'socket already closed'-msg case,
and add a TODO questioning how to reproduce it.

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-02-11 22:13:35 -05:00
Tyler Goodlet d6c405ec6b Mask tpt-closed handling of `chan.send(return_msg)`
A partial revert of commit c05d08e426 since it seem we already
suppress tpt-closed errors lower down in `.ipc.Channel.send()`; given
that i'm pretty sure this new handler code should basically never run?

Left in a todo to remove the masked content once i'm done more
thoroughly testing under `piker`.
2026-02-11 22:13:35 -05:00
Tyler Goodlet ab7b75a9d6 More `TransportClosed`-handling around IPC-IO
For IPC-disconnects-during-teardown edge cases, augment some `._rpc`
machinery,
- in `._invoke()` around the `await chan.send(return_msg)` where we
  suppress if the underlying `Channel` already disconnected.
- add a disjoint handler in `_errors_relayed_via_ipc()` which just
  reports-n-reraises the exc (same as prior behaviour).
  * originally i thought it needed to be handled specially (to avoid
    being crash handled) but turns out that isn't necessary?
  * hence the also-added-bu-masked-out `debug_filter` / guard expression
    around the `await debug._maybe_enter_pm()` line.
- show the `._invoke()` frame for the moment.
2026-02-11 22:13:35 -05:00
Bd 51ac0c623e
Merge pull request #402 from goodboy/log_sys_testing
Log sys testing, starting to get "serious" about it..
2026-02-11 22:13:17 -05:00
Gud Boi 3f0bde1bf8 Use bare `get_logger()` in `.to_asyncio` 2026-02-11 22:02:41 -05:00
Gud Boi fa1a15dce8 Cleaups per copilot PR review 2026-02-11 21:51:40 -05:00
Gud Boi 5850844297 Mk `test_implicit_mod_name_applied_for_child()` check init-mods
Test pkg-level init module and sub-pkg module logger naming
to better validate auto-naming logic.

Deats,
- create `pkg_init_mod` and write `mod_code` to it for
  testing pkg-level `__init__.py` logger instance creation.
  * assert `snakelib.__init__` logger name is `proj_name`.
- write `mod_code` to `subpkg/__init__.py`` as well and check the same.

Also,
- rename some vars,
  * `pkg_mod` -> `pkg_submod`,
  * `pkgmod` -> `subpkgmod`
- add `ModuleType` import for type hints
- improve comments explaining pkg init vs first-level
  sub-module naming expectations.
- drop trailing whitespace and unused TODO comment
- remove masked `breakpoint()` call

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-02-11 21:43:37 -05:00
Gud Boi ff02939213 Toss in some `colorlog` alts to try 2026-02-11 21:05:16 -05:00
Gud Boi d61e8caab2 Improve `test_log_sys` for new auto-naming logic
Add assertions and comments to better test the reworked
implicit module-name detection in `get_logger()`.

Deats,
- add `assert not tractor.current_actor()` check to verify
  no runtime is active during test.
- import `.log` submod directly for use.
- add masked `breakpoint()` for debugging mod loading.
- add comment about using `ranger` to inspect `testdir` layout
  of auto-generated py pkg + module-files.
- improve comments explaining pkg-root-log creation.
- add TODO for testing `get_logger()` call from pkg
  `__init__.py`
- add comment about first-pkg-level module naming.

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-02-11 21:05:07 -05:00
Gud Boi 0b0c83e9da Drop `name=__name__` from all `get_logger()` calls
Use new implicit module-name detection throughout codebase to simplify
logger creation and leverage auto-naming from caller mod .

Main changes,
- drop `name=__name__` arg from all `get_logger()` calls
  (across 29 modules).
- update `get_console_log()` calls to include `name='tractor'` for
  enabling root logger in test harness and entry points; this ensures
  logic in `get_logger()` triggers so that **all** `tractor`-internal
  logging emits to console.
- add info log msg in test `conftest.py` showing test-harness
  log level

Also,
- fix `.actor.uid` ref to `.actor.aid.uid` in `._trace`.
- adjust a `._context` log msg formatting for clarity.
- add TODO comments in `._addr`, `._uds` for when we mv to
  using `multiaddr`.
- add todo for `RuntimeVars` type hint TODO in `.msg.types` (once we
  eventually get that all going obvi!)

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-02-11 21:04:49 -05:00
Gud Boi 5e7c0f264d Rework `.get_logger()`, better autonaming, deduping
Overhaul of the automatic-calling-module-name detection and sub-log
creation logic to avoid (at least warn) on duplication(s) and still
handle the common usage of a call with `name=__name__` from a mod's top
level scope.

Main `get_logger()` changes,
- refactor auto-naming logic for implicit `name=None` case such that we
  handle at least `tractor` internal "bare" calls from internal submods.
- factor out the `get_caller_mod()` closure (still inside
  `get_logger()`)for introspecting caller's module with configurable
  frame depth.
- use `.removeprefix()` instead of `.lstrip()` for stripping pkg-name
  from mod paths
- mv root-logger creation before sub-logger name processing
- improve duplicate detection for `pkg_name` in `name`
- add `_strict_debug=True`-only-emitted warnings for duplicate
  pkg/leaf-mod names.
- use `print()` fallback for warnings when no actor runtime is up at
  call time.

Surrounding tweaks,
- add `.level` property to `StackLevelAdapter` for getting
  current emit level as lowercase `str`.
- mv `_proj_name` def to just above `get_logger()`
- use `_curr_actor_no_exc` partial in `_conc_name_getters`
  to avoid runtime errors
- improve comments/doc-strings throughout
- keep some masked `breakpoint()` calls for future debugging

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-02-11 21:04:29 -05:00
Gud Boi edf1189fe0 Multi-line styling in `test.devx.conftest` 2026-02-11 21:04:22 -05:00
Tyler Goodlet de24bfe052 Mv `load_module_from_path()` to a new `._code_load` submod 2026-02-11 21:03:29 -05:00
Tyler Goodlet e235b96894 Use new `pkg_name` in log-sys test suites 2026-02-11 21:03:07 -05:00
Tyler Goodlet dea4b9fd93 Implicitly name sub-logs by caller's mod
That is when no `name` is passed to `get_logger()`, try to introspect
the caller's `module.__name__` and use it to infer/get the "namespace
path" to that module the same as if using `name=__name__` as in the most
common usage.

Further, change the `_root_name` to be `pkg_name: str`, a public and
more obvious param name, and deprecate the former. This obviously adds
the necessary impl to make the new
`test_sys_log::test_implicit_mod_name_applied_for_child` test pass.

Impl detalles for `get_logger()`,
- add `pkg_name` and deprecate `_root_name`, include failover logic
  and a warning.
- implement calling module introspection using
  `inspect.stack()/getmodule()` to get both the `.__name__` and
  `.__package__` info alongside adjusted logic to set the `name`
  when not provided but only when a new `mk_sublog: bool` is set.
- tweak the `name` processing for implicitly set case,
  - rename `sub_name` -> `pkg_path: str` which is the path
    to the calling module minus that module's name component.
  - only partition `name` if `pkg_name` is `in` it.
  - use the `_root_log` for `pkg_name` duplication warnings.

Other/related,
- add types to various public mod vars missing them.
- rename `.log.log` -> `.log._root_log`.
2026-02-11 21:03:07 -05:00
Tyler Goodlet 557e2cec6a Add an implicit-pkg-path-as-logger-name test
A bit of test driven dev to anticipate support  of `.log.get_logger()`
usage such that it can be called from arbitrary sub-modules, themselves
embedded in arbitrary sub-pkgs, of some project; the when not provided,
the `sub_name` passed to the `Logger.getChild(<sub_name>)` will be set
as the sub-pkg path "down to" the calling module.

IOW if you call something like,

`log = tractor.log.get_logger(pkg_name='mypylib')`

from some `submod.py` in a project-dir that looks like,

mypylib/
  mod.py
  subpkg/
    submod.py  <- calling module

the `log: StackLevelAdapter` child-`Logger` instance will have a
`.name: str = 'mypylib.subpkg'`, discluding the `submod` part since this
already rendered as the `{filename}` header in `log.LOG_FORMAT`.

Previously similar behaviour would be obtained by passing
`get_logger(name=__name__)` in the calling module and so much so it
motivated me to make this the default, presuming we can introspect for
the info.

Impl deats,
- duplicated a `load_module_from_path()` from `modden` to load the
  `testdir` rendered py project dir from its path.
 |_should prolly factor it down to this lib anyway bc we're going to
   need it for hot code reload? (well that and `watchfiles` Bp)
- in each of `mod.py` and `submod.py` render the `get_logger()` code
  sin `name`, expecting the (coming shortly) implicit introspection
  feat to do this.
- do `.name` and `.parent` checks against expected sub-logger values
  from `StackLevelAdapter.logger.getChildren()`.
2026-02-11 21:03:07 -05:00
Tyler Goodlet 0e3229f16d Start a logging-sys unit-test module
To start ensuring that when `name=__name__` is passed we try to
de-duplicate the `_root_name` and any `leaf_mod: str` since it's already
included in the headers as `{filename}`.

Deats,
- heavily document the de-duplication `str.partition()`s in
  `.log.get_logger()` and provide the end fix by changing the predicate,
  `if rname == 'tractor':` -> `if rname == _root_name`.
  * also toss in some warnings for when we still detect duplicates.
- add todo comments around logging "filters" (vs. our "adapter").
- create the new `test_log_sys.test_root_pkg_not_duplicated()` which
  runs green with the fixes from ^.
- add a ton of test-suite todos both for existing and anticipated
  logging sys feats in the new mod.
2026-02-11 21:03:07 -05:00
Bd 448d25aef4
Merge pull request #409 from goodboy/nixos_flake
Nixos flake, for the *too-hip-for-arch-ers*
2026-02-11 21:02:37 -05:00
Gud Boi 343c9e0034 Tweaks per the `copilot` PR review 2026-02-11 20:55:08 -05:00
7 changed files with 85 additions and 48 deletions

View File

@ -2,7 +2,7 @@
# https://pyproject-nix.github.io/pyproject.nix/templates.html#impure # https://pyproject-nix.github.io/pyproject.nix/templates.html#impure
# https://github.com/pyproject-nix/pyproject.nix/blob/master/templates/impure/flake.nix # https://github.com/pyproject-nix/pyproject.nix/blob/master/templates/impure/flake.nix
{ {
description = "An impure overlay using `uv` with Nix(OS)"; description = "An impure overlay (w dev-shell) using `uv`";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
@ -29,17 +29,17 @@
{ {
default = pkgs.mkShell { default = pkgs.mkShell {
packages = with pkgs; [ packages = [
# XXX, ensure sh completions activate! # XXX, ensure sh completions activate!
bashInteractive pkgs.bashInteractive
bash-completion pkgs.bash-completion
# on nixos, use pkg(s) # XXX, on nix(os), use pkgs version to avoid
ruff # build/sys-sh-integration issues
pypkgs.ruff pkgs.ruff
uv pkgs.uv
python313 # ?TODO^ how to set from `cpython` above? pkgs.${cpython}# ?TODO^ how to set from `cpython` above?
]; ];
shellHook = '' shellHook = ''
@ -56,7 +56,7 @@
# - always use the ./py313/ venv-subdir # - always use the ./py313/ venv-subdir
# - sync env with all extras # - sync env with all extras
export UV_PROJECT_ENVIRONMENT=${venv_dir} export UV_PROJECT_ENVIRONMENT=${venv_dir}
uv sync --dev --all-extras --no-group lint uv sync --dev --all-extras
# ------ TIPS ------ # ------ TIPS ------
# NOTE, to launch the py-venv installed `xonsh` (like @goodboy) # NOTE, to launch the py-venv installed `xonsh` (like @goodboy)

View File

@ -1020,6 +1020,9 @@ def test_peer_spawns_and_cancels_service_subactor(
raise_client_error: str, raise_client_error: str,
reg_addr: tuple[str, int], reg_addr: tuple[str, int],
raise_sub_spawn_error_after: float|None, raise_sub_spawn_error_after: float|None,
loglevel: str,
# ^XXX, set to 'warning' to see masked-exc warnings
# that may transpire during actor-nursery teardown.
): ):
# NOTE: this tests for the modden `mod wks open piker` bug # NOTE: this tests for the modden `mod wks open piker` bug
# discovered as part of implementing workspace ctx # discovered as part of implementing workspace ctx
@ -1049,6 +1052,7 @@ def test_peer_spawns_and_cancels_service_subactor(
# NOTE: to halt the peer tasks on ctxc, uncomment this. # NOTE: to halt the peer tasks on ctxc, uncomment this.
debug_mode=debug_mode, debug_mode=debug_mode,
registry_addrs=[reg_addr], registry_addrs=[reg_addr],
loglevel=loglevel,
) as an: ) as an:
server: Portal = await an.start_actor( server: Portal = await an.start_actor(
(server_name := 'spawn_server'), (server_name := 'spawn_server'),

View File

@ -4,10 +4,14 @@
''' '''
from pathlib import Path from pathlib import Path
import shutil import shutil
from types import ModuleType
import pytest import pytest
import tractor import tractor
from tractor import _code_load from tractor import (
_code_load,
log,
)
def test_root_pkg_not_duplicated_in_logger_name(): def test_root_pkg_not_duplicated_in_logger_name():
@ -20,12 +24,15 @@ def test_root_pkg_not_duplicated_in_logger_name():
project_name: str = 'pylib' project_name: str = 'pylib'
pkg_path: str = 'pylib.subpkg.mod' pkg_path: str = 'pylib.subpkg.mod'
proj_log = tractor.log.get_logger( assert not tractor.current_actor(
err_on_no_runtime=False,
)
proj_log = log.get_logger(
pkg_name=project_name, pkg_name=project_name,
mk_sublog=False, mk_sublog=False,
) )
sublog = tractor.log.get_logger( sublog = log.get_logger(
pkg_name=project_name, pkg_name=project_name,
name=pkg_path, name=pkg_path,
) )
@ -51,56 +58,86 @@ def test_implicit_mod_name_applied_for_child(
mod_code: str = ( mod_code: str = (
f'import tractor\n' f'import tractor\n'
f'\n' f'\n'
# if you need to trace `testdir` stuff @ import-time..
# f'breakpoint()\n'
f'log = tractor.log.get_logger(pkg_name="{proj_name}")\n' f'log = tractor.log.get_logger(pkg_name="{proj_name}")\n'
) )
# create a sub-module for each pkg layer # create a sub-module for each pkg layer
_lib = testdir.mkpydir(proj_name) _lib = testdir.mkpydir(proj_name)
pkg: Path = Path(_lib) pkg: Path = Path(_lib)
pkg_init_mod: Path = pkg / "__init__.py"
pkg_init_mod.write_text(mod_code)
subpkg: Path = pkg / 'subpkg' subpkg: Path = pkg / 'subpkg'
subpkg.mkdir() subpkg.mkdir()
subpkgmod: Path = subpkg / "__init__.py"
pkgmod: Path = subpkg / "__init__.py" subpkgmod.touch()
pkgmod.touch() subpkgmod.write_text(mod_code)
_submod: Path = testdir.makepyfile( _submod: Path = testdir.makepyfile(
_mod=mod_code, _mod=mod_code,
) )
pkg_mod = pkg / 'mod.py' pkg_submod = pkg / 'mod.py'
pkg_subpkg_submod = subpkg / 'submod.py' pkg_subpkg_submod = subpkg / 'submod.py'
shutil.copyfile( shutil.copyfile(
_submod, _submod,
pkg_mod, pkg_submod,
) )
shutil.copyfile( shutil.copyfile(
_submod, _submod,
pkg_subpkg_submod, pkg_subpkg_submod,
) )
testdir.chdir() testdir.chdir()
# NOTE, to introspect the py-file-module-layout use (in .xsh
# syntax): `ranger @str(testdir)`
# XXX NOTE, once the "top level" pkg mod has been # XXX NOTE, once the "top level" pkg mod has been
# imported, we can then use `import` syntax to # imported, we can then use `import` syntax to
# import it's sub-pkgs and modules. # import it's sub-pkgs and modules.
pkgmod = _code_load.load_module_from_path( subpkgmod: ModuleType = _code_load.load_module_from_path(
Path(pkg / '__init__.py'), Path(pkg / '__init__.py'),
module_name=proj_name, module_name=proj_name,
) )
pkg_root_log = tractor.log.get_logger(
pkg_root_log = log.get_logger(
pkg_name=proj_name, pkg_name=proj_name,
mk_sublog=False, mk_sublog=False,
) )
# the top level pkg-mod, created just now,
# by above API call.
assert pkg_root_log.name == proj_name assert pkg_root_log.name == proj_name
assert not pkg_root_log.logger.getChildren() assert not pkg_root_log.logger.getChildren()
#
# ^TODO! test this same output but created via a `get_logger()`
# call in the `snakelib.__init__py`!!
# NOTE, the pkg-level "init mod" should of course
# have the same name as the package ns-path.
import snakelib as init_mod
assert init_mod.log.name == proj_name
# NOTE, a first-pkg-level sub-module should only
# use the package-name since the leaf-node-module
# will be included in log headers by default.
from snakelib import mod from snakelib import mod
assert mod.log.name == proj_name assert mod.log.name == proj_name
from snakelib import subpkg
assert (
subpkg.log.name
==
subpkg.__package__
==
f'{proj_name}.subpkg'
)
from snakelib.subpkg import submod from snakelib.subpkg import submod
assert ( assert (
submod.log.name submod.log.name
== ==
submod.__package__ # ?TODO, use this in `.get_logger()` instead? submod.__package__
== ==
f'{proj_name}.subpkg' f'{proj_name}.subpkg'
) )
@ -109,8 +146,6 @@ def test_implicit_mod_name_applied_for_child(
assert len(sub_logs) == 1 # only one nested sub-pkg module assert len(sub_logs) == 1 # only one nested sub-pkg module
assert submod.log.logger in sub_logs assert submod.log.logger in sub_logs
# breakpoint()
# TODO, moar tests against existing feats: # TODO, moar tests against existing feats:
# ------ - ------ # ------ - ------

View File

@ -897,9 +897,9 @@ async def _invoke(
) )
logmeth( logmeth(
f'{message}\n' f'{message}'
f'\n' f'\n'
f'{descr_str}\n' f'{descr_str}'
) )

View File

@ -459,21 +459,23 @@ class MsgpackTransport(MsgTransport):
) )
raise tpt_closed from trans_err raise tpt_closed from trans_err
# case trio.ClosedResourceError() if ( # ??TODO??, what case in piker does this and HOW
# 'this socket was already closed' # CAN WE RE-PRODUCE IT?!?!?
# in case trio.ClosedResourceError() if (
# trans_err.args[0] 'this socket was already closed'
# ): in
# tpt_closed = TransportClosed.from_src_exc( trans_err.args[0]
# message=( ):
# f'{tpt_name} already closed by peer\n' tpt_closed = TransportClosed.from_src_exc(
# ), message=(
# body=f'{self}\n', f'{tpt_name} already closed by peer\n'
# src_exc=trans_err, ),
# raise_on_report=True, body=f'{self}\n',
# loglevel='transport', src_exc=trans_err,
# ) raise_on_report=True,
# raise tpt_closed from trans_err loglevel='transport',
)
raise tpt_closed from trans_err
# unless the disconnect condition falls under "a # unless the disconnect condition falls under "a
# normal operation breakage" we usualy console warn # normal operation breakage" we usualy console warn

View File

@ -169,7 +169,7 @@ class UDSAddress(
# ?^TODO, for `multiaddr`'s parser we can't use the `::` # ?^TODO, for `multiaddr`'s parser we can't use the `::`
# above^, SO maybe a `.` or something else here? # above^, SO maybe a `.` or something else here?
# sockname: str = '.'.join(actor.uid) + f'@{pid}' # sockname: str = '.'.join(actor.uid) + f'@{pid}'
# -[ ] CURRETLY using `.` BREAKS TEST SUITE tho.. # -[ ] CURRENTLY using `.` BREAKS TEST SUITE tho..
else: else:
prefix: str = '<unknown-actor>' prefix: str = '<unknown-actor>'
if is_root_process(): if is_root_process():

View File

@ -42,6 +42,9 @@ from types import ModuleType
import warnings import warnings
import colorlog # type: ignore import colorlog # type: ignore
# ?TODO, some other (modern) alt libs?
# import coloredlogs
# import colored_traceback.auto # ?TODO, need better config?
import trio import trio
from ._state import current_actor from ._state import current_actor
@ -413,9 +416,6 @@ def get_logger(
mod_ns_path: str = caller_mod.__name__ mod_ns_path: str = caller_mod.__name__
mod_pkg_ns_path: str = caller_mod.__package__ mod_pkg_ns_path: str = caller_mod.__package__
# if 'snakelib' in mod_pkg_ns_path:
# import pdbp
# breakpoint()
if ( if (
mod_pkg_ns_path in mod_ns_path mod_pkg_ns_path in mod_ns_path
or or
@ -488,10 +488,6 @@ def get_logger(
proper_name: str = name.removeprefix( proper_name: str = name.removeprefix(
f'{pkg_name}.' f'{pkg_name}.'
) )
# if 'pylib' in name:
# import pdbp
# breakpoint()
msg: str = ( msg: str = (
f'@ {get_caller_mod()}\n' f'@ {get_caller_mod()}\n'
f'Duplicate pkg-name in sub-logger `name`-key?\n' f'Duplicate pkg-name in sub-logger `name`-key?\n'