42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
|
|
#!/usr/bin/env python3
|
|||
|
|
"""pack/5.11 唯一入口:从 YAML 读入路径与阈值,运行手术室耗材主流程。"""
|
|||
|
|
from __future__ import annotations
|
|||
|
|
|
|||
|
|
import argparse
|
|||
|
|
import os
|
|||
|
|
import sys
|
|||
|
|
from pathlib import Path
|
|||
|
|
|
|||
|
|
PACK_ROOT = Path(__file__).resolve().parent
|
|||
|
|
sys.path.insert(0, str(PACK_ROOT / "src"))
|
|||
|
|
|
|||
|
|
from paths import ensure_code_on_path
|
|||
|
|
|
|||
|
|
ensure_code_on_path(PACK_ROOT)
|
|||
|
|
|
|||
|
|
from config import load_run_config
|
|||
|
|
from orchestrator import run_pipeline
|
|||
|
|
|
|||
|
|
|
|||
|
|
def main() -> int:
|
|||
|
|
os.environ.setdefault("OPENCV_FFMPEG_LOGLEVEL", "8")
|
|||
|
|
ap = argparse.ArgumentParser(description="手术室耗材主流程(YAML 配置)")
|
|||
|
|
ap.add_argument(
|
|||
|
|
"--config",
|
|||
|
|
type=Path,
|
|||
|
|
default=PACK_ROOT / "configs" / "default_config.yaml",
|
|||
|
|
help="配置文件路径(默认 pack 内 configs/default_config.yaml)",
|
|||
|
|
)
|
|||
|
|
args = ap.parse_args()
|
|||
|
|
cfg_path = args.config.resolve()
|
|||
|
|
if not cfg_path.is_file():
|
|||
|
|
print("找不到配置:", cfg_path, file=sys.stderr)
|
|||
|
|
return 1
|
|||
|
|
|
|||
|
|
run_cfg = load_run_config(PACK_ROOT, cfg_path)
|
|||
|
|
return int(run_pipeline(run_cfg))
|
|||
|
|
|
|||
|
|
|
|||
|
|
if __name__ == "__main__":
|
|||
|
|
raise SystemExit(main())
|