[CI] Show test partition assignments after checkout (#20085)

Co-authored-by: Alison Shao <alisonshao@mac.lan>
This commit is contained in:
Alison Shao
2026-03-07 13:50:49 -08:00
committed by GitHub
co-authored by Alison Shao
parent 7bd3dd9270
commit 0f62da6953
4 changed files with 183 additions and 28 deletions
+6 -28
View File
@@ -5,7 +5,12 @@ from typing import List
import tabulate
from sglang.test.ci.ci_register import CIRegistry, HWBackend, collect_tests
from sglang.test.ci.ci_register import (
CIRegistry,
HWBackend,
auto_partition,
collect_tests,
)
from sglang.test.ci.ci_utils import run_unittest_files
HW_MAPPING = {
@@ -117,33 +122,6 @@ def filter_tests(
return enabled_tests, skipped_tests
def auto_partition(files: List[CIRegistry], rank, size):
"""
Partition files into size sublists with approximately equal sums of estimated times
using a greedy algorithm (LPT heuristic), and return the partition for the specified rank.
"""
if not files or size <= 0:
return []
# Sort files by estimated_time in descending order (LPT heuristic).
# Use filename as tie-breaker to ensure deterministic partitioning
# regardless of glob ordering.
sorted_files = sorted(files, key=lambda f: (-f.est_time, f.filename))
partitions = [[] for _ in range(size)]
partition_sums = [0.0] * size
# Greedily assign each file to the partition with the smallest current total time
for file in sorted_files:
min_sum_idx = min(range(size), key=partition_sums.__getitem__)
partitions[min_sum_idx].append(file)
partition_sums[min_sum_idx] += file.est_time
if rank < size:
return partitions[rank]
return []
def pretty_print_tests(
args, ci_tests: List[CIRegistry], skipped_tests: List[CIRegistry]
):