Skip to content

Commit 9690e43

Browse files
committed
comment
Signed-off-by: Cody Yu <hao.yu.cody@gmail.com>
1 parent fac241e commit 9690e43

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

vllm/executor/ray_utils.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,9 @@ def initialize_ray_cluster(
284284
assert_ray_available()
285285
from vllm.platforms import current_platform
286286

287-
# Connect to a ray cluster.
288-
if current_platform.is_rocm() or current_platform.is_xpu():
287+
if ray.is_initialized():
288+
logger.info("Ray is already initialized. Skipping Ray initialization.")
289+
elif current_platform.is_rocm() or current_platform.is_xpu():
289290
# Try to connect existing ray instance and create a new one if not found
290291
try:
291292
ray.init("auto", ignore_reinit_error=True)
@@ -312,6 +313,8 @@ def initialize_ray_cluster(
312313
current_placement_group = ray.util.get_current_placement_group()
313314

314315
if current_placement_group:
316+
logger.info("Using the existing placement group")
317+
315318
# We are in a placement group
316319
bundles = current_placement_group.bundle_specs
317320
# Verify that we can use the placement group.
@@ -331,6 +334,8 @@ def initialize_ray_cluster(
331334
f"Required number of devices: {parallel_config.world_size}. "
332335
f"Total number of devices: {device_bundles}.")
333336
else:
337+
logger.info("No current placement group found. "
338+
"Creating a new placement group.")
334339
num_devices_in_cluster = ray.cluster_resources().get(device_str, 0)
335340
# Log a warning message and delay resource allocation failure response.
336341
# Avoid immediate rejection to allow user-initiated placement group

0 commit comments

Comments
 (0)