[Bugfix] Disable the statslogger if the api_server_count is greater than 1 (#22227)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Co-authored-by: Nick Hill <nhill@redhat.com>
This commit is contained in:
Chauncey 2025-09-09 06:28:03 +08:00 committed by GitHub
parent 620db1fc58
commit e680723eba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -143,6 +143,7 @@ class AsyncLLM(EngineClient):
engine_idxs=self.engine_core.engine_ranks_managed,
custom_stat_loggers=stat_loggers,
enable_default_loggers=log_stats,
client_count=client_count,
)
self.logger_manager.log_engine_initialized()

View File

@ -652,6 +652,7 @@ class StatLoggerManager:
engine_idxs: Optional[list[int]] = None,
custom_stat_loggers: Optional[list[StatLoggerFactory]] = None,
enable_default_loggers: bool = True,
client_count: int = 1,
):
self.engine_idxs = engine_idxs if engine_idxs else [0]
@ -660,7 +661,12 @@ class StatLoggerManager:
factories.extend(custom_stat_loggers)
if enable_default_loggers and logger.isEnabledFor(logging.INFO):
factories.append(LoggingStatLogger)
if client_count > 1:
logger.warning(
"AsyncLLM created with api_server_count more than 1; "
"disabling stats logging to avoid incomplete stats.")
else:
factories.append(LoggingStatLogger)
# engine_idx: StatLogger
self.per_engine_logger_dict: dict[int, list[StatLoggerBase]] = {}