Skip to content

vllm.v1.executor.ray_utils

Functions:

_verify_bundles(placement_group, parallel_config, device_str)

Warn if all tensor parallel workers cannot fit in a single node.

_wait_until_pg_ready(current_placement_group)

Wait until a placement group is ready.

It prints the informative log messages if the placement group is not created within time.

assert_ray_available()

Raise an exception if Ray is not available.

build_actor_name(instance_id, rank, tp_size, pp_size, pcp_size)

Build a descriptive Ray actor name for dashboard visibility.

get_bundles_for_indices(placement_group, bundle_indices, world_size)

Return GPU bundle indices paired with node IDs and node IPs for explicit bundle indices specified via VLLM_RAY_BUNDLE_INDICES.

get_bundles_sorted_by_node(placement_group)

Return GPU bundle indices paired with node IDs and node IPs, sorted driver-first.

This utility has to be invoked from the driver node.

Example: 3-node cluster, driver on node-A, PG bundles spread across nodes:

Input: [ (0, node-C), (1, node-A), (2, node-B), (3, node-C), (4, node-A), (5, node-B), ] Output: [ (1, node-A), (4, node-A), (2, node-B), (5, node-B), (0, node-C), (3, node-C), ]

init_ray(*args, **kwargs)

Call ray.init() and keep the caller's Python SIGTERM handler.

ray.init() replaces it with sys.exit() and Ray's C++ failure handler, which aborts the process 3 s after SIGTERM, so the caller's graceful shutdown would not get to kill its Ray actors.

initialize_ray_cluster(parallel_config, ray_address=None)

Initialize the distributed cluster with Ray.

it will connect to the Ray cluster and create a placement group for the workers, which includes the specification of the resources for each distributed worker.

Parameters:

  • parallel_config

    (ParallelConfig) –

    The configurations for parallel execution.

  • ray_address

    (str | None, default: None ) –

    The address of the Ray cluster. If None, uses the default Ray cluster address.

ray_is_available()

Returns True if Ray is available.