Download source/scripts/cluster/check_environment_dependencies.py from khazic/spec-b300: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/khazic/spec-b300/resolve/main/source/scripts/cluster/check_environment_dependencies.py
- Command line
-
hf download hf://khazic/spec-b300/source/scripts/cluster/check_environment_dependencies.py
-
curl -L -o check_environment_dependencies.py https://huggingface.co/khazic/spec-b300/resolve/main/source/scripts/cluster/check_environment_dependencies.py
1.1 kB
| """Reject new dependency errors while recording known official-image warnings.""" | |
| import json | |
| import subprocess | |
| from pathlib import Path | |
| def check(python): | |
| result = subprocess.run(["/usr/bin/python3", "-m", "pip", "--python", python, "check"], capture_output=True, text=True) | |
| return [] if result.returncode == 0 else result.stdout.strip().splitlines() | |
| baseline = check("/usr/bin/python3") | |
| accepted = {line for line in baseline if line.startswith(("pygobject ", "nixl "))} | |
| report = {"official_image_errors": baseline, "environments": {}} | |
| for environment in ("/opt/speculators_venv", "/opt/vllm_venv"): | |
| errors = check(environment + "/bin/python") | |
| new_errors = sorted(set(errors) - accepted) | |
| report["environments"][environment] = {"errors": errors, "new_errors": new_errors} | |
| print(environment + ": " + ("no new dependency errors" if not new_errors else "; ".join(new_errors))) | |
| Path("logs/ngram_setup/dependency-checks.json").write_text(json.dumps(report, indent=2) + "\n") | |
| if any(result["new_errors"] for result in report["environments"].values()): | |
| raise SystemExit(1) | |