From 71a17dbc24acdac99231b166aea57763d925b89f Mon Sep 17 00:00:00 2001 From: Eddie Zhou Date: Thu, 15 Oct 2026 01:21:46 -0700 Subject: [PATCH] [AMD][CI] setup: Skip redundant pip-cache chown walk and MORI rebuild (#42148) --- scripts/ci/amd/amd_ci_install_dependency.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/ci/amd/amd_ci_install_dependency.sh b/scripts/ci/amd/amd_ci_install_dependency.sh index 5f6e934d37..2684370eda 100755 --- a/scripts/ci/amd/amd_ci_install_dependency.sh +++ b/scripts/ci/amd/amd_ci_install_dependency.sh @@ -96,8 +96,10 @@ if [[ "${IMAGE_STAGE_SUFFIX}" == "-rocm724" || "${IMAGE_STAGE_SUFFIX}" == "-rocm fi echo "Image torch ${IMAGE_TORCH_VERSION}, HIP ${IMAGE_HIP_VERSION}; installing python extras: [${EXTRAS}]" -# Fix permissions on pip cache, ignore errors from concurrent access or missing temp files -docker exec ci_sglang chown -R root:root /sgl-data/pip-cache 2>/dev/null || true +# Fix permissions on pip cache, ignore errors from concurrent access or missing temp files. +# pip running as root disables the cache unless the cache dir itself is owned by root; it +# never checks the entries beneath it. Simply changing folder permissions reduces chown runtime. +docker exec ci_sglang chown root:root /sgl-data/pip-cache 2>/dev/null || true docker exec ci_sglang pip install --cache-dir=/sgl-data/pip-cache --upgrade pip # Helper function to install with retries and fallback PyPI mirror @@ -229,9 +231,13 @@ fi # The CI image bakes MORI at the docker/rocm.Dockerfile-pinned commit; when a PR # bumps MORI_COMMIT the image is not rebuilt, so reinstall MORI here the same way # the Dockerfile does. Only ENABLE_MORI=1 images ship /sgl-workspace/mori. -if docker exec ci_sglang test -d /sgl-workspace/mori; then +# When the image's checkout is already at the pin the reinstall is redundant. +MORI_COMMIT=$(grep -E '^[[:space:]]*ARG[[:space:]]+MORI_COMMIT=' docker/rocm.Dockerfile | head -n1 | sed 's/.*MORI_COMMIT="\([^"]*\)".*/\1/' || true) +IMAGE_MORI_COMMIT=$(docker exec ci_sglang git -C /sgl-workspace/mori rev-parse HEAD 2>/dev/null || true) +if [[ -n "${MORI_COMMIT}" && "${IMAGE_MORI_COMMIT}" == "${MORI_COMMIT}" ]]; then + echo "[MORI] Image already has MORI ${MORI_COMMIT}; skipping reinstall" +elif docker exec ci_sglang test -d /sgl-workspace/mori; then MORI_REPO=$(grep -E '^[[:space:]]*ARG[[:space:]]+MORI_REPO=' docker/rocm.Dockerfile | head -n1 | sed 's/.*MORI_REPO="\([^"]*\)".*/\1/') - MORI_COMMIT=$(grep -E '^[[:space:]]*ARG[[:space:]]+MORI_COMMIT=' docker/rocm.Dockerfile | head -n1 | sed 's/.*MORI_COMMIT="\([^"]*\)".*/\1/') if [[ -z "${MORI_COMMIT}" ]]; then echo "[MORI] ERROR: Failed to extract MORI_COMMIT from Dockerfile"