Backend ABC, the BackendRuntime ABC one launch subcommand implements, and
the CallbackSchema.
BUS_APPLY_TIMEOUT_DEFAULT
tai42_contract.backend.runtime.BUS_APPLY_TIMEOUT_DEFAULT
BUS_APPLY_TIMEOUT_ENV
tai42_contract.backend.runtime.BUS_APPLY_TIMEOUT_ENV
CONSUMING_RUNTIME
tai42_contract.backend.runtime.CONSUMING_RUNTIME
POOL_TURNOVER_FLEET_OPS
tai42_contract.backend.runtime.POOL_TURNOVER_FLEET_OPS
REGISTRY_MUTATING_FLEET_OPS
tai42_contract.backend.runtime.REGISTRY_MUTATING_FLEET_OPS
list_failed_mcps is a query and recycle ends the process, so neither is
here. These are one input to POOL_TURNOVER_FLEET_OPS, the set the turnover
gate actually reads.
TEMPLATE_EVICTION_FLEET_OPS
tai42_contract.backend.runtime.TEMPLATE_EVICTION_FLEET_OPS
POOL_TURNOVER_FLEET_OPS.
Backend
tai42_contract.backend.base.Backend
launch) and executes the work its
workers pull from the broker. The app core depends only on this interface
and stays backend-agnostic; concrete backends (celery/rq/arq) implement it
and register via @tai42_app.backends.register_backend.
Fleet propagation of config changes is not a backend concern: it is the
app’s own worker bus, internal to the app. A backend-runtime process
receives fleet ops through the app’s bus subscription exactly like a serving
HTTP worker — the backend carries no control-plane surface of its own.
Members
launch
tai42_contract.backend.base.Backend.launch
@tai42_app.backends.register_backend.
Parameters
BackendRuntime
tai42_contract.backend.runtime.BackendRuntime
Members
name
tai42_contract.backend.runtime.BackendRuntime.name
mode
tai42_contract.backend.runtime.BackendRuntime.mode
consumes_work
tai42_contract.backend.runtime.BackendRuntime.consumes_work
pool_turnover_required
tai42_contract.backend.runtime.BackendRuntime.pool_turnover_required
ClassVar: a
launch option can decide whether this engine’s pool persists, so an instance
may set it. The host therefore reads it off the live runtime.
from_args
tai42_contract.backend.runtime.BackendRuntime.from_args
build
tai42_contract.backend.runtime.BackendRuntime.build
from_args alone must not be forced to declare an empty override.
run_on_loop
tai42_contract.backend.runtime.BackendRuntime.run_on_loop
mode is on_loop.
run_blocking
tai42_contract.backend.runtime.BackendRuntime.run_blocking
mode is worker_thread or inline.
request_drain
tai42_contract.backend.runtime.BackendRuntime.request_drain
worker_thread body runs on
another thread — so it MUST NOT block and MUST NOT touch
main-thread-only APIs (signal.signal above all: the host owns the
process’s signal disposition and a vendor rebind destroys it).
MUST BE IDEMPOTENT: the host calls it on signal AND again on the
cancellation path. Escalation belongs to request_terminate,
never to a second request_drain.
REQUIRED iff consumes_work.
request_terminate
tai42_contract.backend.runtime.BackendRuntime.request_terminate
turn_over_pool
tai42_contract.backend.runtime.BackendRuntime.turn_over_pool
reason, and CONFIRM it.
On return, no pre-mutation worker may still serve work. Raise loudly if it
cannot be confirmed within budget seconds — the
caller is inside a fleet-op apply, and a raise makes that op report
failed rather than a false applied.
Called from the fleet-op hook, which the host wires BEFORE build
so an op landing during a long boot is not missed. So this may run before
the engine objects exist, and it runs CONCURRENTLY with the run body once
they do. A no-op is the correct answer whenever there is no pool yet, or
the live pool turns out not to hold a snapshot: the workers that do not
exist cannot be stale, and the next ones are built after the mutation.
REQUIRED iff pool_turnover_required.
Parameters
aclose
tai42_contract.backend.runtime.BackendRuntime.aclose
CallbackSchema
tai42_contract.backend.callback.CallbackSchema
condition and a follow-up tool kwargs expr.
Attributes
ExecutionMode
tai42_contract.backend.runtime.ExecutionMode
Members
on_loop
tai42_contract.backend.runtime.ExecutionMode.on_loop
worker_thread
tai42_contract.backend.runtime.ExecutionMode.worker_thread
inline
tai42_contract.backend.runtime.ExecutionMode.inline

