Repository navigation
build(docker): let the runtime UID use the image's uv cache offline - #4456
Conversation
The release image ships a complete uv cache, but at /root/.cache/uv, which /root's 0700 mode hides from the unprivileged runtime UID (65532) the image already prepares for. The /opt/nemo_rl_cache/uv directory that UID is given is empty, and the venvs' site-packages stay root-owned. uv refuses to start with a cache it cannot write, so a non-root `uv run --extra <backend>` (every Megatron, Automodel, vLLM, SGLang, TRT-LLM and Gym unit shard) cannot install the extra without network. The final `uv sync --all-groups` is exact, so no extra is preinstalled. - Set UV_CACHE_DIR=/opt/nemo_rl_cache/uv for the build and the runtime. - Chown the cache and the venvs to RUNTIME_UID in the layers that create them. The venvs are hardlinked against the cache, so this changes each inode's owner once and copies nothing; later layers only chown the root-owned entries they add. - Probe at build time, as the runtime UID, that uv opens the cache and checks the venv offline. - Point the CI uv-cache export and ray.sub's UV_CACHE_DIR_OVERRIDE mount at the new path. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: oliver könig <[email protected]>
|
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
/ok to test 5285a9c |
|
/ok to test 52b23d9 |
|
/review |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
LGTM — no high-confidence actionable findings in this light review.
Inspected all four changed files and traced the affected cache seeding/export, worker-venv setup, and Slurm mount paths. The new cache location is consistent across the image, CI exports, and documented override.
Static inspection only; Docker builds, offline runtime-UID probes, and Slurm launches were not executed.
Review generated by codex
|
LGTM pending nightly pipeline runs without any issues |
Signed-off-by: oliver könig <[email protected]>
|
/ok to test 52b23d9 |
|
pipeline-id |
Pulls in 594 commits from main, including PR #4456 which independently moved the uv cache to /opt/nemo_rl_cache/uv for RUNTIME_UID offline installs. Reconciles the two designs: the BuildKit cache mount now materializes into UV_CACHE_DIR instead of /root/.cache/uv, and a new STRIP_UV_CACHE build-arg (default off) lets size-sensitive builds opt into deleting the materialized cache from the final image while keeping it for main/nightly. Co-Authored-By: Claude Sonnet 5 <[email protected]> Signed-off-by: Kajal Jain <[email protected]>
Background / motivation
UV_OFFLINE=1,UV_CACHE_DIR=/opt/nemo_rl_cache/uv./root/.cache/uv, and/rootisdrwx------(checked in the release image's layer tar)./opt/nemo_rl_cache/uvis created empty for UID 65532 (install -din the runtime-UID block).site-packagesstays root-owned.uv sync --frozen --all-groups --no-install-projectis exact, so the main venv holds no backend extra.uv run --extra <backend>shard fails before pytest starts:uv run --extra mcore|automodel|vllm|sglang|trtllm|modelopt|nemo_gymuv runthat has to re-install the editable project from another checkout path.What changed
docker/Dockerfile: one uv cache,UV_CACHE_DIR=/opt/nemo_rl_cache/uv, for the build and every runtime identity. The layers that fill the cache hand it, and the venvs built from it, toRUNTIME_UID:RUNTIME_GID.docker/Dockerfile: a build-time probe, as the runtime UID, that uv opens the cache and checks the venv offline..github/workflows/cicd-main.yml: the uv-cache export copies from the new path.ray.subanddocs/cluster.md:UV_CACHE_DIR_OVERRIDEmounts at the container cache path, overridable withCONTAINER_UV_CACHE_DIR.Details
chown -Rover the cache,/opt/nemo_rl_venvand/opt/ray_venvsat the end of the sameRUN. The venvs are hardlinked against the cache, so each inode changes owner once and nothing is copied up.find … -uid 0). Earlier entries already belong to the runtime UID, so nothing is copied up there either.uv-cache-seedrsync now targets${UV_CACHE_DIR}. Seeds exported from older images (/root/.cache/uvcontents) still apply, because only the destination moved./root/.cache. These are the TRT-LLM wheel and ccache mounts. They are never part of the image.uv cache direqualsUV_CACHE_DIR;purelib;UV_OFFLINE=1 uv sync --frozen --inexact --no-install-project --no-install-workspacesucceeds. That is the lock check every offlineuv rundoes first.ray.sub: images built before this change ignore the new mount target and keep using their own/root/.cache/uv, so nothing breaks; the override just has no effect on them.Tested
docker buildx build --check -f docker/Dockerfile .: no warnings.bash -n ray.sub: OK.pre-commit run --files docker/Dockerfile .github/workflows/cicd-main.yml ray.sub docs/cluster.md: passed.rl@sha256:b50ada68…(mainfb8396ada) has/rootatdrwx------ 0/0and the populated cache under/root/.cache/uv./opt/nemo_rl_cache/uvis only created empty, in the final layer.Build H100 container / buildpassed. The image isrl:37107298972(sha256:cce5f46a…).L0_Unit_Tests_Otherhas 1 failure, 2973 passed:test_single_controller_actor.py::test_opd_advantage_stage_pools_raw_gap_separately_under_tropd(AttributeError: 'SingleControllerActor' object has no attribute '_train_data_dump').mainfb8396adafails the same test the same way (run 37111913568), so it is not from this change.testlane990000000003/1on gcp-h100: isolated rank (no egress), repository profilenemo-rlv8 (digestf6c3757d…), imagerl@sha256:cce5f46a…built from build(docker): let the runtime UID use the image's uv cache offline #4456 (rl:37107298972), sourceko3n1g/fix/offline-test-execution@40467c738(build(docker): let the runtime UID use the image's uv cache offline #4456 + fix(test): keep test-suite dry runs from installing audio deps #4461 on mainfb8396ada), 2 GPUs per shard:L0_Unit_Tests_Other: 2973 passed, 1 failed, the same pre-existingmainfailure. The editablenemo-rlrebuilt offline (Built nemo-rl @ file:///mnt/checkpoint-workspace/RL), andautomodel_envwas created offline from the image's uv cache (256 packages). On the baseline imagerl@sha256:b50ada68…this shard stopped before pytest: the offline editable rebuild could not findsetuptools.L0_Unit_Tests_Automodel: passed, 263 passed, 15 skipped.L0_Unit_Tests_Vllm_1: passed, 136 passed, 26 skipped.L0_Unit_Tests_Nemo_Gym: 146 passed, 1 error intest_nemo_gym.py::test_nemo_gym_sanity. NeMo Gym creates each server venv at runtime with seed packages, and offline uv finds nopipin the cache (Because pip was not found in the cache … the network was disabled), soexample_multi_step_resources_serverexits. The image only prefetches Gym venvs whenNEMO_GYM_PREFETCH_CONFIGSis set, and it is empty by default. That is a separate gap, not part of this change.🤖 Generated with Claude Code