"""The execution choices a deployment offers and the health of a chosen cluster.""" from fastapi import APIRouter, HTTPException from persistance import cluster from persistance.cluster import Execution, Health, Mode, Options router = APIRouter(prefix="/execution", tags=["execution"]) @router.get("/options") def execution_options() -> Options: return cluster.options() @router.get("/health") def execution_health( mode: Mode | None = None, scheduler: str | None = None, reference: str | None = None ) -> Health: try: return cluster.health(Execution(mode=mode, scheduler=scheduler), reference) except cluster.ExecutionError as e: raise HTTPException(422, detail=str(e)) from e