Skip to content

[torchci] Record failing subtest under pytest-rerunfailures - #200570

Closed
georgehong wants to merge 2 commits into
gh/georgehong/21/basefrom
gh/georgehong/21/head
Closed

georgehong wants to merge 2 commits into
gh/georgehong/21/basefrom
gh/georgehong/21/head

Conversation

@georgehong

@georgehong georgehong commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Summary:
With --reruns, which run_test.py always passes, a test with a failing subtest was recorded as passed. pytest-rerunfailures holds a test's setup, call and teardown reports until the whole test, subtests included, has finished, but pytest-subtests sends a subtest's report as soon as the subtest fails, so it arrived first and was dropped. As in junitxml, a test's first report now creates its run, and the setup report fills in its identity and start time.

Test Plan:
test_subtests runs with and without --reruns 1, and test_reruns_keep_outcomes checks that every outcome in the junit fixture suite is unchanged under --reruns 2.

Authored with the help of an AI assistant (Claude).

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/200570

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 4190f3b with merge base e342e9a (image):
💚 Looks good so far! There are no failures yet. 💚

🟢 GREEN LIGHT - PR approved to be merged without human review:

  • Triviality
    • Single-cause bugfix: _logreport dropped a subtest report that arrived before setup, since only setup created the _Run
    • Fix: self.runs.setdefault(key, _Run()) creates the run on the first report, and setup fills in started and test
  • Tests
    • test_subtests now also runs with --reruns 1, where the old code would have recorded passed rather than failed
    • New test_reruns_keep_outcomes checks each case's last outcome in pytest_suite.py is unchanged under --reruns 2
  • Preservation
    • The when filter moved up but drops the same reports, and a run with no setup still has test=None, so _finish writes nothing
    • The only _Run(...) construction is the new one at plugin.py:155, so the new field defaults break no caller
  • Socialization
    • Plugin lives in torch.testing._internal.torchci and is opt-in via --save-torchci-reports, which no CI script passes
    • Record shape is unchanged; only the wrong passed outcome for a failing subtest under reruns is corrected

reason: clean
Reviewed commit: 4190f3b

Inference job

🐛 Report a wrong verdict

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@georgehong georgehong changed the title [torchci] Record failing subtests under pytest-rerunfailures [torchci] Record failing subtest under pytest-rerunfailures Oct 12, 2026
@georgehong georgehong added ciflow/trunk Trigger trunk jobs on your pull request topic: not user facing topic category labels Oct 12, 2026
[ghstack-poisoned]
@georgehong
georgehong requested review from huydhn and jathu October 12, 2026 15:50
@georgehong
georgehong marked this pull request as ready for review October 12, 2026 15:51
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #200470

pytorchmergebot pushed a commit that referenced this pull request Oct 12, 2026
…ructure (#200470)

Uploads jsonl reports in a flat directory structure:
```
s3://gha-artifacts/torchci-reports/<org>/<repo>/<run id>/<job id>/<file>-<uuid>.report.jsonl
```

This allows for us to lookup original report sources more easily, without having to unzip targets. If the ClickHouse user has a report UUID and job info, S3 lookup can be done through the above path. This means per-object writes are more frequent, but this also matches existing examples of test-jsons-while-running granularity.

ROCm jobs skip S3 (`skip-s3`), so they upload their reports as a GitHub artifact, `torchci-reports-runattempt<N>-<job id>.zip`, as does any job whose junit S3 upload fails. When the attempt completes, upload-test-stats runs `tools/stats/upload_artifacts.py`, which copies each report to the same S3 path. The copy is best effort, so a failed download or upload can't skip the test stats upload. It also skips other attempts' artifacts: the run's artifact list includes them, but their own attempt already uploaded them.

Authored with the help of an AI assistant (Claude).
Pull Request resolved: #200470
Approved by: https://github.com/jathu
ghstack dependencies: #200570
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants