[Bugfix] fix nightly multi-node EPLB tests' "DYNAMIC_EPLB=true" environment not working (#4223)

### What this PR does / why we need it?
fix nightly multi-node EPLB tests by adjusting
vllm_ascend\eplb\core\eplb_utils.py dynamic_eplb gate checking
### Does this PR introduce _any_ user-facing change?
no

- vLLM version: v0.11.0
- vLLM main:
2918c1b49c

---------

Signed-off-by: 白永斌 <baiyongbin3@h-partners.com>
Signed-off-by: 欧派果奶我还要 <47294568+845473182@users.noreply.github.com>
Co-authored-by: 白永斌 <baiyongbin3@h-partners.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
欧派果奶我还要
2025-11-19 21:31:58 +08:00
committed by GitHub
parent a3e9673137
commit c848da0687
4 changed files with 20 additions and 7 deletions

View File

@@ -128,7 +128,7 @@ class TestEPLBParamUtils:
with pytest.raises(
ValueError,
match=
'Can not enable dynamic_eplb when not export DYNAMIC_EPLB="true".'
'Can not enable dynamic_eplb when DYNAMIC_EPLB is not set to "true" or "1".'
):
EPLBParamUtils.check_dynamic_eplb(True)
@@ -136,7 +136,7 @@ class TestEPLBParamUtils:
with pytest.raises(
ValueError,
match=
'Can not enable dynamic_eplb when not export DYNAMIC_EPLB="true".'
'Can not enable dynamic_eplb when DYNAMIC_EPLB is not set to "true" or "1".'
):
EPLBParamUtils.check_dynamic_eplb(True)
@@ -144,7 +144,7 @@ class TestEPLBParamUtils:
with pytest.raises(
ValueError,
match=
'Can not enable dynamic_eplb when not export DYNAMIC_EPLB="true".'
'Can not enable dynamic_eplb when DYNAMIC_EPLB is not set to "true" or "1".'
):
EPLBParamUtils.check_dynamic_eplb(True)
@@ -152,6 +152,12 @@ class TestEPLBParamUtils:
monkeypatch.setenv("DYNAMIC_EPLB", "true")
EPLBParamUtils.check_dynamic_eplb(True)
monkeypatch.setenv("DYNAMIC_EPLB", "True")
EPLBParamUtils.check_dynamic_eplb(True)
monkeypatch.setenv("DYNAMIC_EPLB", "1")
EPLBParamUtils.check_dynamic_eplb(True)
def test_check_expert_map_path_none(self):
EPLBParamUtils.check_expert_map_path(None)

View File

@@ -172,7 +172,10 @@ env_variables: Dict[str, Callable[[], Any]] = {
lambda: int(os.getenv("VLLM_ASCEND_ENABLE_NZ", 1)),
# Decide whether we should enable CP parallelism.
"VLLM_ASCEND_ENABLE_CONTEXT_PARALLEL":
lambda: bool(int(os.getenv("VLLM_ASCEND_ENABLE_CONTEXT_PARALLEL", '0')))
lambda: bool(int(os.getenv("VLLM_ASCEND_ENABLE_CONTEXT_PARALLEL", '0'))),
# Whether to anbale dynamic EPLB
"DYNAMIC_EPLB":
lambda: os.getenv("DYNAMIC_EPLB", "false").lower(),
}
# end-env-vars-definition

View File

@@ -22,6 +22,8 @@ import sys
import torch
from vllm.logger import logger
import vllm_ascend.envs as envs_ascend
def determine_default_expert_map(global_expert_num, world_size, rank_id,
global_redundant_expert_num):
@@ -140,9 +142,10 @@ class EPLBParamUtils:
return
if not isinstance(dynamic_eplb, bool):
raise TypeError("The dynamic_eplb is not bool.")
if dynamic_eplb and os.getenv("DYNAMIC_EPLB", "false") != "true":
if dynamic_eplb and envs_ascend.DYNAMIC_EPLB not in ("true", "1"):
raise ValueError(
'Can not enable dynamic_eplb when not export DYNAMIC_EPLB="true".'
'Can not enable dynamic_eplb when DYNAMIC_EPLB is not set to "true" or "1".'
)
@staticmethod

View File

@@ -16,11 +16,12 @@
import os
import vllm_ascend.envs as envs_ascend
import vllm_ascend.patch.platform.patch_config # noqa
import vllm_ascend.patch.platform.patch_distributed # noqa
import vllm_ascend.patch.platform.patch_mamba_config # noqa
import vllm_ascend.patch.platform.patch_sched_yield # noqa
if os.getenv("DYNAMIC_EPLB", "false") == "true" or os.getenv(
if envs_ascend.DYNAMIC_EPLB not in ("true", "1") or os.getenv(
"EXPERT_MAP_RECORD", "false") == "true":
import vllm_ascend.patch.platform.patch_multiproc_executor # noqa