Skip to content

vllm.v1.executor.multiproc_executor

Classes:

Functions:

ExceptionWithKVConnectorOutput

Bases: Exception

Carries a worker's KV connector output along with its failure.

FutureWrapper

Bases: Future

Methods:

  • wait_briefly –

    Wait for the oldest uncollected response, until pending is non-empty

wait_briefly(pending, deadline)

Wait for the oldest uncollected response, until pending is non-empty or time.monotonic() reaches deadline. Call after poll() returns False.

MultiprocExecutor

Bases: Executor

Methods:

  • collective_rpc –

    Returns single result if unique_reply_rank and/or an output

  • shutdown –

    Properly shut down the executor and its workers.

_can_start_workers_concurrently(inherited_fds)

Whether the local workers can be started from parallel threads.

Only safe with spawn (fork passes inherited fds from one worker to the next) and when nothing changes process-global state around each start: OpenMP env setup on the CPU backend and the NUMA numactl wrapper both patch os.environ / the multiprocessing executable per worker.

_ensure_worker_termination(worker_procs) staticmethod

Ensure that all worker processes are terminated. Assumes workers have received termination requests. Waits for processing, then sends termination and kill signals if needed.

_start_workers_concurrently(start_worker, unready_workers)

Start all local workers from threads, raising the first failure.

Every worker that did start is appended to unready_workers in rank order, even if another one failed or the caller was interrupted, so that cleanup terminates it.

collective_rpc(method, timeout=None, args=(), kwargs=None, non_block=False, unique_reply_rank=None, kv_output_aggregator=None, ec_output_aggregator=None)

Returns single result if unique_reply_rank and/or an output aggregator is provided, otherwise list.

shutdown()

Properly shut down the executor and its workers.

UnreadyWorkerProcHandle dataclass

WorkerProcess handle before READY.

WorkerProc

Wrapper that runs one Worker in a separate process.

Methods:

_execute_worker_rpc(rpc_request)

Execute one RPC in a separate frame from the dequeue loop.

async_output_busy_loop()

Entrypoint for the thread which handles outputs asynchronously.

enqueue_output(output)

Prepares output from the worker and enqueues it to the worker_response_mq. If the output is an Exception, it is converted to a FAILURE response.

handle_output(output)

Handles output from the worker. If async scheduling is enabled, it is passed to the async_output_busy_loop thread. Otherwise, it is enqueued directly to the worker_response_mq.

worker_busy_loop()

Main busy loop for Multiprocessing Workers.

worker_main(*args, **kwargs) staticmethod

Worker initialization and execution loops. This runs a background process

set_multiprocessing_worker_envs(local_world_size=1)

Set up environment variables that should be used when there are workers in a multiprocessing environment. This should be called by the parent process before worker processes are created