@@ -22,7 +22,7 @@ class StatLoggerBase(ABC):
22
22
23
23
@abstractmethod
24
24
def record (self , scheduler_stats : SchedulerStats ,
25
- iteration_stats : IterationStats ):
25
+ iteration_stats : Optional [ IterationStats ] ):
26
26
...
27
27
28
28
def log (self ): # noqa
@@ -56,10 +56,11 @@ def _get_throughput(self, tracked_stats: list[int], now: float) -> float:
56
56
return float (np .sum (tracked_stats ) / (now - self .last_log_time ))
57
57
58
58
def record (self , scheduler_stats : SchedulerStats ,
59
- iteration_stats : IterationStats ):
59
+ iteration_stats : Optional [ IterationStats ] ):
60
60
"""Log Stats to standard output."""
61
61
62
- self ._track_iteration_stats (iteration_stats )
62
+ if iteration_stats :
63
+ self ._track_iteration_stats (iteration_stats )
63
64
64
65
self .prefix_caching_metrics .observe (scheduler_stats .prefix_cache_stats )
65
66
@@ -319,7 +320,7 @@ def log_metrics_info(self, type: str, config_obj: SupportsMetricsInfo):
319
320
info_gauge .set (1 )
320
321
321
322
def record (self , scheduler_stats : SchedulerStats ,
322
- iteration_stats : IterationStats ):
323
+ iteration_stats : Optional [ IterationStats ] ):
323
324
"""Log to prometheus."""
324
325
self .gauge_scheduler_running .set (scheduler_stats .num_running_reqs )
325
326
self .gauge_scheduler_waiting .set (scheduler_stats .num_waiting_reqs )
@@ -331,6 +332,9 @@ def record(self, scheduler_stats: SchedulerStats,
331
332
self .counter_gpu_prefix_cache_hits .inc (
332
333
scheduler_stats .prefix_cache_stats .hits )
333
334
335
+ if iteration_stats is None :
336
+ return
337
+
334
338
self .counter_num_preempted_reqs .inc (iteration_stats .num_preempted_reqs )
335
339
self .counter_prompt_tokens .inc (iteration_stats .num_prompt_tokens )
336
340
self .counter_generation_tokens .inc (
0 commit comments