Fix caching of binary lookups and avoid re-running pytest setup for environment changes (cherrypick of #13559)#13560
Merged
Conversation
… environment changes (pantsbuild#13559) Two issues were causing re-runs of `test` to do more work than expected: 1. The `"Test binary $x"` `Process` expects to fail in many cases, but was marked `ProcessCacheScope.PER_RESTART_SUCCESSFUL`, meaning that failures would be re-executed in each run. * Switched to `PER_RESTART_ALWAYS`. This should improve performance for all runs, including `test`. 2. `setup_pytest_for_target` was consuming the `CompleteEnvironment` in order to filter it for individual `python_test` targets. This meant that it re-ran for any environment change, rather than only for relevant changed environment variables. * Switched to requesting a filtered relevant `Environment` via `EnvironmentRequest`, and improved the docs. Additionally, add a log message at `DEBUG` level to help with triaging why `@rule`s are re-running. After these changes, iterating on a single test with `-ldebug` and no filesystem changes shows only expected re-runs of `@rule`s (for `Environment` filtering). Fixes pantsbuild#13551.
Eric-Arellano
approved these changes
Nov 10, 2021
Member
Author
|
I'll get a pick out for #13528 first. |
Contributor
|
Ah, thanks! |
Member
Author
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two issues were causing re-runs of
testto do more work than expected:"Test binary $x"Processexpects to fail in many cases, but was markedProcessCacheScope.PER_RESTART_SUCCESSFUL, meaning that failures would be re-executed in each run.PER_RESTART_ALWAYS. This should improve performance for all runs, includingtest.setup_pytest_for_targetwas consuming theCompleteEnvironmentin order to filter it for individualpython_testtargets. This meant that it re-ran for any environment change, rather than only for relevant changed environment variables.EnvironmentviaEnvironmentRequest, and improved the docs.Additionally, add a log message at
DEBUGlevel to help with triaging why@rules are re-running.After these changes, iterating on a single test with
-ldebugand no filesystem changes shows only expected re-runs of@rules (forEnvironmentfiltering). Fixes #13551.