A run can be stopped
This commit is contained in:
@@ -21,3 +21,13 @@ def run_status(run_id: str, client: DagsterGraphQLClient = Depends(dagster)) ->
|
||||
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
|
||||
|
||||
|
||||
@router.post("/{run_id}/terminate")
|
||||
def terminate_run(run_id: str, client: DagsterGraphQLClient = Depends(dagster)) -> dict[str, str]:
|
||||
"""Stop a run (one started by mistake): Dagster cancels it."""
|
||||
try:
|
||||
client.terminate_run(run_id)
|
||||
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 409, detail=str(e)) from e
|
||||
|
||||
Reference in New Issue
Block a user