-
Notifications
You must be signed in to change notification settings - Fork 21.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test Reordering: Run previously failing tests first (#101123)
Makes the CI prioritize running any test files that had a failing test in a previous iteration of the given PR. A follow up to #100522 which makes the `.pytest_cache` available to use here A concrete example: 1. Person A pushes a new commit and creates a PR. 2. 2 hours later, test_im_now_broken.py fails 3. Person A attempts to fix the test, but the test is actually still broken 4. The CI, seeing that test_im_now_broken.py had failed on a previous run, will now prioritize running that test first. Instead of waiting another 2 hours to get a signal, Person A only needs to wait ~15 minutes (which is how long it takes for tests to start running) # Testing I modified a file to make the tests invoking it fail and triggered CI twice with this failure. First run: https://github.com/pytorch/pytorch/actions/runs/4963943209/jobs/8883800811 Test step took 1h 9m to run Second run: https://github.com/pytorch/pytorch/actions/runs/4965016776/jobs/8885657992 Test step failed within 2m 27s Pull Request resolved: #101123 Approved by: https://github.com/malfet, https://github.com/huydhn
- Loading branch information
1 parent
b5ed606
commit b147401
Showing
3 changed files
with
207 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
def pluralize(count: int, singular_word: str, plural_word: str = "") -> str: | ||
if count == 1: | ||
return f"{count} {singular_word}" | ||
|
||
if not plural_word: | ||
plural_word = f"{singular_word}s" | ||
|
||
return f"{count} {plural_word}" | ||
|
||
|
||
def duration_to_str(seconds: float) -> str: | ||
if seconds < 0.00001: | ||
return "0s" | ||
elif seconds < 60: | ||
return f"{seconds:.1f}s" | ||
elif seconds < 3600: | ||
return f"{seconds / 60:.1f}m" | ||
else: | ||
return f"{seconds / 3600:.1f}h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters