| 1234567891011121314151617181920212223 |
- """Formal pipeline run API routes."""
- from __future__ import annotations
- from typing import Any
- from uuid import UUID
- from fastapi import APIRouter, Depends, HTTPException
- from app.dependencies import get_pipeline_repository
- router = APIRouter(prefix="/api/pipeline", tags=["pipeline"])
- @router.get("/runs/{run_id}")
- def pipeline_run(
- run_id: UUID,
- repo: Any = Depends(get_pipeline_repository),
- ) -> dict[str, Any]:
- getter = getattr(repo, "get_pipeline_run", None)
- if getter is None:
- raise HTTPException(status_code=501, detail="pipeline run reader is not implemented")
- run = getter(run_id)
- return {"run": run.model_dump(mode="json") if hasattr(run, "model_dump") else run}
|