Дашборд: раздельные карточки «лучший за всё время» и «лучший текущего цикла»

Лог показывает лучший ТЕКУЩЕГО цикла (свежая популяция карабкается заново),
дашборд — за всё время; без подписи числа выглядели несвязанными.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jze9
2026-07-09 12:42:43 +05:00
parent 17323335e0
commit e394fd6d59
2 changed files with 19 additions and 2 deletions

View File

@@ -60,7 +60,8 @@ PAGE_HTML = r"""<!doctype html>
<div class="card"><div class="k">Реализуемо</div><div class="v" id="c-feas">—</div></div>
<div class="card"><div class="k">Нереализуемо</div><div class="v" id="c-infeas">—</div></div>
<div class="card"><div class="k">Доля реализуемых</div><div class="v" id="c-pct">—</div></div>
<div class="card"><div class="k">Лучший КПД / скорость</div><div class="v" id="c-best" style="font-size:20px">—</div></div>
<div class="card"><div class="k">Лучший КПД за всё время / скорость</div><div class="v" id="c-best" style="font-size:20px">—</div></div>
<div class="card"><div class="k">Лучший КПД текущего цикла</div><div class="v" id="c-cycle" style="font-size:20px">—</div></div>
<div class="card"><div class="k">GPU (GTX 1070)</div><div class="v" id="c-gpu" style="font-size:20px">—</div></div>
</div>
@@ -132,6 +133,8 @@ async function refresh(){
let best = (o.top && o.top.length) ? o.top[0].efficiency : null;
let bestV = (o.top_by_velocity && o.top_by_velocity.length) ? o.top_by_velocity[0].exit_velocity_mps : null;
document.getElementById('c-best').textContent = fmtPct(best) + (bestV!=null ? ' / '+fmt(bestV,0)+' м/с' : '');
document.getElementById('c-cycle').textContent =
o.cycle_best_pct==null ? '' : o.cycle_best_pct.toFixed(2)+'% (цикл идёт)';
const g = o.gpu;
document.getElementById('c-gpu').textContent = g
? `${g.util_pct}% · ${fmt(g.power_w,0)}Вт · ${g.temp_c}°C`

View File

@@ -95,11 +95,25 @@ def overview(db_path: Path, log_path: Path | None = None, top_n: int = 15) -> di
"efficiency_histogram": buckets,
"top": top,
"top_by_velocity": top_by_velocity,
"log_tail": _tail_log(log_path, 40) if log_path else [],
"log_tail": (tail := _tail_log(log_path, 40) if log_path else []),
# лучший КПД ТЕКУЩЕГО цикла (из лога): каждый цикл стартует со свежей
# популяции и карабкается заново — это ДРУГОЕ число, чем best за всё
# время, и без подписи их путали («сервер и морда не связаны»)
"cycle_best_pct": _last_cycle_best(tail),
"gpu": _gpu_stat(db_path),
}
def _last_cycle_best(log_lines: list[str]) -> float | None:
import re
for line in reversed(log_lines):
m = re.search(r"лучший_КПД=(-?[0-9.]+)%", line)
if m:
return float(m.group(1))
return None
def run_detail(db_path: Path, run_id: str) -> dict | None:
conn = open_connection(db_path)
try: