[BugFix]Fix CI errors “ascend_transport.so: cannot open shared object file: No such file or directory” (#7242)

### What this PR does / why we need it?
Conditional Import for Mooncake: The import of
mooncake.engine.TransferEngine was moved into a try-except block within
the GlobalTE class's constructor. This ensures that mooncake is only
imported when needed and provides a clear error message with
installation instructions if it's missing.
### Does this PR introduce _any_ user-facing change?
The error message "ascend_transport.so: cannot open shared object file:
No such file or directory" in the CI is fixed to ensure the normal
running of the CI.

- vLLM version: v0.17.0
- vLLM main:
4034c3d32e

---------

Signed-off-by: 房建伟 <fangjianwei@fangjianweideMacBook-Air.local>
Co-authored-by: 房建伟 <fangjianwei@fangjianweideMacBook-Air.local>
This commit is contained in:
DreamerLeader
2026-03-14 21:23:05 +08:00
committed by GitHub
parent e7aa2c285c
commit 199df03524

View File

@@ -1,7 +1,5 @@
import threading
from mooncake.engine import TransferEngine # type: ignore
class GlobalTE:
def __init__(self):
@@ -15,8 +13,14 @@ class GlobalTE:
with self.transfer_engine_lock:
# Double-Checked Locking
if self.transfer_engine is None:
if TransferEngine is None:
raise RuntimeError("mooncake is not available")
try:
from mooncake.engine import TransferEngine # type: ignore
except ImportError as e:
raise ImportError(
"Please install mooncake by following the instructions at "
"https://github.com/kvcache-ai/Mooncake/blob/main/doc/en/build.md " # noqa: E501
"to run vLLM with MooncakeConnector."
) from e
self.transfer_engine = TransferEngine()
device_name = device_name if device_name is not None else ""
ret_value = self.transfer_engine.initialize(hostname, "P2PHANDSHAKE", "ascend", device_name)