import json,pathlib,re
root=pathlib.Path('/home/lab/bench/ornith/modular/vllm')
print('vLLM / GPU 2 — experimental results (not a leaderboard)')
if (root/'thermal-stop.json').exists():
 print('THERMAL INTERLOCK ACTIVE: reached90C; automatic starts blocked pending manual review.')
print('case | startup | retrieval | quality | first c1 decode estimate')
for run in sorted((root/'runs').glob('*')):
 r=run/'readiness.json'
 if not r.exists():continue
 readiness=json.loads(r.read_text()); status='ready' if readiness.get('ready') else 'failed'
 quality=next((p for p in [run/'quality-shared.json',run/'quality.json'] if p.exists()),None)
 if quality:
  q=json.loads(quality.read_text()); entries=q if isinstance(q,list) else q.get('results',[])
  quality_text=f'{sum(bool(x.get("pass")) for x in entries)}/{len(entries)}'
 else:quality_text='not tested'
 benches=list(run.glob('*/results.jsonl')); retrieval='not tested';speed='-'
 if benches:
  rows=[json.loads(s) for bench in benches for s in bench.read_text().splitlines() if s.strip()]
  entries=[v for row in rows for v in row['results'] if 'retrieval_pass' in v]
  retrieval=f'{sum(bool(x.get("retrieval_pass")) for x in entries)}/{len(entries)}'
  c1=next((x for row in rows if row['concurrency']==1 for x in row['results']),{})
  if c1.get('decode_tok_s_estimate'):speed=f"{c1['decode_tok_s_estimate']:.1f} tok/s"
 print(f'{run.name} | {status} | {retrieval} | {quality_text} | {speed}')
 for summary in sorted(run.glob('*/summary.json')):
  s=json.loads(summary.read_text());print(f"  {summary.parent.name}: batches={s.get('batches')} completed={s.get('completed','legacy')} pass={s.get('all_pass')}")
print('These are short screening samples; only explicit five-repeat/long-run artifacts validate final profiles.')
