From 23740b2544e9263773dbc6f75958e31d76265565 Mon Sep 17 00:00:00 2001 From: Kunjan Patel Date: Tue, 29 Oct 2024 01:43:56 +0000 Subject: [PATCH] Add method to ray gauge wrapper Signed-off-by: Kunjan Patel --- vllm/engine/metrics.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vllm/engine/metrics.py b/vllm/engine/metrics.py index 508f861eb1200..65f42820959a2 100644 --- a/vllm/engine/metrics.py +++ b/vllm/engine/metrics.py @@ -1,3 +1,4 @@ +import time from typing import TYPE_CHECKING from typing import Counter as CollectionsCounter from typing import Dict, List, Optional, Type, Union, cast @@ -229,6 +230,10 @@ def labels(self, **labels): def set(self, value: Union[int, float]): return self._gauge.set(value) + def set_to_current_time(self): + # ray metrics doesn't have set_to_current time, https://docs.ray.io/en/latest/_modules/ray/util/metrics.html + return self._gauge.set(time.time()) + class _RayCounterWrapper: """Wraps around ray.util.metrics.Counter to provide same API as