[Revert] Revert "[Log] Wire stat loggers into AsyncOmniEngine to match AsyncLL… (#2716)
Signed-off-by: amy-why-3459 <wuhaiyan17@huawei.com>
This commit is contained in:
1 parent
22261430b4
commit
2b70e89535
6 files changed
+8
-144
No files matched your search
@@ -31,7 +31,6 @@ from vllm.logger import init_logger
|
||||
from vllm.tokenizers import cached_tokenizer_from_config
|
||||
from vllm.v1.engine import EngineCoreRequest
|
||||
from vllm.v1.engine.input_processor import InputProcessor
|
||||
from vllm.v1.metrics.loggers import StatLoggerManager
|
||||
|
||||
from vllm_omni.diffusion.data import DiffusionParallelConfig
|
||||
from vllm_omni.diffusion.stage_diffusion_client import StageDiffusionClient
|
||||
@@ -285,7 +284,6 @@ class AsyncOmniEngine:
|
||||
self.num_stages = len(self.stage_configs)
|
||||
stage0_args = getattr(self.stage_configs[0], "engine_args", None) if self.num_stages > 0 else None
|
||||
self.async_chunk = bool(getattr(stage0_args, "async_chunk", False))
|
||||
self.log_stats = not bool(getattr(stage0_args, "disable_log_stats", False))
|
||||
self.stage_clients: list[Any] = []
|
||||
self.stage_vllm_configs: list[Any] = []
|
||||
self.output_processors: list[MultimodalOutputProcessor | None] = []
|
||||
@@ -415,7 +413,7 @@ class AsyncOmniEngine:
|
||||
addresses, proc, handshake_address = spawn_stage_core(
|
||||
vllm_config=vllm_config,
|
||||
executor_class=executor_class,
|
||||
log_stats=self.log_stats,
|
||||
log_stats=False,
|
||||
)
|
||||
started_stage = StartedLlmStage(
|
||||
stage_id=metadata.stage_id,
|
||||
@@ -617,7 +615,7 @@ class AsyncOmniEngine:
|
||||
)
|
||||
output_processor = MultimodalOutputProcessor(
|
||||
tokenizer=tokenizer,
|
||||
log_stats=self.log_stats,
|
||||
log_stats=False,
|
||||
engine_core_output_type=started.metadata.engine_output_type,
|
||||
)
|
||||
input_processor = None
|
||||
@@ -872,30 +870,6 @@ class AsyncOmniEngine:
|
||||
self.default_sampling_params_list = default_sampling_params_list
|
||||
self.stage_metadata = stage_metadata
|
||||
|
||||
# Single StatLoggerManager for the whole pipeline, mirroring how
|
||||
# vLLM AsyncLLM uses one manager with multiple engine indices for DP.
|
||||
# We treat each stage as a separate "engine_idx" so logs are
|
||||
# distinguishable as "Engine 000/001/002/...". Using a single manager
|
||||
# also avoids PrometheusStatLogger registry collisions.
|
||||
self.logger_manager: StatLoggerManager | None = None
|
||||
if self.log_stats:
|
||||
base_vllm_config = next(
|
||||
(cfg for cfg in self.stage_vllm_configs if cfg is not None),
|
||||
None,
|
||||
)
|
||||
if base_vllm_config is not None:
|
||||
try:
|
||||
self.logger_manager = StatLoggerManager(
|
||||
vllm_config=base_vllm_config,
|
||||
engine_idxs=list(range(self.num_stages)),
|
||||
custom_stat_loggers=None,
|
||||
enable_default_loggers=True,
|
||||
)
|
||||
self.logger_manager.log_engine_initialized()
|
||||
except Exception:
|
||||
logger.exception("[AsyncOmniEngine] Failed to build StatLoggerManager")
|
||||
self.logger_manager = None
|
||||
|
||||
def _initialize_janus_queues(self) -> None:
|
||||
"""Initialize janus queues inside orchestrator thread loop context."""
|
||||
self.request_queue = janus.Queue()
|
||||
@@ -912,10 +886,6 @@ class AsyncOmniEngine:
|
||||
|
||||
loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
# Expose the orchestrator loop so other threads (API server) can
|
||||
# schedule coroutines onto it via run_coroutine_threadsafe, keeping
|
||||
# single-threaded access to StatLoggerManager (mirrors AsyncLLM).
|
||||
self.orchestrator_loop = loop
|
||||
|
||||
async def _run_orchestrator() -> None:
|
||||
self._initialize_janus_queues()
|
||||
@@ -929,7 +899,6 @@ class AsyncOmniEngine:
|
||||
stage_clients=self.stage_clients,
|
||||
output_processors=self.output_processors,
|
||||
stage_vllm_configs=self.stage_vllm_configs,
|
||||
logger_manager=self.logger_manager,
|
||||
)
|
||||
if not startup_future.done():
|
||||
startup_future.set_result(asyncio.get_running_loop())
|
||||
@@ -1554,29 +1523,6 @@ class AsyncOmniEngine:
|
||||
"""Async abort API."""
|
||||
self.abort(request_ids)
|
||||
|
||||
async def do_log_stats(self) -> None:
|
||||
"""Flush the StatLoggerManager on the orchestrator thread.
|
||||
|
||||
``StatLoggerManager`` is only safe to access from the orchestrator
|
||||
loop (where ``record()`` runs). Schedule ``log()`` onto that loop
|
||||
via ``run_coroutine_threadsafe`` so all access stays single-threaded,
|
||||
matching upstream vLLM ``AsyncLLM``.
|
||||
"""
|
||||
manager = self.logger_manager
|
||||
if manager is None:
|
||||
return
|
||||
loop = getattr(self, "orchestrator_loop", None)
|
||||
if loop is None or not loop.is_running():
|
||||
return
|
||||
|
||||
async def _log() -> None:
|
||||
manager.log()
|
||||
|
||||
try:
|
||||
await asyncio.wrap_future(asyncio.run_coroutine_threadsafe(_log(), loop))
|
||||
except Exception:
|
||||
logger.exception("[AsyncOmniEngine] do_log_stats failed")
|
||||
|
||||
def collective_rpc(
|
||||
self,
|
||||
method: str,
|
||||
|
||||
Reference in new issue
Block a user