ci: dynamic partition + LPT from live sglang-ci-stats model (#25263)

This commit is contained in:
Liangsheng Yin
2026-05-14 02:35:59 -07:00
committed by GitHub
parent 373a22c225
commit 4593bbdf31
7 changed files with 233 additions and 36 deletions
+45 -2
View File
@@ -1,8 +1,9 @@
import argparse
import glob
import json
import os
import sys
from typing import List
from typing import Dict, List, Optional
import tabulate
@@ -222,6 +223,29 @@ def pretty_print_tests(
print(msg, flush=True)
def load_live_est(
partition_model_file: Optional[str], suite: str, repo_root: str
) -> Optional[Dict[str, float]]:
"""`CIRegistry.filename -> est seconds` from `model.json est[suite]`;
None on any miss (caller falls back to in-source `est_time`)."""
if not partition_model_file or not os.path.exists(partition_model_file):
return None
try:
with open(partition_model_file) as f:
partition_model = json.load(f)
except (OSError, json.JSONDecodeError):
return None
if not isinstance(partition_model, dict):
return None
suite_est = partition_model.get("est", {}).get(suite)
if not isinstance(suite_est, dict) or not suite_est:
return None
return {
os.path.join(repo_root, relpath): float(elapsed)
for relpath, elapsed in suite_est.items()
}
def run_a_suite(args):
hw = HW_MAPPING[args.hw]
suite = args.suite
@@ -261,7 +285,20 @@ def run_a_suite(args):
ci_tests, skipped_tests = filter_tests(all_tests, hw, suite, nightly)
if auto_partition_size:
ci_tests = auto_partition(ci_tests, auto_partition_id, auto_partition_size)
live_est = load_live_est(args.partition_model_file, suite, repo_root)
if live_est is not None:
print(
f"LPT: {len(live_est)} live est entries from {args.partition_model_file}",
flush=True,
)
else:
print(
f"LPT: no live est ({args.partition_model_file!r}); using in-source est_time",
flush=True,
)
ci_tests = auto_partition(
ci_tests, auto_partition_id, auto_partition_size, live_est=live_est
)
pretty_print_tests(args, ci_tests, skipped_tests)
@@ -343,6 +380,12 @@ def main():
default=600,
help="Additional timeout in seconds when retry is enabled (default: 600)",
)
parser.add_argument(
"--partition-model-file",
type=str,
default=None,
help="Path to sglang-ci-stats model.json for live LPT est; missing/malformed -> in-source est_time fallback.",
)
args = parser.parse_args()
# Validate auto-partition arguments