CoolFace
Apppublic

RohanExploit/Meta-hackathon

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
health_check.py76 linesDownload Raw Back to scripts
1"""Run a quick local system health check for this repository.2 3Checks:41) Python syntax compile for core modules52) Test suite (with pytest host plugin autoload disabled)63) Legacy smoke scripts7"""8 9from __future__ import annotations10 11import os12import subprocess13import sys14from pathlib import Path15 16 17ROOT = Path(__file__).resolve().parent.parent18 19 20def _run(step: str, cmd: list[str], env: dict[str, str] | None = None) -> None:21    print(f"\n[health] {step}")22    print(f"[health] $ {' '.join(cmd)}")23    subprocess.run(cmd, cwd=ROOT, env=env, check=True)24 25 26def main() -> int:27    python = sys.executable28 29    compile_targets = [30        "environment/models.py",31        "environment/retail_env.py",32        "environment/grader.py",33        "environment/tasks.py",34        "server/app.py",35        "inference.py",36        "test_env.py",37        "test_api.py",38        "scripts/run_tests.py",39    ]40 41    _run(42        "Compile core Python files",43        [python, "-m", "py_compile", *compile_targets],44    )45 46    env = os.environ.copy()47    env["PYTEST_DISABLE_PLUGIN_AUTOLOAD"] = "1"48    _run(49        "Run test suite",50        [python, "scripts/run_tests.py"],51        env=env,52    )53 54    _run("Run environment smoke script", [python, "test_env.py"])55    _run("Run API smoke script", [python, "test_api.py"])56    _run(57        "Run pre-submission checks (skip Docker/OpenEnv CLI)",58        [python, "scripts/pre_submission_check.py"],59        env={60            **env,61            "API_BASE_URL": env.get("API_BASE_URL", "https://router.huggingface.co/v1"),62            "MODEL_NAME": env.get("MODEL_NAME", "health-check-placeholder"),63            "HF_TOKEN": env.get("HF_TOKEN", "health-check-placeholder"),64            "PRECHECK_SKIP_HEALTH": "1",65            "PRECHECK_SKIP_DOCKER": "1",66            "PRECHECK_SKIP_OPENENV": "1",67        },68    )69 70    print("\n[health] All checks passed.")71    return 072 73 74if __name__ == "__main__":75    raise SystemExit(main())76