22 lines
663 B
Python
22 lines
663 B
Python
|
|
from typing import List, Optional
|
||
|
|
from fastapi import APIRouter, Query
|
||
|
|
from schemas import ExperimentSummary, RunSummary
|
||
|
|
from services import mlflow_service
|
||
|
|
|
||
|
|
router = APIRouter()
|
||
|
|
|
||
|
|
|
||
|
|
@router.get("/experiments", response_model=List[ExperimentSummary])
|
||
|
|
def list_experiments(
|
||
|
|
tracking_uri: Optional[str] = Query(None, description="MLflow Tracking URI"),
|
||
|
|
):
|
||
|
|
return mlflow_service.get_experiments(tracking_uri)
|
||
|
|
|
||
|
|
|
||
|
|
@router.get("/experiments/{exp_id}/runs", response_model=List[RunSummary])
|
||
|
|
def list_runs(
|
||
|
|
exp_id: str,
|
||
|
|
tracking_uri: Optional[str] = Query(None, description="MLflow Tracking URI"),
|
||
|
|
):
|
||
|
|
return mlflow_service.get_runs(tracking_uri, exp_id)
|