runtime display
This commit is contained in:
parent
b99406671e
commit
c6bd693058
@ -453,6 +453,18 @@ app.mount("/static", StaticFiles(directory=str(BASE_DIR / "static")), name="stat
|
|||||||
templates = Jinja2Templates(directory=str(BASE_DIR / "templates"))
|
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]:
|
def _run_view(run: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
"""Normalise a flow-run dict for the template."""
|
"""Normalise a flow-run dict for the template."""
|
||||||
rid = run.get("id", "")
|
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()
|
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")
|
start = run.get("start_time") or run.get("expected_start_time") or run.get("created")
|
||||||
params = run.get("parameters") or {}
|
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
|
# Try to look up synthesised outputs either from memory or from params
|
||||||
ref_file = None
|
ref_file = None
|
||||||
emb_file = None
|
emb_file = None
|
||||||
@ -493,6 +508,7 @@ def _run_view(run: Dict[str, Any]) -> Dict[str, Any]:
|
|||||||
"state_type": state_type,
|
"state_type": state_type,
|
||||||
"state_name": state_name,
|
"state_name": state_name,
|
||||||
"start": start,
|
"start": start,
|
||||||
|
"runtime": _fmt_runtime(float(rtime_s) if rtime_s is not None else None),
|
||||||
"params": params,
|
"params": params,
|
||||||
"ref_file": ref_file,
|
"ref_file": ref_file,
|
||||||
"emb_file": emb_file,
|
"emb_file": emb_file,
|
||||||
|
|||||||
@ -426,6 +426,14 @@ button.submit:disabled { background: var(--faint); border-color: var(--faint); c
|
|||||||
.badge.crashed,
|
.badge.crashed,
|
||||||
.badge.cancelled { color: var(--alarm); background: #f4e8e4; }
|
.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 {
|
.run .recipe {
|
||||||
font-family: var(--serif);
|
font-family: var(--serif);
|
||||||
font-size: 0.92rem;
|
font-size: 0.92rem;
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
{% for r in runs %}
|
{% for r in runs %}
|
||||||
<li class="run {% if just_submitted is defined and r.id == just_submitted %}just-submitted{% endif %}">
|
<li class="run {% if just_submitted is defined and r.id == just_submitted %}just-submitted{% endif %}">
|
||||||
<div class="stamp">
|
<div class="stamp">
|
||||||
|
{% if r.runtime %}<span class="rt">{{ r.runtime }}</span>{% endif %}
|
||||||
{% if r.start %}{{ r.start[:10] }}<br/>{{ r.start[11:19] }}{% else %} {% endif %}
|
{% if r.start %}{{ r.start[:10] }}<br/>{{ r.start[11:19] }}{% else %} {% endif %}
|
||||||
<span class="id">#{{ r.short_id }}</span>
|
<span class="id">#{{ r.short_id }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user