-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_loop.py
31 lines (25 loc) · 1.04 KB
/
run_loop.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
import subprocess
import sys
import argh
from argh import arg
@arg('-n', type=int, help='Number of iterations to run')
@arg('--dataset', type=str, help='Name of the dataset (a subfolder under experiments/) to be evaluated')
@arg('--model', type=str, help='Name of RecBole model to be used')
@arg('--choice-model', type=str, help='Name of choice model to be used.')
@arg('-c', '--config', type=str, help='Path to the Recbole config file')
def call_script(n=100, dataset="example", model="ItemKNN", choice_model="rank_based", config="recbole_config_default.yaml"):
for i in range(1, n + 1):
command = [
sys.executable, "main.py", dataset, str(i),
"--clean",
"--model", model,
"--choice-model", choice_model,
"--config", config,
]
result = subprocess.run(command, check=True)
if result.returncode == 0:
print(f"Iteration {i}: Success")
else:
print(f"Iteration {i}: Error")
if __name__ == "__main__":
argh.dispatch_command(call_script)