Load full artifact scan in dashboard
This commit is contained in:
@@ -54,7 +54,10 @@ def evaluate_project() -> dict:
|
||||
and "resultFamilyFilter" in frontend_text
|
||||
and "resultRoleFilter" in frontend_text
|
||||
and "familyOptions" in frontend_text
|
||||
and "roleOptions" in frontend_text,
|
||||
and "roleOptions" in frontend_text
|
||||
and "/api/results?limit=1000" in frontend_text
|
||||
and "setResults(resultsNext)" in frontend_text
|
||||
and "slice(0, 240)" not in frontend_text,
|
||||
"job_progress_ui": "JobProgressBar" in frontend_text and "progressTrack" in frontend_text,
|
||||
"runtime_readiness_ui": "runtimeReadiness" in frontend_text and "环境就绪" in frontend_text,
|
||||
"capability_matrix_ui": "capabilities" in frontend_text and "全功能矩阵" in frontend_text,
|
||||
|
||||
@@ -4,7 +4,7 @@ import asyncio
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from fastapi import FastAPI, File, HTTPException, UploadFile
|
||||
from fastapi import FastAPI, File, HTTPException, Query, UploadFile
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.responses import FileResponse, StreamingResponse
|
||||
|
||||
@@ -211,12 +211,12 @@ async def api_job_events(job_id: str):
|
||||
|
||||
|
||||
@app.get("/api/results")
|
||||
def api_results() -> list[dict]:
|
||||
return scan_results()
|
||||
def api_results(limit: int = Query(1000, ge=1, le=5000)) -> list[dict]:
|
||||
return scan_results(limit=limit)
|
||||
|
||||
|
||||
@app.get("/api/results/curves")
|
||||
def api_result_curves(limit: int = 100) -> list[dict]:
|
||||
def api_result_curves(limit: int = Query(100, ge=1, le=500)) -> list[dict]:
|
||||
return scan_training_curves(limit=limit)
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
from pathlib import Path
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app import main
|
||||
from app.main import app
|
||||
from app.modules.results.service import parse_training_curve
|
||||
|
||||
|
||||
@@ -25,3 +29,31 @@ def test_parse_yolo_results_curve(tmp_path: Path):
|
||||
assert "train/seg_loss" in names
|
||||
assert "metrics/mAP50(M)" in names
|
||||
assert all("lr/" not in name for name in names)
|
||||
|
||||
|
||||
def test_results_api_honors_limit(monkeypatch):
|
||||
calls = {}
|
||||
|
||||
def fake_scan_results(limit: int = 1000):
|
||||
calls["limit"] = limit
|
||||
return [{"name": "a.png", "relative_path": "var/a.png"}]
|
||||
|
||||
monkeypatch.setattr(main, "scan_results", fake_scan_results)
|
||||
response = TestClient(app).get("/api/results?limit=123")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert calls["limit"] == 123
|
||||
|
||||
|
||||
def test_results_curve_api_honors_limit(monkeypatch):
|
||||
calls = {}
|
||||
|
||||
def fake_scan_training_curves(limit: int = 100):
|
||||
calls["limit"] = limit
|
||||
return [{"name": "results", "relative_path": "var/results.csv"}]
|
||||
|
||||
monkeypatch.setattr(main, "scan_training_curves", fake_scan_training_curves)
|
||||
response = TestClient(app).get("/api/results/curves?limit=77")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert calls["limit"] == 77
|
||||
|
||||
Reference in New Issue
Block a user