soak harness persisted

This commit is contained in:
hugypufy committed 2026-10-23 12:25:59 +01:00
1 parent f415103cc5
commit bc7e4cbf46
1 file changed
+18
+18
View File
@@ -0,0 +1,18 @@
import json, random, threading, time, urllib.request
PORT=39476; T0=time.time(); rounds=0; faults=0
def fire(i, kill):
try:
body=json.dumps({"model":"qwen35","messages":[{"role":"user","content":f"Explain in detail topic {i}: write a long essay."}],"max_tokens":512,"temperature":0.8}).encode()
req=urllib.request.Request(f"http://127.0.0.1:{PORT}/v1/chat/completions",data=body,headers={"Content-Type":"application/json"})
r=urllib.request.urlopen(req, timeout=2 if kill else 300)
if not kill: r.read()
except Exception:
pass
while time.time()-T0 < 1800:
ths=[threading.Thread(target=fire,args=(i,random.random()<0.5),daemon=True) for i in range(8)]
for t in ths: t.start()
time.sleep(random.uniform(0.5,3)); rounds+=1
try: urllib.request.urlopen(f"http://127.0.0.1:{PORT}/health",timeout=10).read(); ok="ok"
except Exception as e: ok=f"FAULT {e}"; faults+=1
if rounds%20==0: print(f"{time.strftime('%T')} rounds={rounds} health={ok} faults={faults}",flush=True)
print(f"SOAK DONE: {rounds} abort-heavy rounds, {faults} health faults in {(time.time()-T0)/60:.0f} min",flush=True)