enginex-bi100-compat: 改为拦截 vllm 二进制(对齐 zhengzhongwei/vLLM-Iluvatar_bi-100-opt 模式),平台命令无需改动

This commit is contained in:
2026-10-03 19:22:42 +08:00
parent f67e569d0c
commit 1e44811d11

View File

@@ -25,7 +25,7 @@ import tempfile
HERE = os.path.dirname(os.path.abspath(__file__))
PREFLIGHT = os.path.join(HERE, "preflight.py")
ENTRYPOINT = os.path.join(HERE, "entrypoint.sh")
WRAPPER = os.path.join(HERE, "vllm_wrapper.sh")
DETECT = os.path.join(HERE, "detect_tokenizer.py")
PASS, FAIL = [], []
@@ -163,11 +163,13 @@ def main():
# ---- 9:entrypoint 语法 + detect ----
print("[8] entrypoint.sh / detect_tokenizer.py")
p = subprocess.run(["bash", "-n", "entrypoint.sh"], capture_output=True, text=True, cwd=HERE)
check("entrypoint.sh bash 语法正确", p.returncode == 0, p.stderr[:200])
shutil.copy2(ENTRYPOINT, os.path.join(tmp, "ep.sh"))
p1 = subprocess.run(["bash", "-n", "ep.sh"], capture_output=True, text=True, cwd=tmp)
check("entrypoint.sh 复制后语法仍正确", p1.returncode == 0, p1.stderr[:200])
p1 = subprocess.run(["bash", "-n", "vllm_wrapper.sh"], capture_output=True, text=True, cwd=HERE)
check("vllm_wrapper.sh bash 语法正确", p1.returncode == 0, p1.stderr[:200])
# wrapper 必须拦截 serve 且不外改其它子命令
wr = io.open(os.path.join(HERE, "vllm_wrapper.sh"), encoding="utf-8").read()
check("wrapper 拦截 serve <model_dir>", 'serve' in wr and 'MODEL_DIR="$2"' in wr)
check("wrapper 里 preflight 失败不阻断(有 try/兜底)", 'preflight 非 0 退出' in wr)
check("wrapper 最终 exec 的是 vllm_real", 'exec "$REAL" serve' in wr)
p2 = subprocess.run([sys.executable, DETECT, d], capture_output=True, text=True)
check("detect_tokenizer 可执行且报 fast", "fast" in p2.stdout, p2.stdout[:100] + p2.stderr[:200])