4793cf01f0
test_runs.py: 17 passed on SQLite and Postgres (compose test stack). test_conectar.py fails on an identity-merge count, as it does on tea/parity without this change.
24 lines
717 B
Python
24 lines
717 B
Python
"""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
|