Skip to content

Commit c9544fc

Browse files
committed
resolve merging conflicts
1 parent 05ee3c3 commit c9544fc

File tree

3 files changed

+25
-14
lines changed

3 files changed

+25
-14
lines changed

app/api/routers/evaluation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import uuid
44
import tempfile
55

6-
from typing import List
6+
from typing import List, Union
77
from typing_extensions import Annotated
88
from fastapi import APIRouter, Query, Depends, UploadFile, Request, File
99
from fastapi.responses import StreamingResponse, JSONResponse

app/api/routers/training_operations.py

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
import tempfile
55
import uuid
6-
from typing import List
6+
from typing import List, Union
77
from typing_extensions import Annotated
88
from fastapi import APIRouter, Depends, Request, Query, UploadFile, File
99
from fastapi.responses import JSONResponse
@@ -19,6 +19,7 @@
1919
from utils import filter_by_concept_ids
2020

2121
import api.globals as cms_globals
22+
from api.dependencies import validate_tracking_id
2223
from model_services.base import AbstractModelService
2324

2425
router = APIRouter()
@@ -41,12 +42,13 @@ def train_eval_info(request: Request,
4142

4243

4344
@router.post("/evaluate",
44-
tags=[Tags.Training.name],
45+
tags=[Tags.Evaluating.name],
4546
response_class=JSONResponse,
4647
dependencies=[Depends(cms_globals.props.current_active_user)],
4748
description="Evaluate the model being served with a trainer export")
4849
async def get_evaluation_with_trainer_export(request: Request,
4950
trainer_export: Annotated[List[UploadFile], File(description="One or more trainer export files to be uploaded")],
51+
tracking_id: Union[str, None] = Depends(validate_tracking_id),
5052
model_service: AbstractModelService = Depends(cms_globals.model_service_dep)) -> JSONResponse:
5153
files = []
5254
file_names = []
@@ -67,18 +69,27 @@ async def get_evaluation_with_trainer_export(request: Request,
6769
json.dump(concatenated, data_file)
6870
data_file.flush()
6971
data_file.seek(0)
70-
evaluation_id = str(uuid.uuid4())
71-
evaluation_accepted = model_service.train_supervised(data_file,
72-
0,
73-
sys.maxsize,
74-
evaluation_id,
75-
",".join(file_names))
72+
evaluation_id = tracking_id or str(uuid.uuid4())
73+
evaluation_accepted, experiment_id, run_id = model_service.train_supervised(
74+
data_file, 0, sys.maxsize, evaluation_id, ",".join(file_names)
75+
)
7676
if evaluation_accepted:
77-
return JSONResponse(content={"message": "Your evaluation started successfully.", "evaluation_id": evaluation_id},
78-
status_code=HTTP_202_ACCEPTED)
77+
return JSONResponse(
78+
content={
79+
"message": "Your evaluation started successfully.",
80+
"evaluation_id": evaluation_id,
81+
"experiment_id": experiment_id,
82+
"run_id": run_id,
83+
}, status_code=HTTP_202_ACCEPTED
84+
)
7985
else:
80-
return JSONResponse(content={"message": "Another training or evaluation on this model is still active. Please retry later."},
81-
status_code=HTTP_503_SERVICE_UNAVAILABLE)
86+
return JSONResponse(
87+
content={
88+
"message": "Another training or evaluation on this model is still active. Please retry later.",
89+
"experiment_id": experiment_id,
90+
"run_id": run_id,
91+
}, status_code=HTTP_503_SERVICE_UNAVAILABLE
92+
)
8293

8394

8495
@router.post("/cancel_training",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ dev = [
6363
"httpx~=0.24.1",
6464
"mypy==1.8.0",
6565
"ruff==0.6.9",
66-
"locust~=2.31.8",
66+
"locust<2.32.0",
6767
"typer-cli~=0.15.1",
6868
"types-toml==0.10.8.20240310",
6969
]

0 commit comments

Comments
 (0)