generated from JeetP1711/RagBooms-AutonomousHacks-Phase-01
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_simulation.py
More file actions
38 lines (31 loc) · 1.17 KB
/
run_simulation.py
File metadata and controls
38 lines (31 loc) · 1.17 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
import subprocess
import sys
import time
# The sequence of scripts to run
steps = [
"1_create_error_log.py", # Creates the crash log
"2_run_debugger.py", # Diagnoses the error
"3_run_fixer.py", # Fixes the code
"4_run_validator.py" # Verifies the fix
]
print("🚀 Starting Self-Healing Simulation (One Run)...")
for script in steps:
print(f"\n{'='*50}")
print(f"▶️ EXECUTING: {script}")
print(f"{'='*50}\n")
# Execute the script
result = subprocess.run([sys.executable, script])
# Check for failure (Step 1 is EXPECTED to fail, so we ignore it)
if result.returncode != 0 and script != "1_create_error_log.py":
print(f"❌ EXECUTION STOPPED: {script} encountered a critical error.")
break
# ⏳ COOLDOWN: Wait 60s between steps to reset API Quota
if script != steps[-1]:
print(f"\n⏳ API Cooldown: Waiting 60 seconds before '{steps[steps.index(script)+1]}'...")
for i in range(60, 0, -1):
sys.stdout.write(f"\r{i}s remaining...")
sys.stdout.flush()
time.sleep(1)
print("\n")
print(f"\n{'='*50}")
print("✅ Simulation Complete!")