piker/piker/service/_registry.py

267 lines
6.8 KiB
Python
Raw Normal View History

# 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/>.
"""
Inter-actor "discovery" (protocol) layer.
"""
from __future__ import annotations
from contextlib import (
asynccontextmanager as acm,
)
from typing import (
Any,
TypeAlias,
)
import tractor
Use `name=__name__` for logs throughout `.service` Change all `.service` sub-modules to use `get_logger(name=__name__)` for per-submod instances vs a shared `._util.log`. Deats, - import `get_logger()` and `get_console_log()` from top-level `piker.log` instead of `._util` for all. - drop `log` and `get_console_log()` partial from `._util`. - add `name=subsys` kwarg to `get_console_log()` call in `_actor_runtime.maybe_open_pikerd()`. - add `name='piker.service'` to `get_console_log()` in `_ahab.open_ahabd()`. - change default `loglevel` from `None` to `'cancel'` in `_ahab.open_ahabd()`. - add sanity check: `assert log.name == 'piker.service'` in `_daemon.maybe_spawn_daemon()`. - change `print()` -> `log.info()` in `_registry.find_service()`. - drop stray `from piker.service._util import log` import in `brokers._daemon.spawn_brokerd()`. Styling/cleanups, - drop blank lines from various fn sigs. - do more sin-ws union type annots. - add more multiline style to `or` expressions in `_actor_runtime` and `_registry`. - update `._util` docstring with TODO about `import`-time console log setup. - add TODO comments in `_registry` about UDS registry support. - use `.aid.uid` from actor in `_registry.open_registry()`. - add intermediate var `reg_addrs` in `_registry.open_registry()` (bc i was tracing rtvs value issues in `tractor`). - add `pformat` import to `.elastic` (code path is currently not used but figured might as well appease the linter..) (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-13 19:34:45 +00:00
from tractor import (
msg,
Actor,
Portal,
)
from tractor.discovery._addr import (
LegacyUnwrappedAddress,
UnwrappedAddress,
wrap_address,
)
Use `name=__name__` for logs throughout `.service` Change all `.service` sub-modules to use `get_logger(name=__name__)` for per-submod instances vs a shared `._util.log`. Deats, - import `get_logger()` and `get_console_log()` from top-level `piker.log` instead of `._util` for all. - drop `log` and `get_console_log()` partial from `._util`. - add `name=subsys` kwarg to `get_console_log()` call in `_actor_runtime.maybe_open_pikerd()`. - add `name='piker.service'` to `get_console_log()` in `_ahab.open_ahabd()`. - change default `loglevel` from `None` to `'cancel'` in `_ahab.open_ahabd()`. - add sanity check: `assert log.name == 'piker.service'` in `_daemon.maybe_spawn_daemon()`. - change `print()` -> `log.info()` in `_registry.find_service()`. - drop stray `from piker.service._util import log` import in `brokers._daemon.spawn_brokerd()`. Styling/cleanups, - drop blank lines from various fn sigs. - do more sin-ws union type annots. - add more multiline style to `or` expressions in `_actor_runtime` and `_registry`. - update `._util` docstring with TODO about `import`-time console log setup. - add TODO comments in `_registry` about UDS registry support. - use `.aid.uid` from actor in `_registry.open_registry()`. - add intermediate var `reg_addrs` in `_registry.open_registry()` (bc i was tracing rtvs value issues in `tractor`). - add `pformat` import to `.elastic` (code path is currently not used but figured might as well appease the linter..) (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-13 19:34:45 +00:00
from piker.log import get_logger
log = get_logger(name=__name__)
# Piker config still accepts legacy socket pairs while tractor now
# emits tagged `UnwrappedAddress` values.
RegistryAddress: TypeAlias = (
LegacyUnwrappedAddress
|UnwrappedAddress
)
Use `name=__name__` for logs throughout `.service` Change all `.service` sub-modules to use `get_logger(name=__name__)` for per-submod instances vs a shared `._util.log`. Deats, - import `get_logger()` and `get_console_log()` from top-level `piker.log` instead of `._util` for all. - drop `log` and `get_console_log()` partial from `._util`. - add `name=subsys` kwarg to `get_console_log()` call in `_actor_runtime.maybe_open_pikerd()`. - add `name='piker.service'` to `get_console_log()` in `_ahab.open_ahabd()`. - change default `loglevel` from `None` to `'cancel'` in `_ahab.open_ahabd()`. - add sanity check: `assert log.name == 'piker.service'` in `_daemon.maybe_spawn_daemon()`. - change `print()` -> `log.info()` in `_registry.find_service()`. - drop stray `from piker.service._util import log` import in `brokers._daemon.spawn_brokerd()`. Styling/cleanups, - drop blank lines from various fn sigs. - do more sin-ws union type annots. - add more multiline style to `or` expressions in `_actor_runtime` and `_registry`. - update `._util` docstring with TODO about `import`-time console log setup. - add TODO comments in `_registry` about UDS registry support. - use `.aid.uid` from actor in `_registry.open_registry()`. - add intermediate var `reg_addrs` in `_registry.open_registry()` (bc i was tracing rtvs value issues in `tractor`). - add `pformat` import to `.elastic` (code path is currently not used but figured might as well appease the linter..) (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-13 19:34:45 +00:00
# TODO? default path-space for UDS registry?
# [ ] needs to be Xplatform tho!
# _default_registry_path: Path = (
# Path(os.environ['XDG_RUNTIME_DIR'])
# /'piker'
# )
_default_registry_host: str = '127.0.0.1'
_default_registry_port: int = 6116
_default_reg_addr: RegistryAddress = (
_default_registry_host,
_default_registry_port,
)
# NOTE: this value is set as an actor-global once the first endpoint
# who is capable, spawns a `pikerd` service tree.
_registry: Registry | None = None
class Registry:
# TODO: should this be a set or should we complain
# on duplicates?
addrs: list[RegistryAddress] = []
# TODO: table of uids to sockaddrs
peers: dict[
tuple[str, str],
RegistryAddress,
] = {}
_tractor_kwargs: dict[str, Any] = {}
def _normalize_addresses(
addrs: list[RegistryAddress],
) -> list[RegistryAddress]:
'''
Normalize legacy and tagged addresses through tractor's codec.
'''
return [
wrap_address(addr).unwrap()
for addr in addrs
]
@acm
async def open_registry(
addrs: list[RegistryAddress],
ensure_exists: bool = True,
) -> list[RegistryAddress]:
'''
Open the service-actor-discovery registry by returning a set of
tranport socket-addrs to registrar actors which may be
contacted and queried for similar addresses for other
non-registrar actors.
'''
global _tractor_kwargs
Use `name=__name__` for logs throughout `.service` Change all `.service` sub-modules to use `get_logger(name=__name__)` for per-submod instances vs a shared `._util.log`. Deats, - import `get_logger()` and `get_console_log()` from top-level `piker.log` instead of `._util` for all. - drop `log` and `get_console_log()` partial from `._util`. - add `name=subsys` kwarg to `get_console_log()` call in `_actor_runtime.maybe_open_pikerd()`. - add `name='piker.service'` to `get_console_log()` in `_ahab.open_ahabd()`. - change default `loglevel` from `None` to `'cancel'` in `_ahab.open_ahabd()`. - add sanity check: `assert log.name == 'piker.service'` in `_daemon.maybe_spawn_daemon()`. - change `print()` -> `log.info()` in `_registry.find_service()`. - drop stray `from piker.service._util import log` import in `brokers._daemon.spawn_brokerd()`. Styling/cleanups, - drop blank lines from various fn sigs. - do more sin-ws union type annots. - add more multiline style to `or` expressions in `_actor_runtime` and `_registry`. - update `._util` docstring with TODO about `import`-time console log setup. - add TODO comments in `_registry` about UDS registry support. - use `.aid.uid` from actor in `_registry.open_registry()`. - add intermediate var `reg_addrs` in `_registry.open_registry()` (bc i was tracing rtvs value issues in `tractor`). - add `pformat` import to `.elastic` (code path is currently not used but figured might as well appease the linter..) (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-13 19:34:45 +00:00
actor: Actor = tractor.current_actor()
aid: msg.Aid = actor.aid
uid: tuple[str, str] = aid.uid
addrs = _normalize_addresses(addrs)
preset_reg_addrs: list[RegistryAddress] = (
_normalize_addresses(Registry.addrs)
)
if preset_reg_addrs:
Registry.addrs = preset_reg_addrs
if (
preset_reg_addrs
Use `name=__name__` for logs throughout `.service` Change all `.service` sub-modules to use `get_logger(name=__name__)` for per-submod instances vs a shared `._util.log`. Deats, - import `get_logger()` and `get_console_log()` from top-level `piker.log` instead of `._util` for all. - drop `log` and `get_console_log()` partial from `._util`. - add `name=subsys` kwarg to `get_console_log()` call in `_actor_runtime.maybe_open_pikerd()`. - add `name='piker.service'` to `get_console_log()` in `_ahab.open_ahabd()`. - change default `loglevel` from `None` to `'cancel'` in `_ahab.open_ahabd()`. - add sanity check: `assert log.name == 'piker.service'` in `_daemon.maybe_spawn_daemon()`. - change `print()` -> `log.info()` in `_registry.find_service()`. - drop stray `from piker.service._util import log` import in `brokers._daemon.spawn_brokerd()`. Styling/cleanups, - drop blank lines from various fn sigs. - do more sin-ws union type annots. - add more multiline style to `or` expressions in `_actor_runtime` and `_registry`. - update `._util` docstring with TODO about `import`-time console log setup. - add TODO comments in `_registry` about UDS registry support. - use `.aid.uid` from actor in `_registry.open_registry()`. - add intermediate var `reg_addrs` in `_registry.open_registry()` (bc i was tracing rtvs value issues in `tractor`). - add `pformat` import to `.elastic` (code path is currently not used but figured might as well appease the linter..) (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-13 19:34:45 +00:00
and
addrs
):
if preset_reg_addrs != addrs:
# if any(addr in preset_reg_addrs for addr in addrs):
diff: set[RegistryAddress] = (
set(preset_reg_addrs)
-set(addrs)
)
if diff:
log.warning(
f'`{uid}` requested only subset of registrars: {addrs}\n'
f'However there are more @{diff}'
)
else:
raise RuntimeError(
f'`{uid}` has non-matching registrar addresses?\n'
f'request: {addrs}\n'
f'already set: {preset_reg_addrs}'
)
was_set: bool = False
if (
not tractor.is_root_process()
and
not Registry.addrs
):
Registry.addrs.extend(
_normalize_addresses(actor.reg_addrs)
)
if (
ensure_exists
and
not Registry.addrs
):
raise RuntimeError(
f"`{uid}` registry should already exist but doesn't?"
)
Use `name=__name__` for logs throughout `.service` Change all `.service` sub-modules to use `get_logger(name=__name__)` for per-submod instances vs a shared `._util.log`. Deats, - import `get_logger()` and `get_console_log()` from top-level `piker.log` instead of `._util` for all. - drop `log` and `get_console_log()` partial from `._util`. - add `name=subsys` kwarg to `get_console_log()` call in `_actor_runtime.maybe_open_pikerd()`. - add `name='piker.service'` to `get_console_log()` in `_ahab.open_ahabd()`. - change default `loglevel` from `None` to `'cancel'` in `_ahab.open_ahabd()`. - add sanity check: `assert log.name == 'piker.service'` in `_daemon.maybe_spawn_daemon()`. - change `print()` -> `log.info()` in `_registry.find_service()`. - drop stray `from piker.service._util import log` import in `brokers._daemon.spawn_brokerd()`. Styling/cleanups, - drop blank lines from various fn sigs. - do more sin-ws union type annots. - add more multiline style to `or` expressions in `_actor_runtime` and `_registry`. - update `._util` docstring with TODO about `import`-time console log setup. - add TODO comments in `_registry` about UDS registry support. - use `.aid.uid` from actor in `_registry.open_registry()`. - add intermediate var `reg_addrs` in `_registry.open_registry()` (bc i was tracing rtvs value issues in `tractor`). - add `pformat` import to `.elastic` (code path is currently not used but figured might as well appease the linter..) (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-13 19:34:45 +00:00
if not Registry.addrs:
was_set = True
Use `name=__name__` for logs throughout `.service` Change all `.service` sub-modules to use `get_logger(name=__name__)` for per-submod instances vs a shared `._util.log`. Deats, - import `get_logger()` and `get_console_log()` from top-level `piker.log` instead of `._util` for all. - drop `log` and `get_console_log()` partial from `._util`. - add `name=subsys` kwarg to `get_console_log()` call in `_actor_runtime.maybe_open_pikerd()`. - add `name='piker.service'` to `get_console_log()` in `_ahab.open_ahabd()`. - change default `loglevel` from `None` to `'cancel'` in `_ahab.open_ahabd()`. - add sanity check: `assert log.name == 'piker.service'` in `_daemon.maybe_spawn_daemon()`. - change `print()` -> `log.info()` in `_registry.find_service()`. - drop stray `from piker.service._util import log` import in `brokers._daemon.spawn_brokerd()`. Styling/cleanups, - drop blank lines from various fn sigs. - do more sin-ws union type annots. - add more multiline style to `or` expressions in `_actor_runtime` and `_registry`. - update `._util` docstring with TODO about `import`-time console log setup. - add TODO comments in `_registry` about UDS registry support. - use `.aid.uid` from actor in `_registry.open_registry()`. - add intermediate var `reg_addrs` in `_registry.open_registry()` (bc i was tracing rtvs value issues in `tractor`). - add `pformat` import to `.elastic` (code path is currently not used but figured might as well appease the linter..) (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-13 19:34:45 +00:00
Registry.addrs = (
addrs
or
_normalize_addresses([_default_reg_addr])
Use `name=__name__` for logs throughout `.service` Change all `.service` sub-modules to use `get_logger(name=__name__)` for per-submod instances vs a shared `._util.log`. Deats, - import `get_logger()` and `get_console_log()` from top-level `piker.log` instead of `._util` for all. - drop `log` and `get_console_log()` partial from `._util`. - add `name=subsys` kwarg to `get_console_log()` call in `_actor_runtime.maybe_open_pikerd()`. - add `name='piker.service'` to `get_console_log()` in `_ahab.open_ahabd()`. - change default `loglevel` from `None` to `'cancel'` in `_ahab.open_ahabd()`. - add sanity check: `assert log.name == 'piker.service'` in `_daemon.maybe_spawn_daemon()`. - change `print()` -> `log.info()` in `_registry.find_service()`. - drop stray `from piker.service._util import log` import in `brokers._daemon.spawn_brokerd()`. Styling/cleanups, - drop blank lines from various fn sigs. - do more sin-ws union type annots. - add more multiline style to `or` expressions in `_actor_runtime` and `_registry`. - update `._util` docstring with TODO about `import`-time console log setup. - add TODO comments in `_registry` about UDS registry support. - use `.aid.uid` from actor in `_registry.open_registry()`. - add intermediate var `reg_addrs` in `_registry.open_registry()` (bc i was tracing rtvs value issues in `tractor`). - add `pformat` import to `.elastic` (code path is currently not used but figured might as well appease the linter..) (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-13 19:34:45 +00:00
)
# NOTE: only spot this seems currently used is inside
# `.ui._exec` which is the (eventual qtloops) bootstrapping
# with guest mode.
reg_addrs: list[RegistryAddress] = Registry.addrs
Use `name=__name__` for logs throughout `.service` Change all `.service` sub-modules to use `get_logger(name=__name__)` for per-submod instances vs a shared `._util.log`. Deats, - import `get_logger()` and `get_console_log()` from top-level `piker.log` instead of `._util` for all. - drop `log` and `get_console_log()` partial from `._util`. - add `name=subsys` kwarg to `get_console_log()` call in `_actor_runtime.maybe_open_pikerd()`. - add `name='piker.service'` to `get_console_log()` in `_ahab.open_ahabd()`. - change default `loglevel` from `None` to `'cancel'` in `_ahab.open_ahabd()`. - add sanity check: `assert log.name == 'piker.service'` in `_daemon.maybe_spawn_daemon()`. - change `print()` -> `log.info()` in `_registry.find_service()`. - drop stray `from piker.service._util import log` import in `brokers._daemon.spawn_brokerd()`. Styling/cleanups, - drop blank lines from various fn sigs. - do more sin-ws union type annots. - add more multiline style to `or` expressions in `_actor_runtime` and `_registry`. - update `._util` docstring with TODO about `import`-time console log setup. - add TODO comments in `_registry` about UDS registry support. - use `.aid.uid` from actor in `_registry.open_registry()`. - add intermediate var `reg_addrs` in `_registry.open_registry()` (bc i was tracing rtvs value issues in `tractor`). - add `pformat` import to `.elastic` (code path is currently not used but figured might as well appease the linter..) (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-13 19:34:45 +00:00
# !TODO, a struct-API to stringently allow this only in special
# cases?
# -> better would be to have some way to (atomically) rewrite
# and entire `RuntimeVars`?? ideas welcome obvi..
_tractor_kwargs['registry_addrs'] = reg_addrs
try:
yield Registry.addrs
finally:
# XXX: always clear the global addr if we set it so that the
# next (set of) calls will apply whatever new one is passed
# in.
if was_set:
Registry.addrs = []
@acm
async def find_service(
service_name: str,
registry_addrs: list[RegistryAddress] | None = None,
first_only: bool = True,
) -> (
Portal
| list[Portal]
| None
):
# try:
reg_addrs: list[RegistryAddress]
async with open_registry(
addrs=(
registry_addrs
# NOTE: if no addr set is passed assume the registry has
# already been opened and use the previously applied
# startup set.
or Registry.addrs
),
) as reg_addrs:
log.info(
f'Scanning for service {service_name!r}'
)
# attach to existing daemon by name if possible
maybe_portals: list[Portal]|Portal|None
async with tractor.find_actor(
service_name,
registry_addrs=reg_addrs,
only_first=first_only, # if set only returns single ref
) as maybe_portals:
if not maybe_portals:
Use `name=__name__` for logs throughout `.service` Change all `.service` sub-modules to use `get_logger(name=__name__)` for per-submod instances vs a shared `._util.log`. Deats, - import `get_logger()` and `get_console_log()` from top-level `piker.log` instead of `._util` for all. - drop `log` and `get_console_log()` partial from `._util`. - add `name=subsys` kwarg to `get_console_log()` call in `_actor_runtime.maybe_open_pikerd()`. - add `name='piker.service'` to `get_console_log()` in `_ahab.open_ahabd()`. - change default `loglevel` from `None` to `'cancel'` in `_ahab.open_ahabd()`. - add sanity check: `assert log.name == 'piker.service'` in `_daemon.maybe_spawn_daemon()`. - change `print()` -> `log.info()` in `_registry.find_service()`. - drop stray `from piker.service._util import log` import in `brokers._daemon.spawn_brokerd()`. Styling/cleanups, - drop blank lines from various fn sigs. - do more sin-ws union type annots. - add more multiline style to `or` expressions in `_actor_runtime` and `_registry`. - update `._util` docstring with TODO about `import`-time console log setup. - add TODO comments in `_registry` about UDS registry support. - use `.aid.uid` from actor in `_registry.open_registry()`. - add intermediate var `reg_addrs` in `_registry.open_registry()` (bc i was tracing rtvs value issues in `tractor`). - add `pformat` import to `.elastic` (code path is currently not used but figured might as well appease the linter..) (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-13 19:34:45 +00:00
log.info(
f'Could NOT find service {service_name!r} -> {maybe_portals!r}'
)
yield None
return
Use `name=__name__` for logs throughout `.service` Change all `.service` sub-modules to use `get_logger(name=__name__)` for per-submod instances vs a shared `._util.log`. Deats, - import `get_logger()` and `get_console_log()` from top-level `piker.log` instead of `._util` for all. - drop `log` and `get_console_log()` partial from `._util`. - add `name=subsys` kwarg to `get_console_log()` call in `_actor_runtime.maybe_open_pikerd()`. - add `name='piker.service'` to `get_console_log()` in `_ahab.open_ahabd()`. - change default `loglevel` from `None` to `'cancel'` in `_ahab.open_ahabd()`. - add sanity check: `assert log.name == 'piker.service'` in `_daemon.maybe_spawn_daemon()`. - change `print()` -> `log.info()` in `_registry.find_service()`. - drop stray `from piker.service._util import log` import in `brokers._daemon.spawn_brokerd()`. Styling/cleanups, - drop blank lines from various fn sigs. - do more sin-ws union type annots. - add more multiline style to `or` expressions in `_actor_runtime` and `_registry`. - update `._util` docstring with TODO about `import`-time console log setup. - add TODO comments in `_registry` about UDS registry support. - use `.aid.uid` from actor in `_registry.open_registry()`. - add intermediate var `reg_addrs` in `_registry.open_registry()` (bc i was tracing rtvs value issues in `tractor`). - add `pformat` import to `.elastic` (code path is currently not used but figured might as well appease the linter..) (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-13 19:34:45 +00:00
log.info(
f'Found service {service_name!r} -> {maybe_portals}'
)
yield maybe_portals
# except BaseException as _berr:
# berr = _berr
# log.exception(
# 'tractor.find_actor() failed with,\n'
# )
# raise berr
async def check_for_service(
service_name: str,
) -> None|RegistryAddress:
'''
Service daemon "liveness" predicate.
'''
async with (
Port service+tests to latest `tractor` APIs Continue the `repair_tests`-branch mission (already merged in this stack's ancestry, see f4c4f1e2 which ported `conftest.py`) by fixing the remaining drift breakage vs. `tractor` git `main`; without these NOTHING boots since the `tractor.Address` port in 604e5fcf. Deats, - normalize reg addrs via `wrap_address()` in `open_pikerd()` before `.unwrap()`-ing; entries may be raw `tuple`s when passed in from (test) client code. - port `check_for_service()` to `query_actor(regaddr=)` (was `arbiter_sockaddr=`) incl. its 2-tuple yield and the now-required `open_registry(addrs=)` arg. - `wait_for_actor(registry_addr=)` + `.chan.raddr.unwrap()` raw-tuple compares in `test_runtime_boot` and `ensure_service()`. - update `run_test_w_cancel_method()` for modern `tractor` cancel semantics: self-requested sub-service cancels are absorbed (no `ContextCancelled` raised to the opener) and single-exc groups collapse to a bare KBI. - `RemoteActorError.boxed_type` (was `.type`) and `Position.cumsize` (was `.size`) renames in tests. - bump the paper-EMS startup budget 9 -> 19s; it includes a live (kraken) symbology fetch so needs net headroom. - woops, add the missing comma in `.deribit.api`'s `tractor.trionics` import tuple.. (this patch was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Prompt-IO: ai/prompt-io/claude/20260610T171022Z_4485f2b9_prompt_io.md
2026-06-10 17:11:05 +00:00
open_registry(
addrs=Registry.addrs,
ensure_exists=False,
) as reg_addrs,
tractor.query_actor(
service_name,
Port service+tests to latest `tractor` APIs Continue the `repair_tests`-branch mission (already merged in this stack's ancestry, see f4c4f1e2 which ported `conftest.py`) by fixing the remaining drift breakage vs. `tractor` git `main`; without these NOTHING boots since the `tractor.Address` port in 604e5fcf. Deats, - normalize reg addrs via `wrap_address()` in `open_pikerd()` before `.unwrap()`-ing; entries may be raw `tuple`s when passed in from (test) client code. - port `check_for_service()` to `query_actor(regaddr=)` (was `arbiter_sockaddr=`) incl. its 2-tuple yield and the now-required `open_registry(addrs=)` arg. - `wait_for_actor(registry_addr=)` + `.chan.raddr.unwrap()` raw-tuple compares in `test_runtime_boot` and `ensure_service()`. - update `run_test_w_cancel_method()` for modern `tractor` cancel semantics: self-requested sub-service cancels are absorbed (no `ContextCancelled` raised to the opener) and single-exc groups collapse to a bare KBI. - `RemoteActorError.boxed_type` (was `.type`) and `Position.cumsize` (was `.size`) renames in tests. - bump the paper-EMS startup budget 9 -> 19s; it includes a live (kraken) symbology fetch so needs net headroom. - woops, add the missing comma in `.deribit.api`'s `tractor.trionics` import tuple.. (this patch was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Prompt-IO: ai/prompt-io/claude/20260610T171022Z_4485f2b9_prompt_io.md
2026-06-10 17:11:05 +00:00
regaddr=reg_addrs[0],
) as (sockaddr, _),
):
return sockaddr