Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/changes/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ runs:
k8s-smoke:
- 'e2e/k8s/scripts/**'
- 'e2e/k8s/values/**'
- 'e2e/test_evaluator_plugin.py'
- 'e2e/test_jobs.py'
- '.github/actions/free-disk-space/action.yaml'
guardrails-benchmark:
Expand Down
19 changes: 19 additions & 0 deletions .github/assets/ngc/containers/nmp-gym-tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -->
<!-- SPDX-License-Identifier: Apache-2.0 -->

---
description: Job runner for Gym agent evaluations, part of NeMo Platform
---
## NeMo Platform Gym Tasks Container

This container provides the Gym and Ray runtime for agent evaluation jobs. It is
separate from the shared CPU tasks container so those dependencies remain
isolated to Gym workloads.

### Resources

[Documentation](https://docs.nvidia.com/nemo-platform)

### License

This container is licensed under the [Apache License 2.0](https://github.com/NVIDIA-NeMo/nemo-platform/blob/main/LICENSE).
74 changes: 72 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,12 @@ jobs:

- name: Print Docker bake graph
shell: bash
run: make docker-print TARGET=docker-cpu
run: |
target=docker-cpu
if [ "${PUBLISH_IMAGES}" = "true" ]; then
target=docker-cpu-ci
fi
make docker-print TARGET="${target}"

- name: Build CPU images
if: env.PUBLISH_IMAGES != 'true'
Expand All @@ -324,7 +329,7 @@ jobs:
- name: Build and publish CPU images
if: env.PUBLISH_IMAGES == 'true'
shell: bash
run: make docker-push TARGET=docker-cpu
run: make docker-push TARGET=docker-cpu-ci

- name: Save fastembed model cache
if: steps.fastembed-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -567,6 +572,7 @@ jobs:
uv run --frozen pytest \
e2e \
-v \
-m "not gym_e2e" \
--run-e2e \
--no-cov \
--junitxml=report-kubernetes-e2e.xml
Expand All @@ -580,6 +586,69 @@ jobs:
junit-report: report-kubernetes-e2e.xml
services-log-dir: ${{ runner.temp }}/e2e-services-logs

kind-gym-e2e:
name: Kind Gym agent-evaluate e2e
needs: [changes, build-cpu-smoke-images]
if: >
!cancelled() &&
needs.build-cpu-smoke-images.result == 'success' &&
needs.build-cpu-smoke-images.outputs.publish_images == 'true'
runs-on: ubuntu-latest
timeout-minutes: 45
permissions:
contents: read
packages: read
env:
KIND_CLUSTER_NAME: gha-${{ github.run_id }}-${{ github.run_attempt }}-kind-gym-e2e
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false

- name: Setup Kind cluster for Gym evaluation
uses: ./.github/actions/setup-kind-cluster
with:
kind-cluster-name: ${{ env.KIND_CLUSTER_NAME }}
image-registry: ${{ needs.build-cpu-smoke-images.outputs.image_registry }}
image-tag: ${{ needs.build-cpu-smoke-images.outputs.image_tag }}
kind-image-pull-token: ${{ github.token }}
kind-image-pull-user: ${{ github.actor }}

- name: Pre-pull Gym task image
shell: bash
env:
KIND_IMAGE_PULL_TOKEN: ${{ github.token }}
KIND_IMAGE_PULL_USER: ${{ github.actor }}
IMAGE_REGISTRY: ${{ needs.build-cpu-smoke-images.outputs.image_registry }}
IMAGE_TAG: ${{ needs.build-cpu-smoke-images.outputs.image_tag }}
run: e2e/k8s/scripts/prepull_kind_images.sh "${IMAGE_REGISTRY}/nmp-gym-tasks:${IMAGE_TAG}"

- name: Run Gym agent-evaluate e2e test
shell: bash
env:
_TYPER_FORCE_DISABLE_TERMINAL: "1"
E2E_SERVICES_LOG_DIR: ${{ runner.temp }}/e2e-services-logs
run: |
test -n "${NMP_E2E_CLUSTER_URL}"
export NMP_BASE_URL="${NMP_E2E_CLUSTER_URL}"
uv run --frozen pytest \
e2e/test_evaluator_plugin.py \
-v \
-m gym_e2e \
--run-e2e \
--no-cov \
--junitxml=report-kubernetes-gym-e2e.xml

- name: Finalize Kind Gym e2e
if: always()
uses: ./.github/actions/finalize-kind-e2e
with:
kind-cluster-name: ${{ env.KIND_CLUSTER_NAME }}
artifact-name: kind-gym-e2e-kubernetes-artifacts
junit-report: report-kubernetes-gym-e2e.xml
services-log-dir: ${{ runner.temp }}/e2e-services-logs

helm-lint:
name: Helm lint
needs: [changes]
Expand Down Expand Up @@ -2090,6 +2159,7 @@ jobs:
- docker-bake-graph
- build-cpu-smoke-images
- kind-cpu-smoke
- kind-gym-e2e
- helm-lint
- helm-chart-verifier
- lint
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ on:
container-ids:
description: >-
Custom only. Comma-separated container IDs.
Allowed: nmp-api, nmp-cpu-tasks, nmp-customizer-tasks,
Allowed: nmp-api, nmp-cpu-tasks, nmp-gym-tasks, nmp-customizer-tasks,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
nmp-automodel-training, nmp-unsloth-training, nmp-rl-training,
auditor-tasks, safe-synthesizer-tasks.
required: false
Expand Down Expand Up @@ -120,6 +120,7 @@ env:
[
{"id":"nmp-api","target":"nmp-api-docker"},
{"id":"nmp-cpu-tasks","target":"nmp-cpu-tasks-docker"},
{"id":"nmp-gym-tasks","target":"nmp-gym-tasks-docker"},
{"id":"nmp-customizer-tasks","target":"nmp-customizer-tasks"},
{"id":"nmp-automodel-training","target":"nmp-automodel-training-docker"},
{"id":"nmp-unsloth-training","target":"nmp-unsloth-training"},
Expand Down
37 changes: 37 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,15 @@ group "docker-cpu" {
]
}

# CI extension that builds and validates the dedicated Gym task image.
group "docker-cpu-ci" {
targets = [
"docker-cpu",
"nmp-gym-tasks-docker",
"nmp-gym-tasks-smoke-test",
]
}

group "docker-gpu" {
targets = [
"safe-synthesizer-tasks-docker",
Expand Down Expand Up @@ -685,6 +694,34 @@ target "nmp-cpu-tasks-docker" {
platforms = get_platforms()
}

# Dedicated Gym task image. The Gym-specific dependencies remain isolated from the shared CPU task image.
target "nmp-gym-tasks-docker" {
target = "runtime"
context = "."
dockerfile = "docker/Dockerfile.nmp-gym-tasks"
contexts = {
nmp-cpu-tasks = "target:nmp-cpu-tasks-docker"
}
cache-to = maybe_registry_cache_to("nmp-gym-tasks")
cache-from = maybe_registry_cache_from("nmp-gym-tasks")
tags = sha_and_maybe_latest_tags("nmp-gym-tasks")
output = image_output()
platforms = get_platforms()
}

# Cheap import/CLI validation for the isolated Gym environment. Built in docker-cpu-ci.
target "nmp-gym-tasks-smoke-test" {
target = "smoke-test"
context = "."
dockerfile = "docker/Dockerfile.nmp-gym-tasks"
contexts = {
nmp-cpu-tasks = "target:nmp-cpu-tasks-docker"
}
cache-from = maybe_registry_cache_from("nmp-gym-tasks")
output = ["type=cacheonly"]
platforms = get_platforms()
}

# Python wheel builders (causal-conv1d, mamba-ssm, av, opencv-python-headless).
# CUDA extensions only ship source on PyPI; av/opencv bundle FFmpeg. Pre-built for
# amd64 and arm64. Wheels live at /wheels/*.whl inside each image.
Expand Down
28 changes: 28 additions & 0 deletions docker/Dockerfile.nmp-gym-tasks
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# syntax=docker/dockerfile:1
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# Gym-enabled task image for NeMo Evaluator agent-evaluation jobs.
#
# Gym and Ray are isolated from the shared CPU task image. Test and model configuration is supplied
# per job through GymRunnerTarget.hydra_params.

ARG NMP_CPU_TASKS_BASE=nmp-cpu-tasks
FROM ${NMP_CPU_TASKS_BASE} AS runtime

COPY docker/locks/nmp-gym-tasks /opt/nmp-gym-tasks-lock

RUN uv venv --python /usr/local/bin/python3.13 /opt/gym-venv \
&& UV_PROJECT_ENVIRONMENT=/opt/gym-venv uv sync \
--project /opt/nmp-gym-tasks-lock \
--locked \
--no-dev \
--no-install-project \
&& ln -s /opt/gym-venv/bin/gym /usr/local/bin/gym

FROM runtime AS smoke-test
RUN gym --help >/dev/null \
&& /opt/gym-venv/bin/python -c \
'import importlib.metadata as m; import nemo_gym, ray, tiktoken; print({"nemo-gym": m.version("nemo-gym"), "ray": m.version("ray"), "tiktoken": m.version("tiktoken")})'

FROM runtime
Comment thread
JashG marked this conversation as resolved.
Resolved
41 changes: 41 additions & 0 deletions docker/locks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,44 @@ uv sync --project docker/locks/mamba-wheel-build-py311 --locked --no-install-pro
uv sync --project docker/locks/mamba-wheel-build-py312 --locked --no-install-project --dry-run --python-platform x86_64-unknown-linux-gnu
uv sync --project docker/locks/mamba-wheel-build-py312 --locked --no-install-project --dry-run --python-platform aarch64-unknown-linux-gnu
```

## Gym task image lockfile

`docker/Dockerfile.nmp-gym-tasks` uses `nmp-gym-tasks` for the isolated Gym
environment. The lock is separate from the workspace because Gym and Ray are
image-specific dependencies that are intentionally excluded from the shared CPU
task environment.

After changing `docker/locks/nmp-gym-tasks/pyproject.toml`, regenerate
its lock with Python 3.13.14 or newer:

```bash
uv lock --project docker/locks/nmp-gym-tasks --python 3.13.14
```

Verify both image architectures:

```bash
uv sync --project docker/locks/nmp-gym-tasks --locked --no-install-project --dry-run --python 3.13.14 --python-platform x86_64-unknown-linux-gnu
uv sync --project docker/locks/nmp-gym-tasks --locked --no-install-project --dry-run --python 3.13.14 --python-platform aarch64-unknown-linux-gnu
```

### Upgrading Gym task dependencies

Dependency upgrades are deliberate maintenance changes; the image build never
relocks dynamically:

1. Update the direct pins in `docker/locks/nmp-gym-tasks/pyproject.toml`.
2. Regenerate `uv.lock` with the command above.
3. Review the lock diff, especially the resolved `ray` version and packages
containing native code.
4. Run both architecture checks above.
5. Build `nmp-gym-tasks-smoke-test`, which verifies the Gym CLI and imports the
installed `nemo_gym`, `ray`, and `tiktoken` packages:

```bash
docker buildx bake nmp-gym-tasks-smoke-test
```

6. Run the Evaluator agent-evaluation compiler tests, which verify that Gym
targets route to this image.
18 changes: 18 additions & 0 deletions docker/locks/nmp-gym-tasks/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

[project]
name = "nmp-gym-tasks"
version = "0.0.0"
requires-python = ">=3.13.14,<3.14"
dependencies = [
"nemo-gym==0.5.0",
"tiktoken==0.13.0",
]

[tool.uv]
required-version = ">=0.9.14,<0.10.0"
environments = [
"sys_platform == 'linux' and platform_machine == 'x86_64'",
"sys_platform == 'linux' and platform_machine == 'aarch64'",
]
Loading
Loading