File size: 1,298 Bytes
2f382c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""AccessPath command-line entry point for the full 2D/3D pipeline."""

from __future__ import annotations

import argparse
import subprocess
import sys
from pathlib import Path


ROOT = Path(__file__).resolve().parent
TOOLS = {
    "2d": ROOT / "tools" / "accessibility_2d_completion.py",
    "3d": ROOT / "tools" / "accessibility_3d_completion.py",
}


def main() -> int:
    parser = argparse.ArgumentParser(
        description="Run the AccessPath pipeline or one of its completion backends."
    )
    parser.add_argument(
        "mode",
        choices=("pipeline", *TOOLS),
        help="Full Slurm pipeline, or a direct 2D/3D backend.",
    )
    parser.add_argument(
        "args",
        nargs=argparse.REMAINDER,
        help="Arguments forwarded to the selected backend; prefix them with --.",
    )
    parsed = parser.parse_args()
    forwarded = parsed.args[1:] if parsed.args[:1] == ["--"] else parsed.args
    if parsed.mode == "pipeline":
        from accesspath3r.cli import main as pipeline_main

        sys.argv = [str(ROOT / "accesspath.py"), *forwarded]
        return pipeline_main()
    return subprocess.run([sys.executable, str(TOOLS[parsed.mode]), *forwarded], check=False).returncode


if __name__ == "__main__":
    raise SystemExit(main())