[diffusion] UX: fix CI server warmup progress logging (#34301)

This commit is contained in:
Mick
2026-08-11 09:09:32 +08:00
committed by GitHub
parent 418975ba64
commit ba5183fe10
2 changed files with 39 additions and 2 deletions
@@ -253,15 +253,16 @@ class SchedulerWarmupMixin:
refresh=False,
)
self._warmup_progress_bar.update(1)
progress_n = self._warmup_processed
if _is_ci_log_env():
logger.info(
"Warmup requests: %s/%s %s",
self._warmup_progress_bar.n,
progress_n,
self._warmup_progress_bar.total,
self._format_warmup_req(req_or_group),
)
if self._warmup_progress_bar.n >= self._warmup_progress_bar.total:
if progress_n >= self._warmup_progress_bar.total:
self._warmup_progress_bar.close()
self._warmup_progress_bar = None
@@ -0,0 +1,36 @@
"""Unit tests for server warmup progress reporting."""
import unittest
from unittest.mock import MagicMock, patch
from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import OutputBatch
from sglang.multimodal_gen.runtime.server_warmup import SchedulerWarmupMixin
class TestServerWarmupProgress(unittest.TestCase):
def test_ci_progress_uses_scheduler_counter_when_tqdm_is_disabled(self):
scheduler = SchedulerWarmupMixin()
scheduler._show_warmup_progress = True
scheduler._warmup_total = 1
scheduler._warmup_processed = 1
progress_bar = MagicMock(total=1, n=0)
scheduler._warmup_progress_bar = progress_bar
with (
patch(
"sglang.multimodal_gen.runtime.server_warmup._is_ci_log_env",
return_value=True,
),
patch("sglang.multimodal_gen.runtime.server_warmup.logger") as logger,
):
scheduler._advance_warmup_progress_bar(object(), OutputBatch())
logger.info.assert_called_once_with(
"Warmup requests: %s/%s %s", 1, 1, "warmup req"
)
progress_bar.close.assert_called_once_with()
self.assertIsNone(scheduler._warmup_progress_bar)
if __name__ == "__main__":
unittest.main()