Conectar API: sources, uploads, pipelines, runs, node rows, review; tested end to end

This commit is contained in:
Roberto Treviño
2026-11-24 21:00:52 -06:00
parent cddf91185b
commit 326250ffb3
5 changed files with 314 additions and 22 deletions
+23
View File
@@ -0,0 +1,23 @@
"""Runs live in Dagster: the API starts them and reads their state, never computes."""
import os
from dagster_graphql import DagsterGraphQLClient, DagsterGraphQLClientError
from fastapi import APIRouter, Depends, HTTPException
router = APIRouter(prefix="/runs", tags=["runs"])
def dagster() -> DagsterGraphQLClient:
return DagsterGraphQLClient(
os.environ.get("DAGSTER_HOST", "localhost"),
port_number=int(os.environ.get("DAGSTER_PORT", "3000")),
)
@router.get("/{run_id}")
def run_status(run_id: str, client: DagsterGraphQLClient = Depends(dagster)) -> dict[str, str]:
try:
return {"id": run_id, "status": client.get_run_status(run_id).value}
except DagsterGraphQLClientError as e:
raise HTTPException(404 if "RunNotFound" in str(e) else 502, detail=str(e)) from e