Activator

activator.ActivatorSettings

The [serve.activator] section: the child command and the proxy’s bind + policy knobs.

Usage

Source

activator.ActivatorSettings()

Env overrides derive from the section as ATHOME_SERVE_ACTIVATOR_<FIELD> (init kwargs > env > ~/.athome/config.toml > defaults). command is the child’s argv template; the literal token {LISTEN_FD} is substituted with the inherited listener fd number so the child binds the socket the activator already holds.

Example

>>> settings = load(ActivatorSettings)  # doctest: +SKIP
>>> Activator(settings).app  # doctest: +SKIP

activator.Activator

The single-policy idle-unload proxy: one ~athome.idle.IdleResource, an allowlist app.

Usage

Source

activator.Activator(settings)

All proxy-specific behavior — the cooldown gate, the pre-bound listener fd handoff, the probe/wake routes, the streaming relay whose inflight count spans the whole response body — lives in this class’s own callables and routes, never a second lifecycle. The resource wraps _spawn()/_stop(), so concurrent first wakes collapse to one spawn and the reaper never unloads a child a stream still holds.

Example

>>> activator = Activator(load(ActivatorSettings))  # doctest: +SKIP
>>> uvicorn.run(activator.app, host="127.0.0.1", port=8000)  # doctest: +SKIP

activator.serve_activator()

Run the activator proxy under uvicorn, binding host (or the configured host) and its port.

Usage

Source

activator.serve_activator(*, host=None)

Parameters

host: str | None = None
Bind address overriding ActivatorSettings.host; None uses the configured host.

activator.ActivatorError

Root of every activator error surfaced through the proxy.

Usage

Source

activator.ActivatorError()