[CI/Build] Share nightly CUDA YAML between H100/L4 and B200 (#7028)

Signed-off-by: wangyu <410167048@qq.com>
Signed-off-by: [Your Name] [Your Email]
Signed-off-by: [Your Name] <your.email@example.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: amy-why-3459 <wuhaiyan17@huawei.com>
This commit is contained in:
authored and GitHub committed 2026-09-14 14:27:10 +08:00
1 parent 58adeec05f
commit 64903b8e30
78 files changed
+437 -321

No files matched your search

+47
View File
@@ -27,6 +27,7 @@ from upload_pipeline import ( # noqa: E402
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
CUDA_BOOTSTRAP_STEPS = Path(".buildkite/cuda/bootstrap-upload-steps.yml")
NIGHTLY_YAML = Path(".buildkite/cuda/test-nightly.yml")
BOOTSTRAP_STEPS_TEMPLATE = """steps:
- key: image-build
- key: upload-ready-pipeline
@@ -368,6 +369,52 @@ def test_cpu_step_without_mirror_hardwares_is_unchanged() -> None:
assert _expand_mirror_hardwares(step) is step
def _leaf_steps(steps: list) -> list[dict]:
leaves: list[dict] = []
for step in steps:
if not isinstance(step, dict):
continue
nested = step.get("steps")
if nested is not None:
leaves.extend(_leaf_steps(nested))
else:
leaves.append(step)
return leaves
def test_nightly_yaml_infers_h100_l4_and_b200(monkeypatch: pytest.MonkeyPatch) -> None:
"""Nightly inferred jobs share card counts across H100/L4 and B200 mirrors."""
src = yaml.safe_load(NIGHTLY_YAML.read_text(encoding="utf-8"))
pytest_leaves = [step for step in _leaf_steps(src["steps"]) if "pytest" in str(step.get("commands"))]
inferred_leaves = [step for step in pytest_leaves if "mirror_hardwares" not in step]
pinned_leaves = [step for step in pytest_leaves if "mirror_hardwares" in step]
assert inferred_leaves
monkeypatch.setattr("upload_pipeline._get_mirror_hw_selector", lambda: "")
default_by_label = {
step["label"]: step for step in _leaf_steps(_render_test_pipeline(src, changed_files=None)["steps"])
}
monkeypatch.setattr("upload_pipeline._get_mirror_hw_selector", lambda: "b200")
b200_src = yaml.safe_load(NIGHTLY_YAML.read_text(encoding="utf-8"))
b200_by_label = {
step["label"]: step for step in _leaf_steps(_render_test_pipeline(b200_src, changed_files=None)["steps"])
}
pytest_labels = {step["label"] for step in inferred_leaves}
pinned_labels = {step["label"] for step in pinned_leaves}
assert pinned_labels <= set(default_by_label)
assert pinned_labels.isdisjoint(b200_by_label)
assert pytest_labels <= set(default_by_label)
assert pytest_labels <= set(b200_by_label)
for label in pytest_labels:
default_step = default_by_label[label]
b200_step = b200_by_label[label]
assert default_step["agents"]["queue"] in {"mithril-h100-pool", "l4-k8s"}
assert b200_step["agents"]["queue"] == "b200-k8s"
assert _gpu_limit(default_step) == _gpu_limit(b200_step)
@pytest.mark.parametrize(("raw", "expected"), [("", ""), (" ", ""), ("b200", "b200"), ("B200", "b200")])
def test_mirror_hw_selector_empty_or_b200(monkeypatch: pytest.MonkeyPatch, raw: str, expected: str) -> None:
monkeypatch.setenv("MIRROR_HW", raw)