Unverified Commit d58a6881 authored by Ayush Agarwal's avatar Ayush Agarwal Committed by GitHub
Browse files

fix: remove omni dependency from dynamo.vllm path (#7683)


Signed-off-by: default avatarayushag <ayushag@nvidia.com>
parent f6e5023b
......@@ -34,7 +34,6 @@ from dynamo.llm import (
)
from dynamo.runtime import Endpoint
from dynamo.runtime.logging import configure_dynamo_logging
from dynamo.vllm.omni.args import OmniConfig
from dynamo.vllm.worker_factory import WorkerFactory
from . import envs
......@@ -184,7 +183,7 @@ async def worker() -> None:
def setup_metrics_collection(
config: Config | OmniConfig, generate_endpoint: Endpoint, logger: logging.Logger
config: Config, generate_endpoint: Endpoint, logger: logging.Logger
) -> None:
"""Set up metrics collection for vLLM and LMCache metrics.
......
......@@ -6,6 +6,7 @@
import json
import re
import socket
import sys
import warnings
from pathlib import Path
from types import SimpleNamespace
......@@ -558,3 +559,40 @@ class TestEnsureSideChannelHost:
):
with pytest.raises(RuntimeError, match="Unable to determine"):
ensure_side_channel_host()
# --- vllm_omni optional dependency tests ---
class TestVllmOmniOptionalDependency:
def test_dynamo_vllm_main_importable_without_vllm_omni(self):
"""dynamo.vllm.main must import cleanly even when vllm_omni is absent.
Setting sys.modules["vllm_omni"] = None blocks ALL imports from the
vllm_omni package — Python always resolves the top-level package first,
so a None sentinel at the root raises ImportError for any submodule import.
"""
# Save and evict any already-cached vllm_omni and dynamo.vllm.omni modules
saved = {
k: sys.modules.pop(k)
for k in list(sys.modules)
if k == "vllm_omni"
or k.startswith("vllm_omni.")
or k == "dynamo.vllm.main"
or k.startswith("dynamo.vllm.omni")
}
# Explicitly block the top-level vllm_omni package regardless of prior imports
sys.modules["vllm_omni"] = None # type: ignore[assignment]
try:
import dynamo.vllm.main # noqa: F401
except ImportError as e:
pytest.fail(f"dynamo.vllm.main has a hard dependency on vllm_omni: {e}")
finally:
sys.modules.pop("vllm_omni", None)
# Remove any modules imported during this test
for mod in list(sys.modules):
if mod == "dynamo.vllm.main" or mod.startswith("dynamo.vllm.omni"):
sys.modules.pop(mod, None)
# Restore original state
sys.modules.update(saved)
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