From e4c565f2f27e10b39e365707ae54402a9d731789 Mon Sep 17 00:00:00 2001 From: Liangsheng Yin Date: Tue, 31 Mar 2026 18:27:39 -0700 Subject: [PATCH] [Misc] Tiny: Add test network timeouts and dynamic max-parallel for 5090/2-gpu runners (#21800) --- .github/workflows/pr-test.yml | 44 ++++++++++++++++-------- python/sglang/test/simple_eval_common.py | 2 +- python/sglang/test/simple_eval_mgsm.py | 2 +- python/sglang/test/vlm_utils.py | 2 +- 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 80236d90a..9c759b74d 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -88,6 +88,8 @@ jobs: jit_kernel: ${{ steps.filter-api.outputs.jit_kernel || steps.filter.outputs.jit_kernel || steps.run-mode.outputs.run_all_tests }} multimodal_gen: ${{ steps.filter-api.outputs.multimodal_gen || steps.filter.outputs.multimodal_gen || steps.run-mode.outputs.run_all_tests }} max_parallel: ${{ steps.set-parallel.outputs.max_parallel }} + max_parallel_small: ${{ steps.set-parallel.outputs.max_parallel_small }} + max_parallel_2gpu: ${{ steps.set-parallel.outputs.max_parallel_2gpu }} b200_runner: ${{ steps.set-runner.outputs.b200_runner }} enable_retry: ${{ steps.set-retry.outputs.enable_retry }} continue_on_error: ${{ steps.set-continue-on-error.outputs.continue_on_error }} @@ -216,13 +218,14 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - # Scheduled runs and high-priority PRs get full parallelism + # Determine if this run gets full parallelism (scheduled / high priority) + FULL=false if [[ "${{ github.event_name }}" == "schedule" ]]; then - echo "max_parallel=14" >> $GITHUB_OUTPUT - echo "Scheduled run detected, setting max_parallel to 14" + FULL=true + echo "Scheduled run detected, using full parallelism" elif [[ "${{ github.event_name }}" == "pull_request" && "${{ contains(github.event.pull_request.labels.*.name, 'high priority') }}" == "true" ]]; then - echo "max_parallel=14" >> $GITHUB_OUTPUT - echo "High priority PR detected, setting max_parallel to 14" + FULL=true + echo "High priority PR detected, using full parallelism" elif [[ -n "${{ inputs.target_stage }}" ]]; then # /rerun-stage (workflow_dispatch): query PR labels via GitHub API # Try SHA lookup first (fork PRs), fallback to branch name (non-fork PRs) @@ -238,17 +241,27 @@ jobs: fi echo "PR labels: ${LABELS:-"(none)"}" if echo "$LABELS" | grep -Fxq "high priority"; then - echo "max_parallel=14" >> $GITHUB_OUTPUT - echo "High priority PR detected via API (/rerun-stage), setting max_parallel to 14" - else - echo "max_parallel=3" >> $GITHUB_OUTPUT - echo "Using default max_parallel of 3 (/rerun-stage, no high priority label)" + FULL=true + echo "High priority PR detected via API (/rerun-stage), using full parallelism" fi - else - echo "max_parallel=3" >> $GITHUB_OUTPUT - echo "Using default max_parallel of 3" fi + # Set max-parallel for each runner type + # 1-gpu-h100: 14 partitions, 1-gpu-5090: 8 partitions, 2-gpu-h100: 4 partitions + if [[ "$FULL" == "true" ]]; then + LEVEL=full + echo "max_parallel=14" >> $GITHUB_OUTPUT + echo "max_parallel_small=8" >> $GITHUB_OUTPUT + echo "max_parallel_2gpu=4" >> $GITHUB_OUTPUT + else + LEVEL=low + echo "max_parallel=3" >> $GITHUB_OUTPUT + echo "max_parallel_small=3" >> $GITHUB_OUTPUT + echo "max_parallel_2gpu=2" >> $GITHUB_OUTPUT + fi + echo "parallel_level=$LEVEL" >> $GITHUB_OUTPUT + echo "Parallelism level: $LEVEL" + - name: Set B200 runner tag id: set-runner run: | @@ -314,7 +327,7 @@ jobs: echo "| multimodal_gen | ${{ steps.filter-api.outputs.multimodal_gen || steps.filter.outputs.multimodal_gen || steps.run-mode.outputs.run_all_tests }} |" echo "| target_stage | ${{ inputs.target_stage || '(none)' }} |" echo "| detection_method | ${{ inputs.target_stage && 'GitHub API' || 'dorny/paths-filter' }} |" - echo "| max_parallel | ${{ steps.set-parallel.outputs.max_parallel }} |" + echo "| max_parallel | ${{ steps.set-parallel.outputs.parallel_level }} (h100=${{ steps.set-parallel.outputs.max_parallel }}, 5090=${{ steps.set-parallel.outputs.max_parallel_small }}, 2gpu=${{ steps.set-parallel.outputs.max_parallel_2gpu }}) |" echo "| b200_runner | ${{ steps.set-runner.outputs.b200_runner }} |" echo "| enable_retry | ${{ steps.set-retry.outputs.enable_retry }} |" echo "| continue_on_error | ${{ steps.set-continue-on-error.outputs.continue_on_error }} |" @@ -661,7 +674,7 @@ jobs: timeout-minutes: 240 strategy: fail-fast: false - max-parallel: 8 + max-parallel: ${{ fromJson(needs.check-changes.outputs.max_parallel_small) }} matrix: partition: [0, 1, 2, 3, 4, 5, 6, 7] steps: @@ -774,6 +787,7 @@ jobs: timeout-minutes: 240 strategy: fail-fast: false + max-parallel: ${{ fromJson(needs.check-changes.outputs.max_parallel_2gpu) }} matrix: partition: [0, 1, 2, 3] steps: diff --git a/python/sglang/test/simple_eval_common.py b/python/sglang/test/simple_eval_common.py index b594479d7..b7ac713e5 100644 --- a/python/sglang/test/simple_eval_common.py +++ b/python/sglang/test/simple_eval_common.py @@ -516,7 +516,7 @@ def make_report_from_example_htmls(htmls: List[str]): def download_dataset(path, url): print(f"Downloading dataset {path} from {url}") try: - response = requests.get(url, stream=True) + response = requests.get(url, stream=True, timeout=120) response.raise_for_status() total_size = int(response.headers.get("content-length", 0)) diff --git a/python/sglang/test/simple_eval_mgsm.py b/python/sglang/test/simple_eval_mgsm.py index 0b0b72a20..03098b95b 100644 --- a/python/sglang/test/simple_eval_mgsm.py +++ b/python/sglang/test/simple_eval_mgsm.py @@ -115,7 +115,7 @@ def score_mgsm(target: str, prediction: str) -> bool: def get_lang_examples(lang: str) -> list[dict[str, str]]: fpath = LANG_TO_FPATH[lang] examples = [] - with urllib.request.urlopen(fpath) as f: + with urllib.request.urlopen(fpath, timeout=30) as f: for line in f.read().decode("utf-8").splitlines(): inputs, targets = line.strip().split("\t") if "." in targets: diff --git a/python/sglang/test/vlm_utils.py b/python/sglang/test/vlm_utils.py index 24ced63eb..a1897be0c 100644 --- a/python/sglang/test/vlm_utils.py +++ b/python/sglang/test/vlm_utils.py @@ -77,7 +77,7 @@ class TestOpenAIMLLMServerBase(CustomTestCase): os.makedirs(cache_dir, exist_ok=True) if not os.path.exists(file_path): - response = requests.get(url) + response = requests.get(url, timeout=30) response.raise_for_status() with open(file_path, "wb") as f: