-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdispatch.py
More file actions
executable file
·38 lines (27 loc) · 995 Bytes
/
dispatch.py
File metadata and controls
executable file
·38 lines (27 loc) · 995 Bytes
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
#! /usr/bin/env python
"""
Dispatch calls of the form
['.../dispatch.py', 'scorpion', '--search', 'astar(lmcut())', '--internal-plan-file', 'sas_plan']
to the correct solver.
"""
from pathlib import Path
import subprocess
import sys
REPO = Path(__file__).resolve().parent
PLANNERS = [path.name for path in (REPO / "planners").iterdir()]
def parse_args():
planner, *config, planfile_option, planfile = sys.argv[1:]
assert planner in PLANNERS, planner
assert config
assert planfile_option == "--internal-plan-file", planfile_option
return planner, config, planfile
def main():
planner, config, planfile = parse_args()
print(f"Planner: {planner}")
print(f"Search configuration: {config}")
print(f"Plan file: {planfile}")
cmd = [sys.executable, str(REPO / "planners" / planner / "fast-downward.py"), "--plan-file", planfile, "output.sas"] + config
p = subprocess.run(cmd)
return p.returncode
if __name__ == "__main__":
sys.exit(main())