[minor] sync code on python/sglang/test/test_deterministic.py and improve ci tests (#11777)

Co-authored-by: Stefan He <hebiaobuaa@gmail.com>
Co-authored-by: Byron Hsu <byronhsu1230@gmail.com>
This commit is contained in:
Lianmin Zheng
2025-10-17 14:25:22 -07:00
committed by GitHub
co-authored by Stefan He Byron Hsu
parent 20b8d2306c
commit b9a54e0968
9 changed files with 264 additions and 39 deletions
+13
View File
@@ -150,6 +150,9 @@ class SchedulerStats:
engine_startup_time: float = 0.0
engine_load_weights_time: float = 0.0
# CUDA graph
is_cuda_graph: float = 0.0
class SchedulerMetricsCollector:
@@ -499,6 +502,13 @@ class SchedulerMetricsCollector:
labelnames=list(labels.keys()) + ["stage"],
)
self.is_cuda_graph = Gauge(
name="sglang:is_cuda_graph",
documentation="Whether the batch is using CUDA graph.",
labelnames=labels.keys(),
multiprocess_mode="mostrecent",
)
def _log_gauge(self, gauge, data: Union[int, float]) -> None:
# Convenience function for logging to gauge.
gauge.labels(**self.labels).set(data)
@@ -574,6 +584,9 @@ class SchedulerMetricsCollector:
self.engine_load_weights_time, stats.engine_load_weights_time
)
# CUDA graph
self._log_gauge(self.is_cuda_graph, stats.is_cuda_graph)
self.last_log_time = time.perf_counter()
def log_grammar_stats(self, grammar_stats) -> None: