vllm: first-class engine NODE (shows in engine/task page like nvidia/radeon)

When vllm.enabled, the front-proxy spawns a dedicated 'vllm' engine on the NVIDIA card(s)
with capability {vllm} only (mirrors the nvidia-gguf split) — a real subprocess, so it
appears in the engine/task page and routing/VRAM/thermal apply. Models pinned backend:vllm
route to it; vllm removed from the shared _DEFAULT_CAPS so no other node claims them.
vllm.gpu -> that node's CUDA_VISIBLE_DEVICES/CODERAI_ENGINE_GPUS. CUDA-only.
Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mw2KQiswmD69T45fTfjKwW
parent 714f66d0
...@@ -338,6 +338,29 @@ class EngineSupervisor: ...@@ -338,6 +338,29 @@ class EngineSupervisor:
name=f"{name}-gguf", backend="nvidia", env=dict(env), name=f"{name}-gguf", backend="nvidia", env=dict(env),
capabilities={"gguf"})) capabilities={"gguf"}))
next_id += 1 next_id += 1
# vLLM is a first-class engine NODE (not just a capability): when enabled, spawn a
# dedicated engine on the NVIDIA card(s) whose ONLY capability is "vllm", so it
# shows up in the engine/task page alongside nvidia/nvidia-gguf/radeon and the
# router sends it exactly the models pinned backend:vllm. It's a real subprocess
# (own process/CUDA context), so routing/VRAM/thermal apply like any engine. CUDA-
# only. Its VllmBackend launches+proxies the actual vLLM server per model.
vllm_cfg = getattr(self.config, "vllm", None)
if vllm_cfg is not None and getattr(vllm_cfg, "enabled", False) and nvidia_gpus():
venv = vendor_env("nvidia", allow_cross=False)
gpu = (getattr(vllm_cfg, "gpu", "") or "").strip()
if gpu:
venv["CUDA_VISIBLE_DEVICES"] = gpu
venv["CODERAI_ENGINE_GPUS"] = gpu
else:
sels = _gpu_selectors({"backend": "nvidia", "gpus": "nvidia"}, venv)
if sels:
venv["CODERAI_ENGINE_GPUS"] = ",".join(sels)
engines.append(Engine(
id=next_id, gpu=None, port=self._alloc_port(), primary=False,
name="vllm", backend="nvidia", env=venv, capabilities={"vllm"}))
next_id += 1
self._set_cosited_urls(engines) self._set_cosited_urls(engines)
return engines return engines
......
...@@ -44,11 +44,11 @@ def _short_stem(key: str) -> str: ...@@ -44,11 +44,11 @@ def _short_stem(key: str) -> str:
# k3 (kimi-k3-in-c) is a CPU engine → any node can host it; kt (ktransformers/SGLang) # k3 (kimi-k3-in-c) is a CPU engine → any node can host it; kt (ktransformers/SGLang)
# is CPU+GPU → the GPU-capable nodes. # is CPU+GPU → the GPU-capable nodes.
_DEFAULT_CAPS = { _DEFAULT_CAPS = {
"nvidia": {"transformers", "gguf", "whisper", "ds4", "colibri", "k3", "kt", "vllm"}, "nvidia": {"transformers", "gguf", "whisper", "ds4", "colibri", "k3", "kt"},
"cuda": {"transformers", "gguf", "whisper", "ds4", "colibri", "k3", "kt", "vllm"}, "cuda": {"transformers", "gguf", "whisper", "ds4", "colibri", "k3", "kt"},
"vulkan": {"gguf", "whisper", "k3"}, "vulkan": {"gguf", "whisper", "k3"},
"opencl": {"gguf", "whisper", "k3"}, "opencl": {"gguf", "whisper", "k3"},
"auto": {"transformers", "gguf", "whisper", "ds4", "colibri", "k3", "kt", "vllm"}, "auto": {"transformers", "gguf", "whisper", "ds4", "colibri", "k3", "kt"},
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment