Skip to content

Commit 421fa9d

Browse files
Merge main@a2e80617 into chore/bump-mcore-main-261012
Bring in d8fe0b5 (#6420, ci: use writable config locks for offline test containers) so this PR's CI uses a writable MEGATRON_CONFIG_LOCK_DIR. The merged tree is identical to the locally validated merge(ce1b60a, a2e8061). Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
2 parents ce1b60a + a2e8061 commit 421fa9d

3 files changed

Lines changed: 39 additions & 0 deletions

File tree

‎.github/actions/test-template/action.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ runs:
122122
echo "::group::Start test container"
123123
if [[ "$MOUNT_FS" == "true" ]]; then
124124
VOLUME_ARGS="--volume ${{ inputs.test-data-path }}:/home/TestData --env HF_HUB_OFFLINE=1"
125+
# The shared offline cache may be read-only to the container user.
126+
# All ranks in these single-container jobs share this writable lock directory.
127+
VOLUME_ARGS+=" --env MEGATRON_CONFIG_LOCK_DIR=/home/ubuntu/.cache/huggingface"
125128
HF_HOME=/home/TestData/HF_HOME
126129
NEMO_HOME=/home/TestData/nemo_home
127130
else

‎docs/versions1.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
"version": "nightly",
44
"url": "https://docs.nvidia.com/nemo/megatron-bridge/nightly/"
55
},
6+
{
7+
"version": "0.7.0",
8+
"url": "https://docs.nvidia.com/nemo/megatron-bridge/0.7.0/"
9+
},
610
{
711
"name": "0.6.0 (latest) · 26.08",
812
"version": "0.6.0",

‎tests/unit_tests/ci/test_test_template.py‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,35 @@ def test_container_startup_cannot_override_gcp_test_environment(
8585
"NVTE_FLASH_ATTN_V3": "0",
8686
"NVTE_FLASH_ATTN_V4": "0",
8787
}
88+
89+
90+
@pytest.mark.parametrize("mount_fs", [True, False])
91+
def test_mounted_cache_uses_container_local_config_locks(tmp_path: Path, mount_fs: bool) -> None:
92+
action = yaml.safe_load(ACTION.read_text())
93+
start = next(step["run"] for step in action["runs"]["steps"] if step.get("name") == "Start container")
94+
expressions = {
95+
"inputs.test-data-path": "/shared/test-data",
96+
"github.run_id": "123",
97+
"inputs.runner": "nemo-ci-gcp-gpu-x2",
98+
"inputs.shard-id": "",
99+
"inputs.num-shards": "",
100+
"inputs.container-image": "test-image",
101+
"inputs.timeout": "1",
102+
}
103+
start = re.sub(r"\$\{\{\s*(.*?)\s*\}\}", lambda match: expressions[match[1]], start)
104+
docker = tmp_path / "docker"
105+
docker.write_text('#!/bin/sh\n[ "$1" != run ] || printf "%s\\n" "$@" > docker-args\n')
106+
docker.chmod(0o755)
107+
env = {**os.environ, "PATH": f"{tmp_path}:{os.environ['PATH']}", "MOUNT_FS": str(mount_fs).lower()}
108+
subprocess.run(["bash", "-c", start], cwd=tmp_path, env=env, check=True, capture_output=True, text=True)
109+
args = (tmp_path / "docker-args").read_text().splitlines()
110+
container_env = dict(args[i + 1].split("=", 1) for i, arg in enumerate(args) if arg == "--env")
111+
if mount_fs:
112+
assert container_env["HF_HOME"] == "/home/TestData/HF_HOME"
113+
assert container_env["HF_HUB_OFFLINE"] == "1"
114+
assert container_env["MEGATRON_CONFIG_LOCK_DIR"] == "/home/ubuntu/.cache/huggingface"
115+
assert args[args.index("--volume") + 1] == "/shared/test-data:/home/TestData"
116+
else:
117+
assert "MEGATRON_CONFIG_LOCK_DIR" not in container_env
118+
assert "HF_HUB_OFFLINE" not in container_env
119+
assert "--volume" not in args

0 commit comments

Comments
 (0)