Skip to content

ci: install PR batchgen into per-worktree venv instead of PYTHONPATH override - #168

Open
Andrewxu313 wants to merge 1 commit into
mainfrom
tairan/ci-venv-install
Open

ci: install PR batchgen into per-worktree venv instead of PYTHONPATH override#168
Andrewxu313 wants to merge 1 commit into
mainfrom
tairan/ci-venv-install

Conversation

@Andrewxu313

Copy link
Copy Markdown
Contributor

Description

Replace the PYTHONPATH-override in pr-gpu-smoke-incontainer.sh with a per-worktree venv that pip-installs the PR's batchgen with extensions rebuilt against the PR source.

Motivation

Run 26448889229 hung at _wait_for_workers_ready for 30+ minutes with zero GPU activity. Diagnosis: the launcher set PYTHONPATH=$WORKTREE_PATH so the PR's Python source overrode imports, but batchgen ships compiled C++/CUDA extensions (built April 29 in the conda env). When the PR's Python classes / function signatures drift from the cached .so ABI, workers crash silently at module import. The parent then deadlocks waiting for "workers ready" signals that never arrive.

The fix mirrors how build.yml already handles the source: build batchgen from the worktree using BUILD_OPS=1 pip install ... --no-deps --no-build-isolation. But install into a venv with --system-site-packages so torch + CUDA deps come from the conda env (no 30 GB duplication) and POIS's interactive conda env stays untouched.

Per-run cost: one C++/CUDA build per node (~2-3 min based on build.yml's wall time), then cached at ~/.cache/torch_extensions/ for subsequent runs of the same source.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • I have read the CONTRIBUTION guide.
  • I have updated the tests (if applicable).
  • I have updated the documentation (if applicable).

…override

The previous PYTHONPATH=$WORKTREE_PATH approach silently broke GPU CI:
workers spawned by launch_http_server crashed at import time when the PR's
Python source disagreed with the conda env's pre-compiled C++/CUDA
extensions (ABI mismatch, missing symbols, drifted module APIs). The
parent then deadlocked in _wait_for_workers_ready since no worker ever
reported healthy. Symptom: server log frozen at _wait_for_workers_ready,
0% GPU utilization, port 33001 never opened, 30-min HEALTH_TIMEOUT hit.

Switch to per-worktree venv:
- python -m venv $WORKTREE/.venv-ci --system-site-packages
  inherits torch + CUDA deps from the conda env without copying them.
- BUILD_OPS=1 pip install -e . --no-deps --no-build-isolation -v
  rebuilds batchgen's C++/CUDA extensions against the PR source so
  imports match the runtime classes used by the launcher.
- venv lives inside the worktree; git worktree remove cleans it up.

POIS's interactive conda env stays untouched (this was the original
reason for the PYTHONPATH design).
@github-actions github-actions Bot added the ci:run Trigger build + GPU regression on H20 label May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run Trigger build + GPU regression on H20

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant