Skip to content

Commit

Permalink
Move metrics enable check to initialize()
Browse files Browse the repository at this point in the history
  • Loading branch information
kthui committed Dec 7, 2024
1 parent 96cece2 commit 94b80cd
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ def initialize(self, args):
)
self._is_healthy = True

# Check if metrics are enabled. The ZMQ process cannot be used when metrics are
# enabled.
self._enable_metrics = (
self._get_bool_config_param("REPORT_CUSTOM_METRICS")
and not self._aync_engine_args.disable_log_stats
)

# Starting the vLLM engine and its event thread running the AsyncIO event loop.
self._init_engine()

Expand Down Expand Up @@ -238,16 +245,10 @@ async def _run_llm_engine(self):
# Counter to keep track of ongoing request counts.
self._ongoing_request_count = 0

# Check if metrics are enabled. The ZMQ process cannot be used when metrics are
# enabled.
self._enable_metrics = (
self._get_bool_config_param("REPORT_CUSTOM_METRICS")
and not self._aync_engine_args.disable_log_stats
)

try:
# Start the vLLM engine. The engine lives for the scope of this with
# statement.
# TODO: Metrics should work with ZMQ enabled.
async with build_async_engine_client_from_engine_args(
engine_args=self._aync_engine_args,
disable_frontend_multiprocessing=self._enable_metrics,
Expand Down

0 comments on commit 94b80cd

Please sign in to comment.