piker/ai/prompt-io/claude/20260610T171142Z_119d2c04_p...

61 lines
2.3 KiB
Markdown
Raw Normal View History

Add `datad` daemon machinery to `.data` First half of the `brokerd` split: a new per-provider data-feed-only daemon-actor `datad.<broker>` to (soon) host all `validate._eps['datad']` eps (live quotes, history loading, symbology search) leaving `brokerd` for live order ctl only. Purely additive; nothing routes through it yet. Deats, - new `piker.data._daemon` mod mirroring the `.brokers._daemon` conventions (and the `samplerd` sub-daemon precedent): - `_setup_persistent_datad()` lifetime fixture owning the actor-global `_FeedsBus` alloc. - `datad_init()` building `enable_modules` from the backend's `_datad_mods` (falling back to `__enable_modules__` for not-yet-split backends) and copying `_spawn_kwargs` (critical for `ib`'s `infect_asyncio`). - `spawn_datad()`/`maybe_spawn_datad()` wrapping `Services` + `maybe_spawn_daemon()`. - add `piker.data._daemon` to `_root_modules` so `pikerd` can run `spawn_datad()` requests. - re-export the spawn eps from `piker.service`. - add `test_datad_spawn` verifying actor boot + service registration via `ensure_service('datad.kraken')`. Note the `Services`-based impl style deliberately mirrors `spawn_brokerd()` so the eventual `tractor.hilevel` `ServiceMngr` port (see the `service_mng_to_tractor` branch's d8c21d44 prep work) lands symmetrically on both. (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/20260610T171142Z_119d2c04_prompt_io.md
2026-06-10 17:12:26 +00:00
---
model: claude-fable-5[1m]
service: claude
timestamp: 2026-06-10T17:11:42Z
git_ref: datad_service
diff_cmd: git log -1 -p --follow -- ai/prompt-io/claude/20260610T171142Z_119d2c04_prompt_io.md
---
NOTE: diff-ref mode entry (code committed in the same
commit as this log); backfilled from the live dev
session transcript per the `/prompt-io` skill rules.
> `git log -1 -p --follow -- piker/data/_daemon.py`
Generated symbols + key design decisions:
- `_datad_service_mods: list[str]` — datad-always
enabled mods, the data-side successor to the old
`piker.brokers._daemon._data_mods` set; kept minimal
per the caps-sec model.
- `_setup_persistent_datad()``@tractor.context`
lifetime fixture: console-log setup then allocates
the actor-global feed bus via
`feed.get_feed_bus(brokername, service_nursery)`
exactly as the old brokerd fixture did, pinned open
with `ctx.started()` + `sleep_forever()`.
- `datad_init()` — actor name `f'datad.{brokername}'`;
copies backend `_spawn_kwargs` (CRITICAL for `ib`'s
`infect_asyncio=True`); builds `enable_modules` from
`getattr(brokermod, '_datad_mods',
getattr(brokermod, '__enable_modules__', []))` as
the flat-backend fallback.
- `spawn_datad()``Services.actor_n.start_actor()` +
`Services.start_service_task()` exactly mirroring
`spawn_brokerd()`; dedup-composes enable mods via
`list(dict.fromkeys(...))`.
- `maybe_spawn_datad()` — wraps `maybe_spawn_daemon(
service_name=f'datad.{brokername}', ...)`.
> `git log -1 -p --follow -- piker/service/_actor_runtime.py`
> `git log -1 -p --follow -- piker/service/__init__.py`
> `git log -1 -p --follow -- tests/test_services.py`
Design rationale (verbatim from session):
- `_root_modules` must gain `piker.data._daemon` so
`pikerd_portal.run(spawn_datad, ...)` resolves in
the root.
- the `Services`-based impl style deliberately mirrors
`spawn_brokerd()` so the eventual `tractor.hilevel`
`ServiceMngr` port (see the `service_mng_to_tractor`
branch's d8c21d44 prep, surfaced by the
user-requested branch-overlap survey) lands
symmetrically on both spawn fns.
- mod placement (`piker/data/_daemon.py` vs.
generalizing `piker.brokers._daemon`) follows the
per-subsystem daemon-mod convention
(`.clearing._ems`, `.data._sampling`) and resolves
the existing TODO at `brokers/_daemon.py:49` ("move
this def to the `.data` subpkg").