From c6bd6930584b4b75245b48cb590d918cd73a1cb7 Mon Sep 17 00:00:00 2001 From: Michael Pilosov Date: Tue, 21 Apr 2026 20:22:38 -0600 Subject: [PATCH] runtime display --- app/web/main.py | 16 ++++++++++++++++ app/web/static/style.css | 8 ++++++++ app/web/templates/_runs.html | 1 + 3 files changed, 25 insertions(+) diff --git a/app/web/main.py b/app/web/main.py index db6bec7..eb68739 100644 --- a/app/web/main.py +++ b/app/web/main.py @@ -453,6 +453,18 @@ app.mount("/static", StaticFiles(directory=str(BASE_DIR / "static")), name="stat templates = Jinja2Templates(directory=str(BASE_DIR / "templates")) +def _fmt_runtime(seconds: Optional[float]) -> Optional[str]: + if seconds is None or seconds <= 0: + return None + if seconds < 60: + return f"{seconds:.1f}s" + m, s = divmod(int(seconds), 60) + if m < 60: + return f"{m}m{s:02d}s" + h, m = divmod(m, 60) + return f"{h}h{m:02d}m" + + def _run_view(run: Dict[str, Any]) -> Dict[str, Any]: """Normalise a flow-run dict for the template.""" rid = run.get("id", "") @@ -460,6 +472,9 @@ def _run_view(run: Dict[str, Any]) -> Dict[str, Any]: state_name = run.get("state_name") or state_type.title() start = run.get("start_time") or run.get("expected_start_time") or run.get("created") params = run.get("parameters") or {} + # estimated_run_time recomputes server-side (ticks up while RUNNING); + # total_run_time is the authoritative value once the run finishes. + rtime_s = run.get("estimated_run_time") or run.get("total_run_time") # Try to look up synthesised outputs either from memory or from params ref_file = None emb_file = None @@ -493,6 +508,7 @@ def _run_view(run: Dict[str, Any]) -> Dict[str, Any]: "state_type": state_type, "state_name": state_name, "start": start, + "runtime": _fmt_runtime(float(rtime_s) if rtime_s is not None else None), "params": params, "ref_file": ref_file, "emb_file": emb_file, diff --git a/app/web/static/style.css b/app/web/static/style.css index 85ef745..af040ee 100644 --- a/app/web/static/style.css +++ b/app/web/static/style.css @@ -426,6 +426,14 @@ button.submit:disabled { background: var(--faint); border-color: var(--faint); c .badge.crashed, .badge.cancelled { color: var(--alarm); background: #f4e8e4; } +.run .stamp .rt { + display: block; + color: var(--faint); + font-size: 0.68rem; + margin-bottom: 8px; + font-variant-numeric: tabular-nums; +} + .run .recipe { font-family: var(--serif); font-size: 0.92rem; diff --git a/app/web/templates/_runs.html b/app/web/templates/_runs.html index 2e205d4..689419c 100644 --- a/app/web/templates/_runs.html +++ b/app/web/templates/_runs.html @@ -9,6 +9,7 @@ {% for r in runs %}
  • + {% if r.runtime %}{{ r.runtime }}{% endif %} {% if r.start %}{{ r.start[:10] }}
    {{ r.start[11:19] }}{% else %} {% endif %} #{{ r.short_id }}