-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunDPDL.py
49 lines (42 loc) · 1.8 KB
/
runDPDL.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import subprocess
import sys
import time
def param(type, start, end, heur=999, timeout_value=600):
for i in range(start, end + 1):
if heur == 999:
for h in range(4):
try:
subprocess.run(
['./main', f'{type}{i}', f'{h}'], timeout=timeout_value)
time.sleep(1)
except subprocess.TimeoutExpired:
print(
f"Timeout of {timeout_value} seconds reached.")
print("-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------")
else:
try:
subprocess.run(
['./main', f'{type}{i}', f'{heur}'], timeout=timeout_value)
time.sleep(1)
except subprocess.TimeoutExpired:
print(
f"Timeout of {timeout_value} seconds reached for subprocess with input {type}{i}.")
if __name__ == "__main__":
heur_value = 999
if(len(sys.argv) == 5):
script_name, script_type, start_value, end_value, heur_value = sys.argv
try:
start_value, end_value, heur_value = map(
int,(start_value, end_value, heur_value))
except ValueError:
print("Error: start, end, heur, and timeout must be integers.")
sys.exit(1)
else:
script_name, script_type, start_value, end_value = sys.argv
try:
start_value, end_value = map(
int,(start_value, end_value))
except ValueError:
print("Error: start, end, heur, and timeout must be integers.")
sys.exit(1)
param(script_type, start_value, end_value, heur_value)