F1h: Gobernanza without Vista previa and Subir archivos, button spacing
Remove both training-input endpoints and their endpoint-only test. Keep bundle import and clinical-validation uploads, which use their own API paths. External-folder training continues through cluster and TEA_REFERENCE_ROOT.
This commit is contained in:
+4
-40
@@ -4,18 +4,16 @@ scoring runs (Dagster). The API starts runs and reads the registry; it never tra
|
||||
import mimetypes
|
||||
import zipfile
|
||||
from datetime import date
|
||||
from pathlib import Path
|
||||
from typing import Annotated, Any, Literal
|
||||
|
||||
from dagster_graphql import DagsterGraphQLClient
|
||||
from fastapi import APIRouter, Depends, File, HTTPException, Query, UploadFile
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query, UploadFile
|
||||
from fastapi.responses import Response
|
||||
from pydantic import BaseModel, Field, WithJsonSchema
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from core import tea
|
||||
from core.domains import Domain, InputSpec
|
||||
from core.domains import Domain
|
||||
from core.models import title
|
||||
from persistance import bundle, cluster, inputs, registry
|
||||
from persistance import bundle, cluster, registry
|
||||
from persistance.cluster import Execution, TrainingSource
|
||||
from webapi.runs import dagster, execution_config, submit
|
||||
|
||||
@@ -183,40 +181,6 @@ def lineage(domain: Domain, name: str, version: int) -> dict:
|
||||
raise HTTPException(404, detail=str(e)) from e
|
||||
|
||||
|
||||
def _training_inputs(domain: Domain, name: str) -> tuple[InputSpec, Path]:
|
||||
declared = tea.TRAINING_INPUTS if domain == Domain.TEA else {}
|
||||
spec = declared.get(name, declared.get("*"))
|
||||
if spec is None:
|
||||
raise HTTPException(404, detail=f"no training inputs for {domain.value}.{name}")
|
||||
try:
|
||||
return spec, inputs.root(spec)
|
||||
except LookupError as e:
|
||||
raise HTTPException(503, detail=str(e)) from e
|
||||
|
||||
|
||||
@router.get("/{domain}/{name}/inputs")
|
||||
def training_inputs(domain: Domain, name: str) -> dict[str, list[str]]:
|
||||
spec, _ = _training_inputs(domain, name)
|
||||
return {"allowed": spec.allowed}
|
||||
|
||||
|
||||
@router.post("/{domain}/{name}/inputs/{set}/files")
|
||||
def upload_training_inputs(
|
||||
domain: Domain,
|
||||
name: str,
|
||||
set: str,
|
||||
files: Annotated[
|
||||
list[Annotated[UploadFile, WithJsonSchema({"type": "string", "format": "binary"})]],
|
||||
File(min_length=1),
|
||||
],
|
||||
) -> dict:
|
||||
spec, root = _training_inputs(domain, name)
|
||||
try:
|
||||
return inputs.upload(root, set, spec.allowed, [(f.filename or "", f.file) for f in files])
|
||||
except ValueError as e:
|
||||
raise HTTPException(422, detail=str(e)) from e
|
||||
|
||||
|
||||
@router.get("/{domain}/{name}/versions/{version}/curve")
|
||||
def curve(domain: Domain, name: str, version: int, feature: str = "value") -> list[dict]:
|
||||
if domain != Domain.TEA:
|
||||
|
||||
Reference in New Issue
Block a user