fix video label
This commit is contained in:
@@ -5,7 +5,12 @@ from pathlib import Path
|
||||
|
||||
from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException, Request, Response
|
||||
|
||||
from app.db import save_health_snapshot, save_measure_snapshot
|
||||
from app.db import (
|
||||
health_snapshot_deliverable,
|
||||
measure_snapshot_deliverable,
|
||||
save_health_snapshot,
|
||||
save_measure_snapshot,
|
||||
)
|
||||
from app.deps import require_ingest_auth
|
||||
from app.services import action as action_svc
|
||||
from app.services import measure as measure_svc
|
||||
@@ -16,7 +21,7 @@ from app.services.sessions import (
|
||||
write_chunk,
|
||||
)
|
||||
from app.settings import Settings, get_settings
|
||||
from app.state import HealthSnapshot, MeasureSnapshot, app_state
|
||||
from app.state import app_state
|
||||
|
||||
router = APIRouter(prefix="/api/v1/ingest", tags=["ingest"])
|
||||
|
||||
@@ -28,19 +33,12 @@ async def _measure_job_serial(svo_path: Path, settings: Settings) -> None:
|
||||
snap = await asyncio.to_thread(
|
||||
measure_svc.run_full_measure, svo_path, settings
|
||||
)
|
||||
save_measure_snapshot(settings, snap, source_path=str(svo_path.resolve()))
|
||||
if measure_snapshot_deliverable(snap):
|
||||
save_measure_snapshot(
|
||||
settings, snap, source_path=str(svo_path.resolve())
|
||||
)
|
||||
app_state.measure_status = "idle"
|
||||
except Exception as e:
|
||||
save_measure_snapshot(
|
||||
settings,
|
||||
MeasureSnapshot(
|
||||
result=[],
|
||||
video_left="",
|
||||
video_right="",
|
||||
error=str(e),
|
||||
),
|
||||
source_path=str(svo_path.resolve()),
|
||||
)
|
||||
except Exception:
|
||||
app_state.measure_status = "error"
|
||||
|
||||
|
||||
@@ -51,18 +49,12 @@ async def _action_job_serial(mp4_path: Path, settings: Settings) -> None:
|
||||
snap = await asyncio.to_thread(
|
||||
action_svc.run_full_action, mp4_path, settings
|
||||
)
|
||||
save_health_snapshot(settings, snap, source_path=str(mp4_path.resolve()))
|
||||
if health_snapshot_deliverable(snap):
|
||||
save_health_snapshot(
|
||||
settings, snap, source_path=str(mp4_path.resolve())
|
||||
)
|
||||
app_state.action_status = "idle"
|
||||
except Exception as e:
|
||||
save_health_snapshot(
|
||||
settings,
|
||||
HealthSnapshot(
|
||||
behavior_result="",
|
||||
health_result="",
|
||||
error=str(e),
|
||||
),
|
||||
source_path=str(mp4_path.resolve()),
|
||||
)
|
||||
except Exception:
|
||||
app_state.action_status = "error"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user