[diffusion] UX: fix CI server warmup progress logging (#34301)
This commit is contained in:
@@ -253,15 +253,16 @@ class SchedulerWarmupMixin:
|
|||||||
refresh=False,
|
refresh=False,
|
||||||
)
|
)
|
||||||
self._warmup_progress_bar.update(1)
|
self._warmup_progress_bar.update(1)
|
||||||
|
progress_n = self._warmup_processed
|
||||||
if _is_ci_log_env():
|
if _is_ci_log_env():
|
||||||
logger.info(
|
logger.info(
|
||||||
"Warmup requests: %s/%s %s",
|
"Warmup requests: %s/%s %s",
|
||||||
self._warmup_progress_bar.n,
|
progress_n,
|
||||||
self._warmup_progress_bar.total,
|
self._warmup_progress_bar.total,
|
||||||
self._format_warmup_req(req_or_group),
|
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.close()
|
||||||
self._warmup_progress_bar = None
|
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()
|
||||||
Reference in New Issue
Block a user