-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[None][infra] Move check test list before build stage #17994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a204cf6
f7d3d75
a60cab8
ac9762e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Minimal dependencies for pytest --collect-only used by check_test_list.py | ||
| # --no-install-wheel mode (CPU-only, no trtllm wheel needed). | ||
| # | ||
| # These are the packages imported at module scope during pytest collection in | ||
| # tests/integration/defs/conftest.py and its transitive imports. Runtime-only | ||
| # deps (GPU kernels, trtllm bindings, etc.) are intentionally excluded. | ||
| # | ||
| # torch: conftest.py imports it at module scope; the CPU wheel is sufficient | ||
| # for collection and avoids the ~2 GB CUDA download. | ||
| --extra-index-url https://download.pytorch.org/whl/cpu | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Separately, |
||
| torch>=2.12.0 | ||
|
|
||
| psutil | ||
| tqdm | ||
| PyYAML | ||
| mako | ||
| oyaml | ||
| # pynvml: gpu_clock_lock.py imports pynvml at module scope (nvmlInit() is | ||
| # called only inside methods, so the import itself works without a GPU driver) | ||
| nvidia-ml-py | ||
|
|
||
| # pytest and the plugins declared in tests/integration/defs/pytest.ini | ||
| pytest<9.1 | ||
| pytest-asyncio | ||
| pytest-threadleak | ||
| pytest-unused-fixtures | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -527,14 +527,23 @@ def validate_test_lists(test_lists_dir: str, test_base_dir: str): | |
| # ============================================================================= | ||
|
|
||
|
|
||
| def install_python_dependencies(llm_src): | ||
| subprocess.run(f"cd {llm_src} && pip3 install -r requirements-dev.txt", | ||
| shell=True, | ||
| check=True) | ||
| subprocess.run( | ||
| f"pip3 install --force-reinstall --no-deps {llm_src}/../tensorrt_llm-*.whl", | ||
| shell=True, | ||
| check=True) | ||
| def install_python_dependencies(llm_src, install_wheel=True): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win Add type annotations to the modified functions. Use This keeps the changed helpers compliant with the repository's function-annotation guideline. 📍 Affects 2 files
🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| if install_wheel: | ||
| subprocess.run(f"cd {llm_src} && pip3 install -r requirements-dev.txt", | ||
| shell=True, | ||
| check=True) | ||
| subprocess.run( | ||
| f"pip3 install --force-reinstall --no-deps {llm_src}/../tensorrt_llm-*.whl", | ||
| shell=True, | ||
| check=True) | ||
| else: | ||
| # Minimal deps for pytest --collect-only without a trtllm wheel. | ||
| # jenkins/requirements-check-test-list.txt covers only the packages imported at | ||
| # module scope during collection (torch CPU build, pytest plugins, etc.). | ||
| subprocess.run( | ||
| f"pip3 install -r {llm_src}/jenkins/requirements-check-test-list.txt", | ||
| shell=True, | ||
| check=True) | ||
| subprocess.run( | ||
| "pip3 install --extra-index-url https://urm.nvidia.com/artifactory/api/pypi/sw-tensorrt-pypi/simple " | ||
| "--ignore-installed trt-test-db==1.8.5+bc6df7", | ||
|
|
@@ -591,11 +600,16 @@ def verify_l0_test_lists(llm_src): | |
| with open(test_list, "w") as f: | ||
| f.writelines(f"{line}\n" for line in sorted(cleaned_lines)) | ||
|
|
||
| subprocess.run( | ||
| # Exit code 2 means pytest encountered collection errors (ImportError in some | ||
| # test files that need the trtllm wheel) but continued with --continue-on- | ||
| # collection-errors. Treat 0 and 2 as success; anything else is a real error. | ||
| result = subprocess.run( | ||
| f"cd {llm_src}/tests/integration/defs && " | ||
| f"pytest --test-list={test_list} --output-dir={llm_src} -s --co -q", | ||
| shell=True, | ||
| check=True) | ||
| f"pytest --test-list={test_list} --output-dir={llm_src} -s --co -q" | ||
| f" --continue-on-collection-errors", | ||
| shell=True) | ||
| if result.returncode not in (0, 2): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The exit-code mapping is backwards. Verified with pytest 9.0.3: Collection errors bump Same in Note also that #17975 has since landed on |
||
| result.check_returncode() | ||
|
|
||
|
|
||
| def verify_qa_test_lists(llm_src): | ||
|
|
@@ -605,11 +619,13 @@ def verify_qa_test_lists(llm_src): | |
| test_def_files = subprocess.check_output( | ||
| f"ls -d {test_qa_path}/*.txt", shell=True).decode().strip().split('\n') | ||
| for test_def_file in test_def_files: | ||
| subprocess.run( | ||
| result = subprocess.run( | ||
| f"cd {llm_src}/tests/integration/defs && " | ||
| f"pytest --test-list={test_def_file} --output-dir={llm_src} -s --co -q", | ||
| shell=True, | ||
| check=True) | ||
| f"pytest --test-list={test_def_file} --output-dir={llm_src} -s --co -q" | ||
| f" --continue-on-collection-errors", | ||
| shell=True) | ||
| if result.returncode not in (0, 2): | ||
| result.check_returncode() | ||
| # append all the test_def_file to qa_test.txt | ||
| with open(f"{llm_src}/qa_test.txt", "a") as f: | ||
| with open(test_def_file, "r") as test_file: | ||
|
|
@@ -720,11 +736,13 @@ def verify_waive_list(llm_src, args): | |
| with open(tmp_waives_file, "w") as f: | ||
| f.writelines(f"{line}\n" for line in sorted(processed_lines)) | ||
|
|
||
| subprocess.run( | ||
| result = subprocess.run( | ||
| f"cd {llm_src}/tests/integration/defs && " | ||
| f"pytest --test-list={tmp_waives_file} --output-dir={llm_src} -s --co -q", | ||
| shell=True, | ||
| check=True) | ||
| f"pytest --test-list={tmp_waives_file} --output-dir={llm_src} -s --co -q" | ||
| f" --continue-on-collection-errors", | ||
| shell=True) | ||
| if result.returncode not in (0, 2): | ||
| result.check_returncode() | ||
|
|
||
|
|
||
| def main(): | ||
|
|
@@ -761,13 +779,23 @@ def main(): | |
| help= | ||
| f"Base directory for test source files for --validate (default: {_DEFAULT_TEST_BASE_DIR})", | ||
| ) | ||
| parser.add_argument( | ||
| "--no-install-wheel", | ||
| action="store_true", | ||
| help= | ||
| ("Skip installing the tensorrt_llm wheel when running --l0/--qa/--waive. " | ||
| "Use this on CPU-only nodes where no wheel is available; pytest collection " | ||
| "works via stub fallbacks in conftest.py (no GPU or trtllm build needed)." | ||
| ), | ||
| ) | ||
| args = parser.parse_args() | ||
| script_dir = os.path.dirname(os.path.realpath(__file__)) | ||
| llm_src = os.path.abspath(os.path.join(script_dir, "../")) | ||
|
|
||
| # Only skip installing dependencies if ONLY --check-duplicates or --validate is used | ||
| if args.l0 or args.qa or args.waive: | ||
| install_python_dependencies(llm_src) | ||
| install_python_dependencies(llm_src, | ||
| install_wheel=not args.no_install_wheel) | ||
|
|
||
| pass_flag = True | ||
| # Verify L0 test lists | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,8 +48,20 @@ | |
| # is harmless. | ||
| from test_common import session_prefetcher_hooks as _prefetch_hooks | ||
|
|
||
| from tensorrt_llm.bindings import ipc_nvls_supported | ||
| from tensorrt_llm.llmapi.mpi_session import get_mpi_world_size | ||
| try: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fallback applies to every pytest run of the integration suite, not just the CPU-only collection pod. In a real test job with a half-broken install, the import now succeeds silently and Gate it on something the collection-only path sets explicitly, e.g. if os.environ.get("TRTLLM_TEST_LIST_CHECK_ONLY") == "1":
def get_mpi_world_size(): return 1
...
else:
from tensorrt_llm.bindings import ipc_nvls_supported
...and export it from |
||
| from tensorrt_llm.bindings import ipc_nvls_supported | ||
| from tensorrt_llm.llmapi.mpi_session import get_mpi_world_size | ||
| except (ImportError, ModuleNotFoundError): | ||
| # tensorrt_llm is not installed (e.g. pytest --collect-only from a source | ||
| # checkout without a built wheel). Provide no-op stubs so collection | ||
| # succeeds; these functions are only called during test execution, not | ||
| # during collection. | ||
|
Comment on lines
+51
to
+58
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Do not mask import failures from an installed TensorRT-LLM package. Catch only Proposed fix try:
from tensorrt_llm.bindings import ipc_nvls_supported
from tensorrt_llm.llmapi.mpi_session import get_mpi_world_size
-except (ImportError, ModuleNotFoundError):
+except ModuleNotFoundError as exc:
+ if exc.name is None or not exc.name.startswith("tensorrt_llm"):
+ raise
# tensorrt_llm is not installed ...As per coding guidelines, catch the narrowest exception possible. 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| def ipc_nvls_supported(): | ||
| return False | ||
|
|
||
| def get_mpi_world_size(): | ||
| return 1 | ||
|
|
||
|
|
||
| from .perf.gpu_clock_lock import GPUClockLock | ||
| from .perf.session_data_writer import SessionDataWriter | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the rebase onto current
main, this is missing--validate --parity—launchTestListCheckinjenkins/L0_Test.groovy:3823now runs--l0 --qa --waive --validate --parity(added by #17975). Neither flag needs a wheel or a GPU:--validateis an AST walk over the test sources and--parityis set logic over the lists this run already produced, so both belong in the CPU pod.They do depend on the collection results being trustworthy, though, so this can't just be flag-copied — see the
check_test_list.pycomment about--continue-on-collection-errors.