@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 84e439a9cb
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 5, 22:15 UTC

[CI/Build] Move nightly wheel index generation to a single post-build step (#38322)

Signed-off-by: Shengqi Chen <harry-chen@outlook.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Shengqi Chen committed Mar 27, 2026 at 15:44 UTC 84e439a9cbbd68dd263ff49e73bc962f5e5ffbdd
3 files changed +96 -65
.buildkite/release-pipeline.yaml
+8
@@ -90,6 +90,14 @@ steps:
90 env:
91 DOCKER_BUILDKIT: "1"
92
93 + - label: "Generate and upload wheel indices"
94 + depends_on: "build-wheels"
95 + allow_dependency_failure: true
96 + agents:
97 + queue: cpu_queue_release
98 + commands:
99 + - "bash .buildkite/scripts/generate-and-upload-nightly-index.sh"
100 +
101 - group: "Build release Docker images"
102 key: "build-release-images"
103 steps:
.buildkite/scripts/generate-and-upload-nightly-index.sh new
+84
@@ -0,0 +1,84 @@
1 +#!/usr/bin/env bash
2 +
3 +set -ex
4 +
5 +# Generate and upload wheel indices for all wheels in the commit directory.
6 +# This script should run once after all wheels have been built and uploaded.
7 +
8 +# ======== setup ========
9 +
10 +BUCKET="vllm-wheels"
11 +INDICES_OUTPUT_DIR="indices"
12 +DEFAULT_VARIANT_ALIAS="cu129" # align with vLLM_MAIN_CUDA_VERSION in vllm/envs.py
13 +PYTHON="${PYTHON_PROG:-python3}" # try to read from env var, otherwise use python3
14 +SUBPATH=$BUILDKITE_COMMIT
15 +S3_COMMIT_PREFIX="s3://$BUCKET/$SUBPATH/"
16 +
17 +# detect if python3.12+ is available
18 +has_new_python=$($PYTHON -c "print(1 if __import__('sys').version_info >= (3,12) else 0)")
19 +if [[ "$has_new_python" -eq 0 ]]; then
20 + # use new python from docker
21 + docker pull python:3-slim
22 + PYTHON="docker run --rm -v $(pwd):/app -w /app python:3-slim python3"
23 +fi
24 +
25 +echo "Using python interpreter: $PYTHON"
26 +echo "Python version: $($PYTHON --version)"
27 +
28 +# ======== generate and upload indices ========
29 +
30 +# list all wheels in the commit directory
31 +echo "Existing wheels on S3:"
32 +aws s3 ls "$S3_COMMIT_PREFIX"
33 +obj_json="objects.json"
34 +aws s3api list-objects-v2 --bucket "$BUCKET" --prefix "$SUBPATH/" --delimiter / --output json > "$obj_json"
35 +mkdir -p "$INDICES_OUTPUT_DIR"
36 +
37 +# call script to generate indices for all existing wheels
38 +# these indices have relative paths that work as long as they are next to the wheel directory in s3
39 +# i.e., the wheels are always in s3://vllm-wheels/<commit>/
40 +# and indices can be placed in /<commit>/, or /nightly/, or /<version>/
41 +alias_args=()
42 +if [[ -n "$DEFAULT_VARIANT_ALIAS" ]]; then
43 + alias_args=(--alias-to-default "$DEFAULT_VARIANT_ALIAS")
44 +fi
45 +
46 +# HACK: we do not need regex module here, but it is required by pre-commit hook
47 +# To avoid any external dependency, we simply replace it back to the stdlib re module
48 +sed -i 's/import regex as re/import re/g' .buildkite/scripts/generate-nightly-index.py
49 +$PYTHON .buildkite/scripts/generate-nightly-index.py --version "$SUBPATH" --current-objects "$obj_json" --output-dir "$INDICES_OUTPUT_DIR" --comment "commit $BUILDKITE_COMMIT" "${alias_args[@]}"
50 +
51 +# copy indices to /<commit>/ unconditionally
52 +echo "Uploading indices to $S3_COMMIT_PREFIX"
53 +aws s3 cp --recursive "$INDICES_OUTPUT_DIR/" "$S3_COMMIT_PREFIX"
54 +
55 +# copy to /nightly/ only if it is on the main branch and not a PR
56 +if [[ "$BUILDKITE_BRANCH" == "main" && "$BUILDKITE_PULL_REQUEST" == "false" ]]; then
57 + echo "Uploading indices to overwrite /nightly/"
58 + aws s3 cp --recursive "$INDICES_OUTPUT_DIR/" "s3://$BUCKET/nightly/"
59 +fi
60 +
61 +# detect version from any wheel in the commit directory
62 +# download the first wheel we find to extract version metadata
63 +first_wheel_key=$($PYTHON -c "import json; obj=json.load(open('$obj_json')); print(next((c['Key'] for c in obj.get('Contents', []) if c['Key'].endswith('.whl')), ''))")
64 +if [[ -z "$first_wheel_key" ]]; then
65 + echo "Error: No wheels found in $S3_COMMIT_PREFIX"
66 + exit 1
67 +fi
68 +first_wheel=$(basename "$first_wheel_key")
69 +aws s3 cp "s3://$BUCKET/${first_wheel_key}" "/tmp/${first_wheel}"
70 +version=$(unzip -p "/tmp/${first_wheel}" '**/METADATA' | grep '^Version: ' | cut -d' ' -f2)
71 +rm -f "/tmp/${first_wheel}"
72 +echo "Version in wheel: $version"
73 +pure_version="${version%%+*}"
74 +echo "Pure version (without variant): $pure_version"
75 +
76 +# re-generate and copy to /<pure_version>/ only if it does not have "dev" in the version
77 +if [[ "$version" != *"dev"* ]]; then
78 + echo "Re-generating indices for /$pure_version/"
79 + rm -rf "${INDICES_OUTPUT_DIR:?}"
80 + mkdir -p "$INDICES_OUTPUT_DIR"
81 + # wheel-dir is overridden to be the commit directory, so that the indices point to the correct wheel path
82 + $PYTHON .buildkite/scripts/generate-nightly-index.py --version "$pure_version" --wheel-dir "$SUBPATH" --current-objects "$obj_json" --output-dir "$INDICES_OUTPUT_DIR" --comment "version $pure_version" "${alias_args[@]}"
83 + aws s3 cp --recursive "$INDICES_OUTPUT_DIR/" "s3://$BUCKET/$pure_version/"
84 +fi
.buildkite/scripts/upload-nightly-wheels.sh
+4 -65
@@ -2,27 +2,14 @@
2
3 set -ex
4
5 -# ======== part 0: setup ========
5 +# Upload a single wheel to S3 (rename linux -> manylinux).
6 +# Index generation is handled separately by generate-and-upload-nightly-index.sh.
7
8 BUCKET="vllm-wheels"
8 -INDICES_OUTPUT_DIR="indices"
9 -DEFAULT_VARIANT_ALIAS="cu129" # align with vLLM_MAIN_CUDA_VERSION in vllm/envs.py
10 -PYTHON=${PYTHON_PROG:=python3} # try to read from env var, otherwise use python3
9 SUBPATH=$BUILDKITE_COMMIT
10 S3_COMMIT_PREFIX="s3://$BUCKET/$SUBPATH/"
11
14 -# detect if python3.10+ is available
15 -has_new_python=$($PYTHON -c "print(1 if __import__('sys').version_info >= (3,12) else 0)")
16 -if [[ "$has_new_python" -eq 0 ]]; then
17 - # use new python from docker
18 - docker pull python:3-slim
19 - PYTHON="docker run --rm -v $(pwd):/app -w /app python:3-slim python3"
20 -fi
21 -
22 -echo "Using python interpreter: $PYTHON"
23 -echo "Python version: $($PYTHON --version)"
24 -
25 -# ========= part 1: collect, rename & upload the wheel ==========
12 +# ========= collect, rename & upload the wheel ==========
13
14 # Assume wheels are in artifacts/dist/*.whl
15 wheel_files=(artifacts/dist/*.whl)
@@ -52,56 +39,8 @@ echo "Renamed wheel to: $wheel"
39 # Extract the version from the wheel
40 version=$(unzip -p "$wheel" '**/METADATA' | grep '^Version: ' | cut -d' ' -f2)
41 echo "Version in wheel: $version"
55 -pure_version="${version%%+*}"
56 -echo "Pure version (without variant): $pure_version"
42
43 # copy wheel to its own bucket
44 aws s3 cp "$wheel" "$S3_COMMIT_PREFIX"
45
61 -# ========= part 2: generate and upload indices ==========
62 -# generate indices for all existing wheels in the commit directory
63 -# this script might be run multiple times if there are multiple variants being built
64 -# so we need to guarantee there is little chance for "TOCTOU" issues
65 -# i.e., one process is generating indices while another is uploading a new wheel
66 -# so we need to ensure no time-consuming operations happen below
67 -
68 -# list all wheels in the commit directory
69 -echo "Existing wheels on S3:"
70 -aws s3 ls "$S3_COMMIT_PREFIX"
71 -obj_json="objects.json"
72 -aws s3api list-objects-v2 --bucket "$BUCKET" --prefix "$SUBPATH/" --delimiter / --output json > "$obj_json"
73 -mkdir -p "$INDICES_OUTPUT_DIR"
74 -
75 -# call script to generate indices for all existing wheels
76 -# this indices have relative paths that could work as long as it is next to the wheel directory in s3
77 -# i.e., the wheels are always in s3://vllm-wheels/<commit>/
78 -# and indices can be placed in /<commit>/, or /nightly/, or /<version>/
79 -alias_args=()
80 -if [[ -n "$DEFAULT_VARIANT_ALIAS" ]]; then
81 - alias_args=(--alias-to-default "$DEFAULT_VARIANT_ALIAS")
82 -fi
83 -
84 -# HACK: we do not need regex module here, but it is required by pre-commit hook
85 -# To avoid any external dependency, we simply replace it back to the stdlib re module
86 -sed -i 's/import regex as re/import re/g' .buildkite/scripts/generate-nightly-index.py
87 -$PYTHON .buildkite/scripts/generate-nightly-index.py --version "$SUBPATH" --current-objects "$obj_json" --output-dir "$INDICES_OUTPUT_DIR" --comment "commit $BUILDKITE_COMMIT" "${alias_args[@]}"
88 -
89 -# copy indices to /<commit>/ unconditionally
90 -echo "Uploading indices to $S3_COMMIT_PREFIX"
91 -aws s3 cp --recursive "$INDICES_OUTPUT_DIR/" "$S3_COMMIT_PREFIX"
92 -
93 -# copy to /nightly/ only if it is on the main branch and not a PR
94 -if [[ "$BUILDKITE_BRANCH" == "main" && "$BUILDKITE_PULL_REQUEST" == "false" ]]; then
95 - echo "Uploading indices to overwrite /nightly/"
96 - aws s3 cp --recursive "$INDICES_OUTPUT_DIR/" "s3://$BUCKET/nightly/"
97 -fi
98 -
99 -# re-generate and copy to /<pure_version>/ only if it does not have "dev" in the version
100 -if [[ "$version" != *"dev"* ]]; then
101 - echo "Re-generating indices for /$pure_version/"
102 - rm -rf "${INDICES_OUTPUT_DIR:?}/*"
103 - mkdir -p "$INDICES_OUTPUT_DIR"
104 - # wheel-dir is overridden to be the commit directory, so that the indices point to the correct wheel path
105 - $PYTHON .buildkite/scripts/generate-nightly-index.py --version "$pure_version" --wheel-dir "$SUBPATH" --current-objects "$obj_json" --output-dir "$INDICES_OUTPUT_DIR" --comment "version $pure_version" "${alias_args[@]}"
106 - aws s3 cp --recursive "$INDICES_OUTPUT_DIR/" "s3://$BUCKET/$pure_version/"
107 -fi
46 +echo "Wheel uploaded. Index generation is handled by a separate step."