mirror of
https://github.com/saymrwulf/QuantumLearning.git
synced 2026-05-14 20:58:00 +00:00
81 lines
2.2 KiB
Bash
Executable file
81 lines
2.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
|
|
usage() {
|
|
cat <<'EOF'
|
|
Usage: bash ./scripts/project_status.sh
|
|
|
|
Print the current local operational state of the QuantumLearning repo:
|
|
git state, repo-local Python environment, Playwright browser runtime, and
|
|
the latest repo-local Jupyter server if one is running.
|
|
EOF
|
|
}
|
|
|
|
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
|
|
usage
|
|
exit 0
|
|
fi
|
|
|
|
cd "$ROOT_DIR"
|
|
|
|
BRANCH="$(git branch --show-current)"
|
|
COMMIT="$(git rev-parse --short HEAD)"
|
|
if [[ -n "$(git status --short)" ]]; then
|
|
GIT_STATE="dirty"
|
|
else
|
|
GIT_STATE="clean"
|
|
fi
|
|
|
|
echo "Root: $ROOT_DIR"
|
|
echo "Git: $BRANCH @ $COMMIT ($GIT_STATE)"
|
|
|
|
if [[ -x "$ROOT_DIR/.venv/bin/python" ]]; then
|
|
PYTHON_VERSION="$("$ROOT_DIR/.venv/bin/python" -c 'import sys; print(sys.version.split()[0])')"
|
|
echo "Venv: present (Python $PYTHON_VERSION)"
|
|
else
|
|
echo "Venv: missing"
|
|
fi
|
|
|
|
if compgen -G "$ROOT_DIR/.playwright-browsers/chromium-*" >/dev/null; then
|
|
echo "Browser runtime: installed"
|
|
else
|
|
echo "Browser runtime: missing"
|
|
fi
|
|
|
|
if compgen -G "$ROOT_DIR/.jupyter_runtime/jpserver-*.json" >/dev/null; then
|
|
LATEST_SERVER_JSON="$(ls -t "$ROOT_DIR"/.jupyter_runtime/jpserver-*.json | head -n 1)"
|
|
"$ROOT_DIR/.venv/bin/python" - <<'PY' "$LATEST_SERVER_JSON"
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
path = Path(sys.argv[1])
|
|
data = json.loads(path.read_text())
|
|
pid = int(data["pid"])
|
|
|
|
try:
|
|
os.kill(pid, 0)
|
|
except ProcessLookupError:
|
|
print("Jupyter: runtime file exists but process is not running")
|
|
print(f" Runtime file: {path}")
|
|
except PermissionError:
|
|
print("Jupyter: runtime file present; live process probe is unavailable in this environment")
|
|
print(f" URL: {data['url']}lab/tree/notebooks/COURSE_BLUEPRINT.ipynb?token={data['token']}")
|
|
print(f" Runtime file: {path}")
|
|
else:
|
|
print(f"Jupyter: running (pid {pid})")
|
|
print(f" URL: {data['url']}lab/tree/notebooks/COURSE_BLUEPRINT.ipynb?token={data['token']}")
|
|
print(f" Runtime file: {path}")
|
|
PY
|
|
else
|
|
echo "Jupyter: no repo-local runtime file found"
|
|
fi
|
|
|
|
echo "Validation:"
|
|
echo " Quick: bash ./scripts/run_validation.sh --quick"
|
|
echo " Full: bash ./scripts/run_validation.sh --full"
|