Add runtime environment readiness checks

This commit is contained in:
2026-06-30 14:28:49 +08:00
parent 442b521705
commit d9ea249ff0
12 changed files with 603 additions and 18 deletions

27
scripts/verify_runtime_envs.py Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env python3
from __future__ import annotations
import argparse
import json
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / "backend"))
from app.modules.system.service import get_runtime_readiness # noqa: E402
def main() -> None:
parser = argparse.ArgumentParser(description="Verify Seg Data Server runtime conda environments.")
parser.add_argument("--refresh", action="store_true", help="ignore the backend readiness cache")
args = parser.parse_args()
report = get_runtime_readiness(force=args.refresh)
print(json.dumps(report, ensure_ascii=False, indent=2))
if not report.get("passed"):
raise SystemExit(1)
if __name__ == "__main__":
main()