11e37ee807
gates / gates (push) Successful in 27s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
49 lines
2.7 KiB
Python
49 lines
2.7 KiB
Python
#!/usr/bin/env python3
|
|
"""benchq.py <queue-name> <app> <svc=ref>[,<svc=ref>] [<app> <moves> ...]
|
|
|
|
Runs `upgrade-test.py --move` on bench LXC 9401 for each app IN ORDER, then copies that edge's
|
|
evidence OFF the bench into apps/<app>/bench/ before starting the next (R-320: the evidence leaves
|
|
the machine at the end of the phase that made it). One line per finished edge in benchq-<queue>.txt.
|
|
"""
|
|
import json, os, subprocess, sys, time
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
BENCH = "/tmp/claude-1000/-mnt-5-hdd-felhom-eu-git/9b587939-a44a-4c70-ac5c-b459dc8f41ab/scratchpad/bench.sh"
|
|
q = sys.argv[1]
|
|
args = sys.argv[2:]
|
|
out = open(os.path.join(HERE, f"benchq-{q}.txt"), "a", buffering=1)
|
|
for i in range(0, len(args), 2):
|
|
app, moves = args[i], args[i + 1].split(",")
|
|
label = app
|
|
if "@" in app: # romm@engine: a second edge of one app gets its own folder
|
|
app, tag = app.split("@", 1)
|
|
label = f"{app}-{tag}"
|
|
t0 = time.time()
|
|
out.write(f"{time.strftime('%H:%M:%S')} START {app} {moves}\n")
|
|
pre = f"cd /opt/upg && [ -d evidence/MV-{app} ] && mv evidence/MV-{app} evidence/MV-{app}-$(date +%s); "
|
|
subprocess.run([BENCH], input=pre, capture_output=True, text=True, timeout=120)
|
|
cmd = (f"cd /opt/upg && timeout 2400 python3 upgrade-test.py --soak 600 --move {app} {' '.join(moves)} "
|
|
f"> /opt/upg/MV-{app}.log 2>&1; echo rc=$?")
|
|
r = subprocess.run([BENCH], input=cmd, capture_output=True, text=True, timeout=2700)
|
|
dest = os.path.join(HERE, "apps", label, "bench")
|
|
os.makedirs(dest, exist_ok=True)
|
|
pull = (f"cd /opt/upg && tar czf /tmp/ev-{app}.tgz MV-{app}.log evidence/MV-{app} 2>/dev/null; "
|
|
f"base64 -w0 /tmp/ev-{app}.tgz")
|
|
r2 = subprocess.run([BENCH], input=pull, capture_output=True, text=True, timeout=600)
|
|
import base64, io, tarfile
|
|
try:
|
|
tarfile.open(fileobj=io.BytesIO(base64.b64decode(r2.stdout.strip()))).extractall(dest)
|
|
except Exception as e:
|
|
out.write(f" evidence pull FAILED for {app}: {e}\n")
|
|
v = {}
|
|
try:
|
|
v = json.load(open(os.path.join(dest, "evidence", f"MV-{app}", "verdict.json")))
|
|
except Exception:
|
|
pass
|
|
mem = v.get("memory") or {}
|
|
peaks = {n: c.get("peak_pct") for n, c in (mem.get("containers") or {}).items()}
|
|
out.write(f"{time.strftime('%H:%M:%S')} DONE {app} {r.stdout.strip()} verdict={v.get('verdict')} "
|
|
f"read_before={v.get('seed_read_before')} read_after={v.get('seed_read_after')} "
|
|
f"abort={v.get('abort')} marks={v.get('marks')} peaks={peaks} "
|
|
f"detail={str(v.get('abort_detail'))[:160]!r} ({round(time.time()-t0)}s)\n")
|
|
out.write(f"{time.strftime('%H:%M:%S')} QUEUE {q} FINISHED\n")
|