Skip to content

vllm.v1.executor

Modules:

Classes:

Executor

Bases: ABC

Abstract base class for vLLM executors.

An executor is responsible for executing the model on one device, or it can be a distributed executor that can execute the model on multiple devices.

Methods:

check_health() abstractmethod

Checks if the executor is healthy. If not, it should raise an exception.

collective_rpc(method, timeout=None, args=(), kwargs=None, non_block=False) abstractmethod

collective_rpc(
    method: str | Callable[[WorkerBase], _R],
    timeout: float | None = None,
    args: tuple = (),
    kwargs: dict | None = None,
    non_block: Literal[False] = False,
) -> list[_R]
collective_rpc(
    method: str | Callable[[WorkerBase], _R],
    timeout: float | None = None,
    args: tuple = (),
    kwargs: dict | None = None,
    non_block: Literal[True] = True,
) -> Future[list[_R]]

Execute an RPC call on all workers.

Parameters:

  • method

    (str | Callable[[WorkerBase], _R]) –

    Name of the worker method to execute, or a callable that is serialized and sent to all workers to execute.

    If the method is a callable, it should accept an additional self argument, in addition to the arguments passed in args and kwargs. The self argument will be the worker object.

  • timeout

    (float | None, default: None ) –

    Maximum time in seconds to wait for execution. Raises a TimeoutError on timeout. None means wait indefinitely.

  • args

    (tuple, default: () ) –

    Positional arguments to pass to the worker method.

  • kwargs

    (dict | None, default: None ) –

    Keyword arguments to pass to the worker method.

  • non_block

    (bool, default: False ) –

    If True, returns a list of Futures instead of waiting for the results.

Returns:

  • list[_R] | Future[list[_R]] –

    A list containing the results from each worker.

Note

It is recommended to use this API to only pass control messages, and set up data-plane communication to pass data.

compile_or_warm_up_model()

Compile/warm up the model and capture cudagraphs on workers.

disable_extensible_kv_cache(reason)

Turn the extensible KV cache off here and on every worker.

execute_dummy_batch()

Returns the iteration records the output worker has completed.

extend_kv_cache(num_blocks)

Commit the final size of an extensible KV cache on the workers.

extensible_kv_cache_unsupported_reason(layer_configs)

Why the extensible KV cache cannot be used on some worker, if so.

get_supported_kv_cache_layouts()

Layouts each worker's backends support, most preferred first.

init_kv_output_aggregator(connector)

Init KVOutputAggregator.

initialize_from_config(kv_cache_configs)

Initialize the KV caches on the underlying workers.

register_failure_callback(callback)

Register a function to be called if the executor enters a permanent failed state.

reset_encoder_cache()

Reset the encoder cache in each worker to clear cached encoder outputs.

reset_mm_cache()

Reset the multi-modal cache in each worker.

set_kv_cache_layout(layout_name, cp_kv_cache_interleave_size)

Publish the resolved KV cache layout and CP interleave size.

set_mamba_block_size(mamba_block_size)

Publish the Mamba block size resolved for the whole model.

shutdown()

Shutdown the executor.

supports_async_scheduling() classmethod

Whether the executor supports async scheduling.

UniProcExecutor

Bases: Executor

_distributed_args()

Return (distributed_init_method, rank, local_rank).

_init_executor()

Initialize the worker and load the model.