Skip to content

Commit

Permalink
Add method to ray gauge wrapper
Browse files Browse the repository at this point in the history
Signed-off-by: Kunjan Patel <[email protected]>
  • Loading branch information
coolkp committed Oct 29, 2024
1 parent dcb2439 commit 23740b2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vllm/engine/metrics.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 23740b2

Please sign in to comment.