[Bugfix] Set breakable graph env before Ray actor import (#53293)

Signed-off-by: Ace Eldeib <aeldeib@coreweave.com>
Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Ace Eldeib
2026-08-28 23:11:50 +00:00
committed by GitHub
co-authored by Codex
parent ae5b8e4a8d
commit 9662ab0835
4 changed files with 51 additions and 2 deletions
+15
View File
@@ -4,6 +4,8 @@ import os
from vllm.ray.ray_env import RAY_NON_CARRY_OVER_ENV_VARS
_RAY_WORKER_PRE_IMPORT_ENV_VARS = frozenset({"VLLM_USE_BREAKABLE_CUDAGRAPH"})
def get_driver_env_vars(
worker_specific_vars: set[str],
@@ -16,3 +18,16 @@ def get_driver_env_vars(
exclude_vars = worker_specific_vars | RAY_NON_CARRY_OVER_ENV_VARS
return {key: value for key, value in os.environ.items() if key not in exclude_vars}
def update_runtime_env_for_worker_import(runtime_env: dict) -> dict:
"""Expose driver environment variables needed before Ray actor import.
VllmConfig can auto-enable breakable CUDA graphs after Ray starts, while
eager_break_during_capture resolves the setting during model import.
"""
for env_var in _RAY_WORKER_PRE_IMPORT_ENV_VARS:
if env_var in os.environ:
env_vars = runtime_env.setdefault("env_vars", {})
env_vars[env_var] = os.environ[env_var]
return runtime_env