primus.optimization.optimizer_dispatch_backend module

GraphQL implementation of the durable optimizer-dispatch backend protocol.

The optimizer dispatch coordinator is deliberately independent of the dashboard client. This adapter is its single production boundary: it creates durable Procedure/Task rows, stores procedure code through the existing authorized procedure-artifact route, and never starts work locally.

class primus.optimization.optimizer_dispatch_backend.GraphQLOptimizerDispatchBackend(client: Any, *, artifact_store: Any | None = None, page_size: int = 100)

Bases: object

Production GraphQL adapter for OptimizerTaskDispatchService.

IDs are intentionally omitted from all create inputs. The account scans are exhaustive and stop with an exception on an invalid response or a pagination cycle, allowing the coordinator to remain fail closed.

__init__(client: Any, *, artifact_store: Any | None = None, page_size: int = 100) → None
create_procedure(record: Mapping[str, Any]) → dict[str, Any]
create_task(record: Mapping[str, Any]) → dict[str, Any]
get_procedure(procedure_id: str) → dict[str, Any] | None
get_task(task_id: str) → dict[str, Any] | None
procedure_pages_for_account(account_id: str) → Iterator[dict[str, Any]]
read_procedure_artifact(key: str) → bytes
reconcile_task_stages(task_id: str, stages: Sequence[Mapping[str, Any]]) → list[dict[str, Any]]
release_held_task(task_id: str) → dict[str, Any]
task_pages_for_account(account_id: str) → Iterator[dict[str, Any]]
task_stage_pages_for_task(task_id: str) → Iterator[dict[str, Any]]
upload_and_verify_procedure_yaml(procedure: Mapping[str, Any], optimizer_yaml: str, metadata: Mapping[str, Any]) → dict[str, Any]
exception primus.optimization.optimizer_dispatch_backend.OptimizerDispatchBackendError

Bases: RuntimeError

A durable dispatch operation could not be proved safe.