[TRTLLM-10253][infra] upload test output to storage#13073
Conversation
|
/bot run |
|
PR_Github #43420 [ run ] triggered by Bot. Commit: |
📝 WalkthroughWalkthroughIntroduces S3 log upload capability for pytest integration tests by adding new pytest plugin infrastructure, CLI options, and log capture utilities. Updates Jenkins pipeline to conditionally enable test result uploads and pass S3 credentials. Adds boto3 dependency. Changes
Sequence Diagram(s)sequenceDiagram
participant Test as Pytest Test
participant FDRedir as FDRedirector
participant LogFile as Log Files
participant S3 as S3 Endpoint
participant Report as Test Report
Test->>FDRedir: pytest_runtest_call (enter context)
activate FDRedir
FDRedir->>FDRedir: Redirect FD 1 & 2 to pipes
FDRedir->>FDRedir: Start reader thread
Test->>Test: Test execution (print to stdout/stderr)
FDRedir->>FDRedir: Reader captures output, adds timestamps
FDRedir->>LogFile: Write timestamped lines to log file
Test->>Test: Test completes
FDRedir->>FDRedir: Restore original FDs
deactivate FDRedir
Test->>UploadLogPlugin: pytest_runtest_logreport (teardown)
activate UploadLogPlugin
UploadLogPlugin->>LogFile: Read captured logs (stdout, stderr, logging)
UploadLogPlugin->>S3: Upload logs with S3 credentials
activate S3
S3-->>UploadLogPlugin: Upload success/failure response
deactivate S3
UploadLogPlugin->>Report: Append upload outcome section
deactivate UploadLogPlugin
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@jenkins/L0_Test.groovy`:
- Around line 1003-1014: The sbatch branch builds extraArgs enabling
"--s3-upload-path" when ENABLE_UPLOAD_TEST_RESULTS is true but never supplies
the S3 secret; replicate the credentials handling used in
runLLMTestlistOnPlatformImpl(): wrap the sbatch submission logic in a
withCredentials block that retrieves the S3_SECRET_KEY (and any related S3
secret ID) and export them into the remote sbatch environment before invoking
the job so tests/integration/defs/s3_output.py can authenticate; update the code
around extraArgs and the sbatch submission to inject/export the S3 credentials
into the remote environment when ENABLE_UPLOAD_TEST_RESULTS is set.
- Line 28: The assignment to ENABLE_UPLOAD_TEST_RESULTS uses the Elvis operator
which treats false as falsy, so explicitly passing false gets overwritten;
change the logic to only default to true when the parameter is absent
(null/undefined) by checking for null (e.g. use
params.containsKey('enableUploadTestResults') or params.enableUploadTestResults
!= null) and assign ENABLE_UPLOAD_TEST_RESULTS = params.enableUploadTestResults
when present, otherwise true, referencing ENABLE_UPLOAD_TEST_RESULTS and
params.enableUploadTestResults in the fix.
In `@tests/integration/defs/conftest.py`:
- Around line 2352-2366: When s3_upload_path and output_dir are provided we must
validate required S3 credentials before constructing or registering
UploadLogPlugin; check values retrieved via config.getoption("--s3-username"),
config.getoption("--s3-secret-key") and config.getoption("--s3-bucket") (and
optionally "--s3-endpoint") and raise a ValueError with a clear message if any
required credential is missing or empty, then only instantiate
UploadLogPlugin(...) and call config.pluginmanager.register(upload_plugin,
"upload_log_plugin") after those validations; ensure the check also enforces
capture_mode == "no" as currently done.
In `@tests/integration/defs/s3_output.py`:
- Around line 1-12: Add the repository's mandatory NVIDIA copyright/SPDX header
at the very top of this new module (above the imports) so it appears before any
code; update the year if required. Locate the file by the module beginning
(imports such as argparse, logging, boto3 and the module-level logger variable
named logger) and insert the standard NVIDIA copyright block/header text used
across the repo (including SPDX identifier) as the first lines of the file.
- Around line 222-237: The except block currently reads and embeds up to 64KB of
file content into report.sections; instead, stop opening/reading the file and
append only failure metadata (error and path/size) matching the success-case
pattern: update the report.sections.append call (referencing section_name,
report.sections, and exception variable e) to include a short message like
"upload failed: {e}\nsize: {filesize} bytes\npath: {filepath}" and remove the
logger/file-read/truncation logic that produces `content` and `trail_content`.
- Around line 142-184: The hook currently defined as pytest_runtest_call only
wraps the test body and misses fixture setup/teardown output; change the hook to
pytest_runtest_protocol(wrapper=True) on the same function so the
FDRedirector/stdout/stderr redirection and catching_logs(handler) wrap the
entire test lifecycle (setup, call, teardown). Update the decorator and
signature to use pytest_runtest_protocol while keeping the same body that builds
test_name via normalize_test_name(item.nodeid), creates output_path, opens
stdout_file/stderr_file/logging.log, configures handler/formatter (using
item.config/pluginmanager and log_date_format/log_format/timestamp_format), and
uses the same with (FDRedirector(1,...), FDRedirector(2,...),
catching_logs(handler)) to yield control for the whole protocol.
- Around line 161-184: The FileHandler created as "handler =
logging.FileHandler(log_file)" is never closed; modify the generator so that
after the "with (FDRedirector(...), catching_logs(handler),): yield" returns
(teardown path) you explicitly call handler.close() (and optionally
handler.flush()) to release the file descriptor; keep the existing use of
catching_logs(handler) to remove the handler from the root logger but ensure
handler.close() is invoked after the yield in the same function (where handler
and catching_logs are used).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 1e3cc76d-27d0-4997-b346-c5a74193bad4
📒 Files selected for processing (4)
jenkins/L0_Test.groovyrequirements-dev.txttests/integration/defs/conftest.pytests/integration/defs/s3_output.py
|
PR_Github #43420 [ run ] completed with state
|
03e3a24 to
28398fa
Compare
dpitman-nvda
left a comment
There was a problem hiding this comment.
Two questions:
- What's the thinking behind using (presumably) s8k versus other options like Artifactory?
- Will the top-level MR scripts eventually be wired in as well? If so, how would we handle things like my failure analyzer agent's output (https://github.com/NVIDIA/TensorRT-LLM/blob/main/jenkins/L0_MergeRequest.groovy#L1360)?
|
|
PR_Github #44666 [ run ] triggered by Bot. Commit: |
|
PR_Github #44666 [ run ] completed with state
|
59e4863 to
1825b4e
Compare
c5a5b9f to
b16c6e1
Compare
|
/bot run |
|
PR_Github #48822 [ run ] triggered by Bot. Commit: |
|
PR_Github #48822 [ run ] completed with state
|
|
PR_Github #56172 [ run ] triggered by Bot. Commit: |
|
PR_Github #56172 [ run ] completed with state
|
|
PR_Github #56184 [ run ] triggered by Bot. Commit: |
|
PR_Github #56184 [ run ] completed with state
|
|
PR_Github #56198 [ run ] triggered by Bot. Commit: |
|
PR_Github #56198 [ run ] completed with state
|
|
PR_Github #56235 [ run ] triggered by Bot. Commit: |
|
PR_Github #56235 [ run ] completed with state
|
|
PR_Github #56498 [ run ] triggered by Bot. Commit: |
|
PR_Github #56498 [ run ] completed with state
|
|
PR_Github #56523 [ run ] triggered by Bot. Commit: |
|
PR_Github #56523 [ run ] completed with state |
yuanjingx87
left a comment
There was a problem hiding this comment.
approved on oss compliance behalf
Signed-off-by: Yiteng Niu <6831097+niukuo@users.noreply.github.com>
Signed-off-by: Yiteng Niu <6831097+niukuo@users.noreply.github.com>
Summary by CodeRabbit
Release Notes
New Features
Dependencies
Description
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.