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

View File

@@ -17,6 +17,7 @@ core, then adds:
Seg_Data_Server_Net/
backend/ FastAPI API, job runner, module wrappers
frontend/ React + Vite operator UI
envs/ conda environment specs for task and MMSeg runtimes
scripts/ helper scripts for running services and syncing weights
weights/ copied model weights and manifest.json
```
@@ -27,6 +28,9 @@ Seg_Data_Server_Net/
cd Seg_Data_Server_Net
cp .env.example .env
# Create or repair the two runtime environments, then verify imports.
scripts/bootstrap_conda_envs.sh
# Backend. The deployment env is seg_smp so the API and most task wrappers
# share the same segmentation dependency stack. MMSeg jobs default to the
# separate SEG_MMSEG_CONDA_ENV because full mmcv wheels must match torch/CUDA.
@@ -59,6 +63,10 @@ The coverage panel calls `GET /api/coverage` and verifies that the user-facing
scripts from the existing `Seg/` workspace are mapped to web jobs. MMSeg
vendored internals, docs, build outputs, converters, and config templates are
classified as supporting artifacts rather than direct web actions.
The runtime panel calls `GET /api/system/readiness` and verifies the conda
imports required for the backend/task environment and the full MMSeg/mmcv
environment. Command-line verification is available with
`PYTHONPATH=backend conda run -n seg_smp python scripts/verify_runtime_envs.py --refresh`.
The same panel can run `POST /api/acceptance/smoke`, a lightweight live smoke
that creates an upload dataset, uploads a label, downloads it through the
@@ -81,14 +89,13 @@ Current `seg_smp` uses `mmcv-lite` because no `torch 2.6/cu124` full `mmcv`
wheel is available on this machine and `nvcc` is not installed for source
builds. A dedicated `seg_mmcv` environment is used for MMSeg tasks and has
`torch 2.1.2+cu121`, `mmcv 2.1.0`, `mmsegmentation 1.2.2`, and NumPy 1.26.
If rebuilding the environment, keep these versions aligned:
The reproducible specs live in `envs/seg_smp.yml` and `envs/seg_mmcv.yml`;
the bootstrap script uses the same pinned package sources:
```bash
conda create -n seg_mmcv python=3.10 -y
conda run -n seg_mmcv python -m pip install -U pip
conda run -n seg_mmcv python -m pip install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu121
conda run -n seg_mmcv python -m pip install mmengine==0.10.7 mmsegmentation==1.2.2 'mmcv==2.1.0' -f https://download.openmmlab.com/mmcv/dist/cu121/torch2.1/index.html
conda run -n seg_mmcv python -m pip install 'numpy<2' 'opencv-python<4.12' ftfy regex matplotlib pandas scikit-learn scipy seaborn tqdm tensorboard
scripts/bootstrap_conda_envs.sh all
scripts/bootstrap_conda_envs.sh task
scripts/bootstrap_conda_envs.sh mmseg
```
## Weight Sync
@@ -149,8 +156,9 @@ PYTHONPATH=backend conda run -n seg_smp python scripts/run_agents.py --build
```
The validation agent checks catalog coverage, the `seg_smp` task env, the
`seg_mmcv` MMSeg env, GPU visibility, no-weight Git safety, backend tests,
frontend build, and live backend/frontend endpoints when the services are
running. With live validation enabled it also runs the lightweight acceptance
smoke above. By default it also runs the deep training acceptance; set
`SEG_VALIDATE_DEEP=0` when a quick non-training validation pass is needed.
`seg_mmcv` MMSeg env, runtime import readiness, GPU visibility, no-weight Git
safety, backend tests, frontend build, and live backend/frontend endpoints
when the services are running. With live validation enabled it also runs the
lightweight acceptance smoke above. By default it also runs the deep training
acceptance; set `SEG_VALIDATE_DEEP=0` when a quick non-training validation
pass is needed.