Skip to content

Commit 05f8c06

Browse files
committed
Use image-installed plugin in Hygon CI
1 parent ce5c21b commit 05f8c06

1 file changed

Lines changed: 60 additions & 2 deletions

File tree

.github/scripts/hygon/setup.sh

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,77 @@ git config --global --add safe.directory "$(pwd)"
1515
: "${DEVICE_LIB_PATH:?DEVICE_LIB_PATH is not set}"
1616
: "${LD_LIBRARY_PATH:?LD_LIBRARY_PATH is not set}"
1717

18+
IMAGE_PLUGIN_ROOT="${VLLM_FL_IMAGE_PLUGIN_ROOT:-/opt/vllm-src/vllm-plugin-FL}"
19+
test -d "${IMAGE_PLUGIN_ROOT}/vllm_fl"
20+
21+
# The Hygon CI image already contains the validated plugin commit. Keep the
22+
# checkout available for tests and configs, but load vllm_fl from the image.
23+
HYGON_SITE_DIR="${RUNNER_TEMP:-/tmp}/hygon-python-site"
24+
mkdir -p "${HYGON_SITE_DIR}"
25+
cat > "${HYGON_SITE_DIR}/sitecustomize.py" <<'PY'
26+
import importlib.abc
27+
import importlib.util
28+
import os
29+
import sys
30+
from pathlib import Path
31+
32+
33+
class _ImageVllmFLFinder(importlib.abc.MetaPathFinder):
34+
def __init__(self, root):
35+
self.package_dir = Path(root) / "vllm_fl"
36+
37+
def find_spec(self, fullname, path=None, target=None):
38+
if fullname != "vllm_fl":
39+
return None
40+
init_file = self.package_dir / "__init__.py"
41+
if not init_file.exists():
42+
return None
43+
return importlib.util.spec_from_file_location(
44+
fullname,
45+
init_file,
46+
submodule_search_locations=[str(self.package_dir)],
47+
)
48+
49+
50+
_root = os.environ.get("VLLM_FL_IMAGE_PLUGIN_ROOT")
51+
if _root:
52+
sys.meta_path.insert(0, _ImageVllmFLFinder(_root))
53+
PY
54+
55+
export VLLM_FL_IMAGE_PLUGIN_ROOT="${IMAGE_PLUGIN_ROOT}"
56+
export PYTHONPATH="${HYGON_SITE_DIR}${PYTHONPATH:+:${PYTHONPATH}}"
57+
58+
if [[ -n "${GITHUB_ENV:-}" ]]; then
59+
{
60+
echo "VLLM_FL_IMAGE_PLUGIN_ROOT=${VLLM_FL_IMAGE_PLUGIN_ROOT}"
61+
echo "PYTHONPATH=${PYTHONPATH}"
62+
} >> "${GITHUB_ENV}"
63+
fi
64+
1865
echo "DTK_HOME=${DTK_HOME}"
1966
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
67+
echo "VLLM_FL_IMAGE_PLUGIN_ROOT=${VLLM_FL_IMAGE_PLUGIN_ROOT}"
68+
echo "PYTHONPATH=${PYTHONPATH}"
2069
test -e "${HIP_PATH}/lib/libgalaxyhip.so.5"
2170
test -e "${DTK_HOME}/llvm/lib/libomp.so"
2271

23-
python -m pip install --no-build-isolation --no-deps -e .
24-
2572
python - <<'PY'
73+
import os
74+
from pathlib import Path
75+
2676
import flag_gems
2777
import torch
2878
import vllm
2979
import vllm_fl
3080
81+
image_plugin_root = Path(os.environ["VLLM_FL_IMAGE_PLUGIN_ROOT"]).resolve()
82+
expected_package = image_plugin_root / "vllm_fl"
83+
plugin_file = Path(vllm_fl.__file__).resolve()
84+
if plugin_file != expected_package / "__init__.py" and expected_package not in plugin_file.parents:
85+
raise RuntimeError(
86+
f"Unexpected vllm_fl path: {plugin_file}; expected under {expected_package}"
87+
)
88+
3189
print(f"vLLM import ok: {vllm.__version__}")
3290
print(f"vLLM-FL import ok: {vllm_fl.__file__}")
3391
print(f"FlagGems import ok: {getattr(flag_gems, '__version__', 'unknown')}")

0 commit comments

Comments
 (0)