summaryrefslogtreecommitdiff
path: root/ep_run/ep_ajr_check.py
blob: 5d8143ed8e83009cb48f10a97cff855b1b911ef3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import time, os, re, subprocess
os.chdir("/home/yurenh2/ept/ep_run"); LOG="runs/ep_rr_ajr.log"; TARGET=2.70
def alive(): return subprocess.run(["pgrep","-f","ckpt runs/ep_rr_ajr.pt"],capture_output=True).returncode==0
def latest():
    try: ls=[l for l in open(LOG) if l.startswith("step")]
    except Exception: return None
    if not ls: return None
    l=ls[-1]
    ms=re.search(r"step\s+(\d+)",l); mv=re.search(r"val CE ([\d.eE+-]+)",l); mb=re.search(r"best ([\d.eE+-]+)",l)
    mr=re.search(r"res=([\d.eE+-]+)",l); mj=re.search(r"jr=([\d.eE+-]+)",l)
    if not (ms and mv and mb and mr): return None
    return (int(ms.group(1)),float(mv.group(1)),float(mb.group(1)),float(mr.group(1)), mj.group(1) if mj else "?")
fired=None; t0=time.time()
while fired is None and time.time()-t0<18*3600:
    time.sleep(120)
    d=latest()
    if not alive(): fired=f"ep_rr_ajr EXITED; last {d}"; break
    if not d: continue
    step,val,best,res,jr=d
    if (val>12 or res>0.3) and step>200: fired=f"ep_rr_ajr BLEW @step{step} val{val:.2f} res{res:.1e} best{best:.4f} jr={jr}"; break
    if best<=TARGET: fired=f"ep_rr_ajr reached {TARGET}: step{step} best{best:.4f} res{res:.1e} jr={jr} -> 该 eig-probe 看 g 是否~0"; break
print(f"=== EP_RR_AJR -> {TARGET} ==="); print(fired or "18h timeout"); print("last:",latest())