summaryrefslogtreecommitdiff
path: root/ep_run/ep_t2fix_watch.py
blob: 32346f1eeb90592f2ac7b5737ffbdfeb93970382 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import time, os, re, subprocess
os.chdir("/home/yurenh2/ept/ep_run"); LOG="runs/ep_t2fix.log"
def alive(): return subprocess.run(["pgrep","-f","ckpt runs/ep_t2fix.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
    m=re.search(r"step\s+(\d+)/.*val CE ([\d.eE+-]+).*res=([\d.eE+-]+)", ls[-1])
    return (int(m.group(1)),float(m.group(2)),float(m.group(3))) if m else None
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_t2fix EXITED; last {d}"; break
    if not d: continue
    step,val,res=d
    if res>0.2 or val>15: fired=f"ep_t2fix DIVERGED step {step} val {val:.2f} res {res:.2e} — t2sel=160 did NOT prevent it"; break
    if val<2.0: fired=f"ep_t2fix reached val {val:.4f} step {step} res {res:.2e} — CLEARED the 2.0 wall (t2sel fix WORKED)"; break
    if step>=3200: fired=f"ep_t2fix SURVIVED to step {step} val {val:.4f} res {res:.2e} — past the redx/ep_hr02 blowup zone (fix holding)"; break
print("=== EP_T2FIX WATCHER FIRED ==="); print("trigger:", fired or "18h timeout"); print("last:", latest())