Skip to content

Commit 9a7ca6b

Browse files
Isotr0pylulmer
authored andcommitted
[Build] Add nightly wheel fallback when latest commit wheel unavailable (vllm-project#14358)
Signed-off-by: Isotr0py <[email protected]> Signed-off-by: Louis Ulmer <[email protected]>
1 parent 0141e1b commit 9a7ca6b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

setup.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ def is_ninja_available() -> bool:
6969
return which("ninja") is not None
7070

7171

72+
def is_url_available(url: str) -> bool:
73+
from urllib.request import urlopen
74+
75+
status = None
76+
try:
77+
with urlopen(url) as f:
78+
status = f.status
79+
except Exception:
80+
return False
81+
return status == 200
82+
83+
7284
class CMakeExtension(Extension):
7385

7486
def __init__(self, name: str, cmake_lists_dir: str = '.', **kwa) -> None:
@@ -320,6 +332,10 @@ def run(self) -> None:
320332
if wheel_location is None:
321333
base_commit = self.get_base_commit_in_main_branch()
322334
wheel_location = f"https://wheels.vllm.ai/{base_commit}/vllm-1.0.0.dev-cp38-abi3-manylinux1_x86_64.whl"
335+
# Fallback to nightly wheel if latest commit wheel is unavailable,
336+
# in this rare case, the nightly release CI hasn't finished on main.
337+
if not is_url_available(wheel_location):
338+
wheel_location = "https://wheels.vllm.ai/nightly/vllm-1.0.0.dev-cp38-abi3-manylinux1_x86_64.whl"
323339

324340
import zipfile
325341

0 commit comments

Comments
 (0)