Skip to content

Commit 4bc771a

Browse files
[8.19][ML] Run QA and PyTorch suites concurrently in a single triggered build (#3131) (#3134)
Manual 8.19 backport of #3131. The auto-backport conflicts because 8.19 lacks the "Upload ES inference tests x86_64" step that sits adjacent to the QA-trigger block on main, so the hunk context cannot anchor. Consolidates the separate run_qa_tests / run_pytorch_tests upload steps into a single trigger with a comma-separated QAF_TESTS_TO_RUN, so the appex-qa generator fans QA (ml_cpp_pr) and PyTorch suites out into concurrent parallel jobs in one downstream build (avoiding the skip_queued_branch_builds de-dup that dropped one of two separate triggers). run_qa_tests.yml.sh now derives its step label and commit status context (QA / PyTorch / QA + PyTorch) from the requested suites. Adds "import os" to pipeline.json.py: 8.19 did not previously import it and the consolidated block reads QAF_TESTS_TO_RUN via os.environ. Co-authored-by: Cursor <[email protected]>
1 parent 12a3474 commit 4bc771a

2 files changed

Lines changed: 46 additions & 9 deletions

File tree

.buildkite/pipeline.json.py

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#
1818

1919
import json
20+
import os
2021

2122
from ml_pipeline import (
2223
step,
@@ -53,13 +54,31 @@ def main():
5354
if not config.skip_version_bump_pr_ci:
5455
pipeline_steps.append(pipeline_steps.generate_step("Upload ES tests x86_64 runner pipeline",
5556
".buildkite/pipelines/run_es_tests_x86_64.yml.sh"))
56-
# We only use linux x86_64 builds for QA tests.
57-
if config.run_qa_tests:
58-
pipeline_steps.append(pipeline_steps.generate_step("Upload QA tests runner pipeline",
57+
# We only use linux x86_64 builds for QA tests. When both the QA
58+
# (ml_cpp_pr) and PyTorch suites are requested we trigger a SINGLE
59+
# downstream build with a comma-separated QAF_TESTS_TO_RUN so the
60+
# appex-qa generator fans them out into concurrent parallel jobs.
61+
# A single trigger avoids the same-branch build de-duplication
62+
# (skip_queued_branch_builds) on the appex pipeline that otherwise
63+
# skipped one of two separately-triggered builds.
64+
if config.run_qa_tests or config.run_pytorch_tests:
65+
qa_suites = []
66+
if config.run_qa_tests:
67+
# QAF_TESTS_TO_RUN may itself be a comma-separated override
68+
# (e.g. a subset of QA markers), so split it into individual
69+
# suites rather than appending the whole string verbatim.
70+
override = os.environ.get("QAF_TESTS_TO_RUN")
71+
if override:
72+
qa_suites.extend(s.strip() for s in override.split(",") if s.strip())
73+
else:
74+
qa_suites.append("ml_cpp_pr")
75+
if config.run_pytorch_tests:
76+
qa_suites.append("pytorch_tests")
77+
# De-duplicate while preserving order so an override that already
78+
# includes pytorch_tests does not produce a duplicate suite.
79+
env["QAF_TESTS_TO_RUN"] = ",".join(dict.fromkeys(qa_suites))
80+
pipeline_steps.append(pipeline_steps.generate_step("Upload QA/PyTorch tests runner pipeline",
5981
".buildkite/pipelines/run_qa_tests.yml.sh"))
60-
if config.run_pytorch_tests:
61-
pipeline_steps.append(pipeline_steps.generate_step("Upload QA PyTorch tests runner pipeline",
62-
".buildkite/pipelines/run_pytorch_tests.yml.sh"))
6382
if config.build_aarch64 and not config.skip_version_bump_pr_ci:
6483
pipeline_steps.append(pipeline_steps.generate_step("Upload ES tests aarch64 runner pipeline",
6584
".buildkite/pipelines/run_es_tests_aarch64.yml.sh"))

.buildkite/pipelines/run_qa_tests.yml.sh

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,34 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
1616
# shellcheck source=/dev/null
1717
source "${SCRIPT_DIR}/derive_qa_stack_env.sh"
1818

19+
# Derive a human-readable descriptor for the trigger step's label and GitHub
20+
# commit-status context from the requested suites. This single script now
21+
# handles QA-only, PyTorch-only and combined runs, so a fixed "QA Tests" label
22+
# would mislabel the other two. Substring matches (rather than exact tokens)
23+
# keep this correct for marker expressions such as "ml_cpp_pr and not slow".
24+
QAF_SUITES="${QAF_TESTS_TO_RUN:-ml_cpp_pr}"
25+
_has_qa=false
26+
_has_pytorch=false
27+
case "${QAF_SUITES}" in *ml_cpp_pr*) _has_qa=true ;; esac
28+
case "${QAF_SUITES}" in *pytorch_tests*) _has_pytorch=true ;; esac
29+
if [ "${_has_qa}" = true ] && [ "${_has_pytorch}" = true ]; then
30+
QA_TESTS_DESC="QA + PyTorch"
31+
elif [ "${_has_pytorch}" = true ]; then
32+
QA_TESTS_DESC="PyTorch"
33+
else
34+
QA_TESTS_DESC="QA"
35+
fi
36+
1937
cat <<EOL
2038
steps:
21-
- label: "Trigger Appex QA Tests :test_tube:"
39+
- label: "Trigger Appex ${QA_TESTS_DESC} Tests :test_tube:"
2240
command:
23-
- echo 'Trigger QA Tests'
41+
- echo 'Trigger ${QA_TESTS_DESC} Tests'
2442
- 'buildkite-agent artifact download "build/*" . --step build_test_linux-x86_64-RelWithDebInfo'
2543
depends_on: "build_test_linux-x86_64-RelWithDebInfo"
2644
notify:
2745
- github_commit_status:
28-
context: "Trigger Appex QA Tests"
46+
context: "Trigger Appex ${QA_TESTS_DESC} Tests"
2947
- wait
3048
- trigger: appex-qa-stateful-custom-ml-cpp-build-testing
3149
async: false

0 commit comments

Comments
 (0)