From c60dcc40bb241e5269c4bf33ae7a0495e7367f6c Mon Sep 17 00:00:00 2001 From: Liangsheng Yin Date: Wed, 25 Feb 2026 13:31:52 -0800 Subject: [PATCH] [Logging] Guard `log_prefill_stats` against idle batches in disagg prefill (#19361) --- python/sglang/srt/disaggregation/prefill.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/sglang/srt/disaggregation/prefill.py b/python/sglang/srt/disaggregation/prefill.py index 36f44bb10..a42cbe771 100644 --- a/python/sglang/srt/disaggregation/prefill.py +++ b/python/sglang/srt/disaggregation/prefill.py @@ -535,7 +535,7 @@ class SchedulerDisaggregationPrefillMixin: self.maybe_send_health_check_signal() - if self.current_scheduler_metrics_enabled: + if self.current_scheduler_metrics_enabled and batch.prefill_stats is not None: can_run_cuda_graph = getattr(result, "can_run_cuda_graph", False) self.log_prefill_stats( prefill_stats=batch.prefill_stats,