[CI] fix docker image build by specifying merge-base commit id when downloading pre-compiled wheels (#29930)
Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
This commit is contained in:
@@ -1,46 +0,0 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import os
|
|
||||||
|
|
||||||
template = """<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
<h1>Links for vLLM</h1/>
|
|
||||||
<a href="../{x86_wheel_html_escaped}">{x86_wheel}</a><br/>
|
|
||||||
<a href="../{arm_wheel_html_escaped}">{arm_wheel}</a><br/>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
"""
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
|
||||||
parser.add_argument("--wheel", help="The wheel path.", required=True)
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
filename = os.path.basename(args.wheel)
|
|
||||||
|
|
||||||
with open("index.html", "w") as f:
|
|
||||||
print(f"Generated index.html for {args.wheel}")
|
|
||||||
# sync the abi tag with .buildkite/scripts/upload-wheels.sh
|
|
||||||
if "x86_64" in filename:
|
|
||||||
x86_wheel = filename
|
|
||||||
arm_wheel = filename.replace("x86_64", "aarch64").replace(
|
|
||||||
"manylinux1", "manylinux2014"
|
|
||||||
)
|
|
||||||
elif "aarch64" in filename:
|
|
||||||
x86_wheel = filename.replace("aarch64", "x86_64").replace(
|
|
||||||
"manylinux2014", "manylinux1"
|
|
||||||
)
|
|
||||||
arm_wheel = filename
|
|
||||||
else:
|
|
||||||
raise ValueError(f"Unsupported wheel: {filename}")
|
|
||||||
# cloudfront requires escaping the '+' character
|
|
||||||
f.write(
|
|
||||||
template.format(
|
|
||||||
x86_wheel=x86_wheel,
|
|
||||||
x86_wheel_html_escaped=x86_wheel.replace("+", "%2B"),
|
|
||||||
arm_wheel=arm_wheel,
|
|
||||||
arm_wheel_html_escaped=arm_wheel.replace("+", "%2B"),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
@@ -196,6 +196,7 @@ ARG SCCACHE_S3_NO_CREDENTIALS=0
|
|||||||
|
|
||||||
# Flag to control whether to use pre-built vLLM wheels
|
# Flag to control whether to use pre-built vLLM wheels
|
||||||
ARG VLLM_USE_PRECOMPILED=""
|
ARG VLLM_USE_PRECOMPILED=""
|
||||||
|
ARG VLLM_MERGE_BASE_COMMIT=""
|
||||||
ARG VLLM_MAIN_CUDA_VERSION=""
|
ARG VLLM_MAIN_CUDA_VERSION=""
|
||||||
|
|
||||||
# Use dummy version for csrc-build wheel (only .so files are extracted, version doesn't matter)
|
# Use dummy version for csrc-build wheel (only .so files are extracted, version doesn't matter)
|
||||||
@@ -216,6 +217,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
|||||||
&& export SCCACHE_IDLE_TIMEOUT=0 \
|
&& export SCCACHE_IDLE_TIMEOUT=0 \
|
||||||
&& export CMAKE_BUILD_TYPE=Release \
|
&& export CMAKE_BUILD_TYPE=Release \
|
||||||
&& export VLLM_USE_PRECOMPILED="${VLLM_USE_PRECOMPILED}" \
|
&& export VLLM_USE_PRECOMPILED="${VLLM_USE_PRECOMPILED}" \
|
||||||
|
&& export VLLM_PRECOMPILED_WHEEL_COMMIT="${VLLM_MERGE_BASE_COMMIT}" \
|
||||||
&& export VLLM_MAIN_CUDA_VERSION="${VLLM_MAIN_CUDA_VERSION}" \
|
&& export VLLM_MAIN_CUDA_VERSION="${VLLM_MAIN_CUDA_VERSION}" \
|
||||||
&& export VLLM_DOCKER_BUILD_CONTEXT=1 \
|
&& export VLLM_DOCKER_BUILD_CONTEXT=1 \
|
||||||
&& sccache --show-stats \
|
&& sccache --show-stats \
|
||||||
@@ -233,6 +235,7 @@ RUN --mount=type=cache,target=/root/.cache/ccache \
|
|||||||
rm -rf .deps && \
|
rm -rf .deps && \
|
||||||
mkdir -p .deps && \
|
mkdir -p .deps && \
|
||||||
export VLLM_USE_PRECOMPILED="${VLLM_USE_PRECOMPILED}" && \
|
export VLLM_USE_PRECOMPILED="${VLLM_USE_PRECOMPILED}" && \
|
||||||
|
export VLLM_PRECOMPILED_WHEEL_COMMIT="${VLLM_MERGE_BASE_COMMIT}" && \
|
||||||
export VLLM_DOCKER_BUILD_CONTEXT=1 && \
|
export VLLM_DOCKER_BUILD_CONTEXT=1 && \
|
||||||
python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38; \
|
python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38; \
|
||||||
fi
|
fi
|
||||||
|
|||||||
25
setup.py
25
setup.py
@@ -346,10 +346,13 @@ class precompiled_wheel_utils:
|
|||||||
The order of preference is:
|
The order of preference is:
|
||||||
1. user-specified wheel location (can be either local or remote, via
|
1. user-specified wheel location (can be either local or remote, via
|
||||||
VLLM_PRECOMPILED_WHEEL_LOCATION)
|
VLLM_PRECOMPILED_WHEEL_LOCATION)
|
||||||
2. user-specified variant from nightly repo (current main commit via
|
2. user-specified variant (VLLM_PRECOMPILED_WHEEL_VARIANT) from nightly repo
|
||||||
VLLM_PRECOMPILED_WHEEL_VARIANT)
|
|
||||||
3. the variant corresponding to VLLM_MAIN_CUDA_VERSION from nightly repo
|
3. the variant corresponding to VLLM_MAIN_CUDA_VERSION from nightly repo
|
||||||
4. the default variant from nightly repo (current main commit)
|
4. the default variant from nightly repo
|
||||||
|
|
||||||
|
If downloading from the nightly repo, the commit can be specified via
|
||||||
|
VLLM_PRECOMPILED_WHEEL_COMMIT; otherwise, the head commit in the main branch
|
||||||
|
is used.
|
||||||
"""
|
"""
|
||||||
wheel_location = os.getenv("VLLM_PRECOMPILED_WHEEL_LOCATION", None)
|
wheel_location = os.getenv("VLLM_PRECOMPILED_WHEEL_LOCATION", None)
|
||||||
if wheel_location is not None:
|
if wheel_location is not None:
|
||||||
@@ -362,10 +365,13 @@ class precompiled_wheel_utils:
|
|||||||
# try to fetch the wheel metadata from the nightly wheel repo
|
# try to fetch the wheel metadata from the nightly wheel repo
|
||||||
main_variant = "cu" + envs.VLLM_MAIN_CUDA_VERSION.replace(".", "")
|
main_variant = "cu" + envs.VLLM_MAIN_CUDA_VERSION.replace(".", "")
|
||||||
variant = os.getenv("VLLM_PRECOMPILED_WHEEL_VARIANT", main_variant)
|
variant = os.getenv("VLLM_PRECOMPILED_WHEEL_VARIANT", main_variant)
|
||||||
commit = os.getenv(
|
commit = os.getenv("VLLM_PRECOMPILED_WHEEL_COMMIT", "").lower()
|
||||||
"VLLM_PRECOMPILED_WHEEL_COMMIT",
|
if not commit or len(commit) != 40:
|
||||||
precompiled_wheel_utils.get_base_commit_in_main_branch(),
|
print(
|
||||||
)
|
f"VLLM_PRECOMPILED_WHEEL_COMMIT not valid: {commit}"
|
||||||
|
", trying to fetch base commit in main branch"
|
||||||
|
)
|
||||||
|
commit = precompiled_wheel_utils.get_base_commit_in_main_branch()
|
||||||
print(f"Using precompiled wheel commit {commit} with variant {variant}")
|
print(f"Using precompiled wheel commit {commit} with variant {variant}")
|
||||||
try_default = False
|
try_default = False
|
||||||
wheels, repo_url, download_filename = None, None, None
|
wheels, repo_url, download_filename = None, None, None
|
||||||
@@ -502,10 +508,6 @@ class precompiled_wheel_utils:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_base_commit_in_main_branch() -> str:
|
def get_base_commit_in_main_branch() -> str:
|
||||||
# Force to use the nightly wheel. This is mainly used for CI testing.
|
|
||||||
if envs.VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL:
|
|
||||||
return "nightly"
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Get the latest commit hash of the upstream main branch.
|
# Get the latest commit hash of the upstream main branch.
|
||||||
resp_json = subprocess.check_output(
|
resp_json = subprocess.check_output(
|
||||||
@@ -516,6 +518,7 @@ class precompiled_wheel_utils:
|
|||||||
]
|
]
|
||||||
).decode("utf-8")
|
).decode("utf-8")
|
||||||
upstream_main_commit = json.loads(resp_json)["sha"]
|
upstream_main_commit = json.loads(resp_json)["sha"]
|
||||||
|
print(f"Upstream main branch latest commit: {upstream_main_commit}")
|
||||||
|
|
||||||
# In Docker build context, .git may be immutable or missing.
|
# In Docker build context, .git may be immutable or missing.
|
||||||
if envs.VLLM_DOCKER_BUILD_CONTEXT:
|
if envs.VLLM_DOCKER_BUILD_CONTEXT:
|
||||||
|
|||||||
@@ -5,6 +5,10 @@
|
|||||||
set -e
|
set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
merge_base_commit=$(git merge-base HEAD origin/main)
|
||||||
|
echo "Current merge base commit with main: $merge_base_commit"
|
||||||
|
git show --oneline -s $merge_base_commit
|
||||||
|
|
||||||
cd /vllm-workspace/
|
cd /vllm-workspace/
|
||||||
|
|
||||||
# uninstall vllm
|
# uninstall vllm
|
||||||
@@ -18,7 +22,7 @@ apt autoremove -y
|
|||||||
|
|
||||||
echo 'import os; os.system("touch /tmp/changed.file")' >> vllm/__init__.py
|
echo 'import os; os.system("touch /tmp/changed.file")' >> vllm/__init__.py
|
||||||
|
|
||||||
VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL=1 VLLM_USE_PRECOMPILED=1 pip3 install -vvv -e .
|
VLLM_PRECOMPILED_WHEEL_COMMIT=$merge_base_commit VLLM_USE_PRECOMPILED=1 pip3 install -vvv -e .
|
||||||
|
|
||||||
# Run the script
|
# Run the script
|
||||||
python3 -c 'import vllm'
|
python3 -c 'import vllm'
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ if TYPE_CHECKING:
|
|||||||
VLLM_USE_PRECOMPILED: bool = False
|
VLLM_USE_PRECOMPILED: bool = False
|
||||||
VLLM_SKIP_PRECOMPILED_VERSION_SUFFIX: bool = False
|
VLLM_SKIP_PRECOMPILED_VERSION_SUFFIX: bool = False
|
||||||
VLLM_DOCKER_BUILD_CONTEXT: bool = False
|
VLLM_DOCKER_BUILD_CONTEXT: bool = False
|
||||||
VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL: bool = False
|
|
||||||
VLLM_KEEP_ALIVE_ON_ENGINE_DEATH: bool = False
|
VLLM_KEEP_ALIVE_ON_ENGINE_DEATH: bool = False
|
||||||
CMAKE_BUILD_TYPE: Literal["Debug", "Release", "RelWithDebInfo"] | None = None
|
CMAKE_BUILD_TYPE: Literal["Debug", "Release", "RelWithDebInfo"] | None = None
|
||||||
VERBOSE: bool = False
|
VERBOSE: bool = False
|
||||||
@@ -473,11 +472,6 @@ environment_variables: dict[str, Callable[[], Any]] = {
|
|||||||
.strip()
|
.strip()
|
||||||
.lower()
|
.lower()
|
||||||
in ("1", "true"),
|
in ("1", "true"),
|
||||||
# Whether to force using nightly wheel in python build.
|
|
||||||
# This is used for testing the nightly wheel in python build.
|
|
||||||
"VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL": lambda: bool(
|
|
||||||
int(os.getenv("VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL", "0"))
|
|
||||||
),
|
|
||||||
# CMake build type
|
# CMake build type
|
||||||
# If not set, defaults to "Debug" or "RelWithDebInfo"
|
# If not set, defaults to "Debug" or "RelWithDebInfo"
|
||||||
# Available options: "Debug", "Release", "RelWithDebInfo"
|
# Available options: "Debug", "Release", "RelWithDebInfo"
|
||||||
|
|||||||
Reference in New Issue
Block a user