@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / d1fb65bde3
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 01:00 UTC

Enable v1 metrics tests (#20953)

Signed-off-by: Seiji Eicher <seiji@anyscale.com>

Seiji Eicher committed Jul 19, 2025 at 20:22 UTC d1fb65bde367aa6e3d72520c84b60be3d1539917
3 files changed +20 -7
.buildkite/test-pipeline.yaml
+1
@@ -264,6 +264,7 @@ steps:
264 - pytest -v -s v1/structured_output
265 - pytest -v -s v1/spec_decode
266 - pytest -v -s v1/kv_connector/unit
267 + - pytest -v -s v1/metrics
268 - pytest -v -s v1/test_serial_utils.py
269 - pytest -v -s v1/test_utils.py
270 - pytest -v -s v1/test_oracle.py
tests/v1/metrics/test_ray_metrics.py
+12 -6
@@ -1,8 +1,11 @@
1 # SPDX-License-Identifier: Apache-2.0
2 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 +import os
4 +
5 import pytest
6 import ray
7
8 +from vllm.config import ModelDType
9 from vllm.sampling_params import SamplingParams
10 from vllm.v1.engine.async_llm import AsyncEngineArgs, AsyncLLM
11 from vllm.v1.metrics.ray_wrappers import RayPrometheusStatLogger
@@ -27,7 +30,7 @@ MODELS = [
30 def test_engine_log_metrics_ray(
31 example_prompts,
32 model: str,
30 - dtype: str,
33 + dtype: ModelDType,
34 max_tokens: int,
35 ) -> None:
36 """ Simple smoke test, verifying this can be used without exceptions.
@@ -37,11 +40,14 @@ def test_engine_log_metrics_ray(
40 class EngineTestActor:
41
42 async def run(self):
40 - engine_args = AsyncEngineArgs(
41 - model=model,
42 - dtype=dtype,
43 - disable_log_stats=False,
44 - )
43 + # Set environment variable inside the Ray actor since environment
44 + # variables from pytest fixtures don't propagate to Ray actors
45 + os.environ['VLLM_USE_V1'] = '1'
46 +
47 + engine_args = AsyncEngineArgs(model=model,
48 + dtype=dtype,
49 + disable_log_stats=False,
50 + enforce_eager=True)
51
52 engine = AsyncLLM.from_engine_args(
53 engine_args, stat_loggers=[RayPrometheusStatLogger])
vllm/v1/metrics/ray_wrappers.py
+7 -1
@@ -51,7 +51,13 @@ class RayGaugeWrapper(RayPrometheusMetric):
51 def __init__(self,
52 name: str,
53 documentation: Optional[str] = "",
54 - labelnames: Optional[list[str]] = None):
54 + labelnames: Optional[list[str]] = None,
55 + multiprocess_mode: Optional[str] = ""):
56 +
57 + # All Ray metrics are keyed by WorkerId, so multiprocess modes like
58 + # "mostrecent", "all", "sum" do not apply. This logic can be manually
59 + # implemented at the observability layer (Prometheus/Grafana).
60 + del multiprocess_mode
61 labelnames_tuple = tuple(labelnames) if labelnames else None
62 self.metric = ray_metrics.Gauge(name=name,
63 description=documentation,