dashboard + dispatcher — UX props, trim head+tail, cols, link direct

dashboard:
- job_id, AUV GP1/GP2 (serial en tooltip), segment_label, duree reelle,
  nb frames, nb hors-eau trimes
- lien viser plain <a href> (plus de POST ni popup). Affiche uniquement
  si job.done ET viser_url persistee (demo.py kept alive)
- CSS minimal: flex row, separateurs, skipped en italic mute

dispatcher:
- trim head ET tail (AUV hors-eau en debut + fin de session)
- migration DB: trimmed_head, trimmed_tail, video_duration_s
- do_extract persiste total_duration_s + trimmed counts via set_status
- run_one: RuntimeError(skipped_short) preserve le status=skipped
- min_frames underwater pour skip les segments trop courts
- ram_budget 0.45 -> 0.35 (OOM rc=137 avec 8237 frames sur 62GB RAM)
This commit is contained in:
Flag
2026-04-22 21:28:06 +00:00
parent 311824f036
commit 9dd6a82d08
5 changed files with 123 additions and 29 deletions

View File

@@ -146,12 +146,29 @@ def _build_acquisitions():
"SELECT * FROM stitches ORDER BY level DESC, auv"
).fetchall()
# Assign GP1/GP2 labels per AUV by enumerating distinct serials in fixed order.
gp_by_serial: dict[tuple[int, str], str] = {}
for j in jobs:
key = (j["acquisition_id"], j["auv"])
serials = gp_by_serial.setdefault(key, [])
if j["gopro_serial"] not in serials:
serials.append(j["gopro_serial"])
gp_label: dict[tuple[int, str, str], str] = {}
for (acq_id, auv), serials in gp_by_serial.items():
for idx, ser in enumerate(sorted(serials)):
gp_label[(acq_id, auv, ser)] = f"GP{idx + 1}"
by_acq: dict[int, list[dict]] = {}
by_acq_total: dict[int, int] = {}
for j in jobs:
d = dict(j)
dur_s = _job_duration_s(j)
d["_duration"] = _fmt_dur(dur_s)
d["gp_label"] = gp_label.get((j["acquisition_id"], j["auv"], j["gopro_serial"]), "?")
d["video_duration_fmt"] = _fmt_dur(int(j["video_duration_s"] or 0)) if (j["video_duration_s"] or 0) > 0 else ""
d["trimmed_total"] = (j["trimmed_head"] or 0) + (j["trimmed_tail"] or 0)
# Only expose a native viser link when port is listening. Probed on render via TCP check.
d["native_viser_url"] = None # filled below
by_acq.setdefault(j["acquisition_id"], []).append(d)
by_acq_total[j["acquisition_id"]] = by_acq_total.get(j["acquisition_id"], 0) + dur_s