data_updater_v2.data_clients.runner
runner.py — the walk engine: one declared endpoint, one ask, one RawResponse.
Taken from nc-feeds utilities/runner.py whole. The only changes: the package’s Time
contract is replaced by the plain values of times.py (the five private time helpers at the
bottom delegate there), a window’s span may be in seconds (Window.span_for), and the
imports point at this folder.
A section says raw = await self.walk("eod_full", symbol=..., from_=..., to=...)
and gets back the payload fetch with every nuance. This file is how. It knows
the Walk declaration beside an endpoint, the run controls, and nothing
about vendors, normalizers or objects: those are the section’s. Retries,
timeouts, concurrency and rates are common-http’s; nothing here wraps them.
Sections: 1 · INIT carries Batching, Stopping and a logger; borrows the rest per walk 2 · THE DOOR walk() -> RawResponse, never raises for a vendor’s behaviour 3 · WALKS one hit · a chain of pages · fan-out · windows · the cascade 4 · ONE CALL the physical call, the ceiling, the permit at the declared cost 5 · READING lift rows at the declared path; read the facts; the fault sentences 6 · PROOFS the next page or the proven end, from Stopping and the page just read 7 · ASSEMBLY dedupe, finish 8 · HELPERS time units, paths, markers 9 · DISPLAY
The laws it keeps: a call may clip, it may never lie; an explicit vendor word beats every inferred count; a stall is a fault, never a silent loop; a failed page ends the walk with the pages already gathered kept; the ceiling returns what it has and says so.
Classes
Runner
The walk engine.
Carried state: Batching (checkpoint widths), Stopping (which proofs
count, the ceiling), the charge hook that acquires the rate permit at
the declared cost before every call, and a logger. Borrowed per walk and
never kept: the common-http client, the Endpoint, the Walk
declaration.
read
read(client: HttpClient, endpoint: Endpoint, walk: Walk, call: HttpResult, key: str | int | None = None) -> RawResponseOne call made elsewhere (a common-http batch member), read exactly as a one-hit walk reads it: rows at the declared path, absence statuses, the cap, the fault.
walk
walk(client: HttpClient, endpoint: Endpoint, walk: Walk | None = None, key: str | int | None = None, values: Mapping[str, Any] | None = None, stop: Callable[[tuple[Any, ...]], bool] | None = None) -> RawResponseWalk one declared endpoint for one ask and report the payload fetch.
values are the endpoint’s parameter values for the ask. stop is
a caller’s hook, called with each page’s rows; True ends the walk early
and the response says complete=False. Nothing a vendor does raises;
only our own code raising escapes, for the section to catch.