@@ -22,7 +22,7 @@ class StatLoggerBase(ABC):
2222
2323 @abstractmethod
2424 def record (self , scheduler_stats : SchedulerStats ,
25- iteration_stats : IterationStats ):
25+ iteration_stats : Optional [ IterationStats ] ):
2626 ...
2727
2828 def log (self ): # noqa
@@ -56,10 +56,11 @@ def _get_throughput(self, tracked_stats: list[int], now: float) -> float:
5656 return float (np .sum (tracked_stats ) / (now - self .last_log_time ))
5757
5858 def record (self , scheduler_stats : SchedulerStats ,
59- iteration_stats : IterationStats ):
59+ iteration_stats : Optional [ IterationStats ] ):
6060 """Log Stats to standard output."""
6161
62- self ._track_iteration_stats (iteration_stats )
62+ if iteration_stats :
63+ self ._track_iteration_stats (iteration_stats )
6364
6465 self .prefix_caching_metrics .observe (scheduler_stats .prefix_cache_stats )
6566
@@ -319,7 +320,7 @@ def log_metrics_info(self, type: str, config_obj: SupportsMetricsInfo):
319320 info_gauge .set (1 )
320321
321322 def record (self , scheduler_stats : SchedulerStats ,
322- iteration_stats : IterationStats ):
323+ iteration_stats : Optional [ IterationStats ] ):
323324 """Log to prometheus."""
324325 self .gauge_scheduler_running .set (scheduler_stats .num_running_reqs )
325326 self .gauge_scheduler_waiting .set (scheduler_stats .num_waiting_reqs )
@@ -331,6 +332,9 @@ def record(self, scheduler_stats: SchedulerStats,
331332 self .counter_gpu_prefix_cache_hits .inc (
332333 scheduler_stats .prefix_cache_stats .hits )
333334
335+ if iteration_stats is None :
336+ return
337+
334338 self .counter_num_preempted_reqs .inc (iteration_stats .num_preempted_reqs )
335339 self .counter_prompt_tokens .inc (iteration_stats .num_prompt_tokens )
336340 self .counter_generation_tokens .inc (
0 commit comments