-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_all.py
More file actions
75 lines (60 loc) · 2.1 KB
/
Copy pathrun_all.py
File metadata and controls
75 lines (60 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
"""run_all.py -- Run all real incident benchmarks and print a summary table.
Usage:
python benchmarks/real_incidents/run_all.py
"""
from __future__ import annotations
import subprocess
import sys
import time
INCIDENTS = [
("incident_01_openai_loop", "GPT-4 Self-Correction Loop (2023-Q3)"),
("incident_02_cost_spike", "$552 Recursive Agent Bill (2024-Q1)"),
("incident_03_websocket_ddos", "47k tok/s WebSocket Flood (2024-Q2)"),
("incident_04_semantic_echo", "Semantic Echo Chamber (2024-Q3)"),
("incident_05_multi_tool", "Tool Cascade OOM (2024-Q4)"),
]
def run_incident(module: str) -> tuple[int, float]:
"""Run a single incident benchmark. Returns (exit_code, elapsed_sec)."""
start = time.perf_counter()
result = subprocess.run(
[sys.executable, f"benchmarks/real_incidents/{module}.py"],
capture_output=True,
text=True,
)
elapsed = time.perf_counter() - start
if result.returncode != 0:
print(f"\n[FAIL] {module}:\n{result.stderr[-500:]}")
else:
# Print the benchmark output indented
for line in result.stdout.splitlines():
print(f" {line}")
return result.returncode, elapsed
def main() -> None:
print("=" * 72)
print("VERONICA REAL INCIDENT BENCHMARKS -- Full Suite")
print("=" * 72)
results: list[tuple[str, str, int, float]] = []
for module, label in INCIDENTS:
print(f"\n--- {label} ---")
code, elapsed = run_incident(module)
results.append((module, label, code, elapsed))
# Summary
print("\n" + "=" * 72)
print("SUMMARY")
print("=" * 72)
print(f"{'Incident':<50} {'Status':>8} {'Time (s)':>10}")
print("-" * 72)
all_passed = True
for module, label, code, elapsed in results:
status = "PASS" if code == 0 else "FAIL"
if code != 0:
all_passed = False
print(f"{label:<50} {status:>8} {elapsed:>10.2f}")
print()
if all_passed:
print("All incidents: PASS")
else:
print("Some incidents FAILED -- see output above.")
sys.exit(1)
if __name__ == "__main__":
main()