From fed18fa2e2223f4dc4df1b48043d399c2798af05 Mon Sep 17 00:00:00 2001 From: drjones Date: Sun, 27 Sep 2026 17:22:48 -0700 Subject: [PATCH] fix: trial parser now shows LATEST trial (was stuck on first match); params from last block --- heretic-dashboard.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/heretic-dashboard.py b/heretic-dashboard.py index 1549ed1..187a7ed 100644 --- a/heretic-dashboard.py +++ b/heretic-dashboard.py @@ -14,10 +14,11 @@ def tail_log(n=120): return [] def run_state(): - lines = tail_log(400) + lines = tail_log(3000) text = "".join(lines) state = {"phase": "unknown", "trial": 0, "trials_total": 200, "params": [], "done": False, "exit": None} - m = re.search(r"Running trial (\d+) of (\d+)", text) + m = None + for m in re.finditer(r"Running trial (\d+) of (\d+)", text): pass # keep LAST occurrence if m: state["phase"] = "optimizing" state["trial"] = int(m.group(1)); state["trials_total"] = int(m.group(2)) @@ -32,8 +33,15 @@ def run_state(): # capture current trial params params = {} in_params = False - for ln in lines: - if "Parameters:" in ln: in_params = True; params = {}; continue + last_param_start = None + for i, ln in enumerate(lines): + if "Parameters:" in ln: last_param_start = i + if last_param_start is not None: + in_params = True + for ln in lines[last_param_start+1:]: + pm = re.match(r"\s+\* ([a-z_.]+) = ([^#]+)", ln) + if pm: params[pm.group(1)] = pm.group(2).strip() + elif ln.strip() and "Parameters" not in ln: break if in_params: pm = re.match(r"\s+\* ([a-z_.]+) = ([^#]+)", ln) if pm: params[pm.group(1)] = pm.group(2).strip()