vllm.v1.engine.core_client
¶
Classes:
-
AsyncMPClient–Asyncio-compatible client for multi-proc EngineCore.
-
BackgroundResources–Used as a finalizer for clean shutdown, avoiding
-
DPAsyncMPClient–Asyncio-compatible client for multi-proc, multi-engine (data parallel)
-
DPLBAsyncMPClient–Asyncio-compatible client for multi-proc, multi-engine (data parallel)
-
EngineCoreClient–EngineCoreClient: subclasses handle different methods for pushing
-
InprocClient–InprocClient: client for in-process EngineCore. Intended
-
MPClient–MPClient: base client for multi-proc EngineCore.
-
SyncMPClient–Synchronous client for multi-proc EngineCore.
AsyncMPClient
¶
Bases: MPClient
Asyncio-compatible client for multi-proc EngineCore.
Attributes:
-
engine_status(dict) –Cached FT status entry of the managed engine.
engine_status
property
¶
Cached FT status entry of the managed engine.
BackgroundResources
dataclass
¶
DPAsyncMPClient
¶
Bases: AsyncMPClient
Asyncio-compatible client for multi-proc, multi-engine (data parallel) EngineCore. Assumes external load-balancing by default.
DPLBAsyncMPClient
¶
Bases: DPAsyncMPClient
Asyncio-compatible client for multi-proc, multi-engine (data parallel) EngineCore. Load-balances between multiple engine processes.
Methods:
-
commit_elastic_ep–Commit prepared elastic EP scaling.
-
prepare_elastic_ep–Prepare elastic EP scaling without routing requests to new engines.
_commit_scale_down_elastic_ep(new_data_parallel_size)
async
¶
Scale down the data parallel size by shutting down and reconfiguring existing engine cores.
_eep_wait_for_setup_switch_complete()
¶
Wait for core engines to switch to the new setup.
In eep_process_engine_core_notification(), a dummy UtilityOutput with EEP_NOTIFICATION_CALL_ID will be set when RECONFIGURE_FINISHED notification is received from engine 0. We create a future with that call_id and wait for it to be resolved.
_prepare_scale_up_elastic_ep(new_data_parallel_size, num_redundant_experts)
async
¶
Prepare scale up by creating new engine cores and reconfiguring existing ones.
commit_elastic_ep()
async
¶
Commit prepared elastic EP scaling.
prepare_elastic_ep(new_data_parallel_size)
async
¶
Prepare elastic EP scaling without routing requests to new engines.
EngineCoreClient
¶
Bases: ABC
subclasses handle different methods for pushing
and pulling from the EngineCore for asyncio / multiprocessing.
Subclasses: * InprocClient: In process EngineCore (for V0-style LLMEngine use) * SyncMPClient: ZMQ + background proc EngineCore (for LLM) * AsyncMPClient: ZMQ + background proc EngineCore w/ asyncio (for AsyncLLM)
Methods:
-
dp_engines_running–Returns True if data parallel engines are collectively in a
-
get_kv_event_sources–KV-event publisher config of each ready engine, keyed by DP rank.
InprocClient
¶
Bases: EngineCoreClient
InprocClient: client for in-process EngineCore. Intended for use in LLMEngine for V0-style add_request() and step() EngineCore setup in this process (no busy loop).
* pushes EngineCoreRequest directly into the EngineCore
* pulls EngineCoreOutputs by stepping the EngineCore
MPClient
¶
Bases: EngineCoreClient
MPClient: base client for multi-proc EngineCore. EngineCore runs in a background process busy loop, getting new EngineCoreRequests and returning EngineCoreOutputs
- pushes EngineCoreRequests via input_socket
-
pulls EngineCoreOutputs via output_socket
-
AsyncMPClient subclass for AsyncLLM usage
- SyncMPClient subclass for LLM usage
Methods:
-
shutdown–Shutdown engine manager under timeout and clean up resources.
-
start_engine_core_monitor–Start a monitor thread for engine core processes.
_apply_ready_response(payload)
¶
Decode an EngineCoreReadyResponse and sync any post-initialization config changes (e.g. auto-fitted max_model_len) back to the frontend.
_format_exception(e)
¶
If errored, use EngineDeadError so root cause is clear.
shutdown(timeout=None)
¶
Shutdown engine manager under timeout and clean up resources.
start_engine_core_monitor()
¶
Start a monitor thread for engine core processes.
_process_utility_output(output, utility_results)
¶
Set the result from a utility method in the waiting future.
_with_packed_prompt(request)
¶
Copy of request with its prompt token ids as an int32 ndarray, which is sent out of band when long and decoded by the engine without a Python int per token. The frontend keeps the original.