-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
29 lines (26 loc) · 1.01 KB
/
main.py
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
import concurrent.futures
import subprocess
def run_script(script_name):
"""Run a Python script using subprocess."""
try:
result = subprocess.run(['python', script_name], check=True, text=True, capture_output=True)
print(f"Output of {script_name}:\n{result.stdout}")
except subprocess.CalledProcessError as e:
print(f"Error running {script_name}:\n{e.stderr}")
if __name__ == "__main__":
# List of scripts to run
scripts = [
'driver_monitoring.py',
'collision_detection_lidar.py',
'passenger_counting.py',
'fleet_tracker_simulation.py',
'adaptive_cruise_control_lidar.py'
]
# Run each script in parallel
with concurrent.futures.ThreadPoolExecutor() as executor:
futures = [executor.submit(run_script, script) for script in scripts]
for future in concurrent.futures.as_completed(futures):
try:
future.result()
except Exception as e:
print(f"An error occurred: {e}")