Skip to content

feat(deploy): lab-grade deployment — pinned digests, lockfile, SBOM, offline mode, profiles, executed 500k–1M benchmarks - #30

Open
Zhang1178 wants to merge 1 commit into
mainfrom
feat/lab-grade-deployment
Open

feat(deploy): lab-grade deployment — pinned digests, lockfile, SBOM, offline mode, profiles, executed 500k–1M benchmarks#30
Zhang1178 wants to merge 1 commit into
mainfrom
feat/lab-grade-deployment

Conversation

@Zhang1178

Copy link
Copy Markdown
Collaborator

Summary

Completes lab-grade deployment after #26: the container/lockfile/SBOM/offline/profiles stack top-tier labs expect, plus really executed 500k and 1M cell scale benchmarks with committed reports — replacing the previous "harness only, cluster reference not runnable" state. Independent of #28.

Reproducible image (digest pin + lockfile)

  • container/apptainer.def: base image pinned by OCI digest — python:3.11-slim-bookworm @ sha256:0bee7276f83efd4a1ee05bbbf4281d95ed28e079220a9457f25a93e3f1e3c31b (real digest resolved from Docker Hub, 2026-08-30). CI re-resolves the tag every build and fails on drift.
  • container/requirements-lock.txt: 208 packages pinned to exact versions with wheel SHA-256 hashes (uv pip compile --python-version 3.11 --generate-hashes; command recorded in the manifest). pip hash-checking mode verifies every wheel at install — which is also the offline supply-chain control. Source tree installs with --no-deps -e . on top.

SBOM

  • container/sbom-python.json: CycloneDX 1.5, 209 components, exact locked versions (scanpy 1.11.5, squidpy 1.8.2, torch 2.13.0, pydeseq2 0.5.4, …) via scripts/generate_sbom.py --from-lockfile (new mode; the old pyproject mode emitted placeholders).
  • CI regenerates the SBOM inside the built image and asserts component-level equality with the committed file — SBOM drift fails the build.

Deployment manifest

  • container/DEPLOYMENT_MANIFEST.json: single ledger — base digest, lockfile/SBOM SHA-256, CPU/GPU/offline profiles, Slurm reference profiles, benchmark evidence with machine-class labels, and an explicit evidence/adoption boundary. Digest consistency is test-enforced.

Offline mode (air-gapped labs / HPC)

  • BIONEXUS_OFFLINE=1 forces OFFLINE_STRICT egress (zero hosted endpoints) regardless of any other configuration and cannot be relaxed at runtime (set_mode refuses).
  • New gates: bionexus offline-check [--enforce] and bionexus doctor --offline / --require-offline (fail-closed, zero network requests; verifies replay eval provider + local zero-key MCP tools + policy-level endpoint refusal). Runs in the image %test and the Slurm profiles.

CPU / GPU profiles

  • One SIF, two run profiles: CPU apptainer exec (CI-validated end to end) and GPU apptainer exec --nv with a node-level torch.cuda.is_available() assertion — honestly documented as not CI-validatable (no GPU in CI).

Slurm reference profiles (cluster/slurm/profiles/)

  • hpc-cpu.sbatch (doctor → offline gate → three-gate chain), hpc-gpu.sbatch (--nv + CUDA evidence), run_scale_benchmark.sbatch (HPC reproduction of the committed evidence). Live-scheduler submission remains site adaptation — stated, not hidden.

Scale benchmark: actually executed, honestly labeled

Reworked evals/scale_benchmark.py to be memory-bounded by construction (chunked zero-inflated sparse generation at controlled structural density, in-place CPM/log1p, streaming HVG) + Windows peak-memory reporting (psutil peak_wset / GetProcessMemoryInfo). The old harness's 500k-cell "cluster reference" was a ~78%-dense Poisson draw (~350 GB at the default 20k genes) — not runnable anywhere; this PR's committed evidence is.

Committed executed reports (machine fingerprint, per-stage wall, peak memory + method, observed density):

Report Scale Machine Result
scale_benchmark_30k_5g.json 30k × 5k @ 8% 8 cores / 8 GB (Windows) 16.6 s, peak 0.87 GB
scale_benchmark_500k_5g.json 500k × 5k @ 8% 8 cores / 8 GB 278 s, peak 3.75 GB
scale_benchmark_1000k_5g.json 1M × 5k @ 5% 8 cores / 8 GB 482 s, peak 4.13 GB

Honesty: these are real runs of the committed harness, labeled as single small-node runs — not HPC numbers. The 500k–1M runs prove the pipeline is memory-feasible on commodity nodes; top-lab HPC evidence is produced by running run_scale_benchmark.sbatch on the target cluster and committing the node's report (the harness records the machine fingerprint, so the report is the evidence).

Test plan

  • tests/unit/test_lab_grade_deployment.py: 18 tests — offline enforcement/refusal/CLI gates, harness density + memory-method, manifest/lockfile/SBOM digest and component consistency, container digest pin, Slurm profile content.
  • Full unit suite at exact failure parity with pristine baseline HEAD (23 pre-existing environment failures verified on a clean worktree; 896 passed; zero new failures).

…file, SBOM, offline mode, CPU/GPU profiles, Slurm reference profiles, executed 500k-1M cell benchmarks

- container/apptainer.def: base image pinned by OCI digest (CI re-resolves
  and fails on drift); Python stack installed from container/requirements-lock.txt
  (208 packages, exact versions + wheel SHA-256 hashes via uv; pip
  hash-checking verifies wheels at install time — the offline supply-chain
  control); image %test runs the offline deployment gate
- SBOM: container/sbom-python.json (CycloneDX 1.5, 209 components, exact
  locked versions) via generate_sbom.py --from-lockfile; CI regenerates
  inside the image and asserts component-level equality (drift fails build)
- DEPLOYMENT_MANIFEST.json: single ledger for digests, lockfile/SBOM hashes,
  profiles, Slurm reference profiles, benchmark evidence + machine-class
  labels; consistency test-enforced
- offline mode: BIONEXUS_OFFLINE=1 forces OFFLINE_STRICT egress regardless
  of other config and cannot be relaxed at runtime; bionexus offline-check
  gate + bionexus doctor --offline/--require-offline (fail-closed, no
  network requests); runs in image %test and Slurm profiles
- CPU/GPU profiles: one SIF; CPU validated in CI, GPU via --nv with
  node-level CUDA assertion (honestly not CI-validated)
- cluster/slurm/profiles/: hpc-cpu.sbatch, hpc-gpu.sbatch,
  run_scale_benchmark.sbatch (HPC reproduction path)
- evals/scale_benchmark.py rework: memory-bounded by construction (chunked
  zero-inflated sparse generation at controlled density, in-place CPM/log1p,
  streaming HVG); Windows peak-memory reporting (psutil peak_wset /
  GetProcessMemoryInfo). Committed executed reports: 500k cells @ 8% density
  (278 s, 3.75 GB peak) and 1M cells @ 5% density (482 s, 4.13 GB peak) on
  an 8-core/8 GB node — honestly labeled small-node runs, not HPC numbers
- tests/unit/test_lab_grade_deployment.py: 18 tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants