Skip to content

Fix caching of binary lookups and avoid re-running pytest setup for environment changes (cherrypick of #13559)#13560

Merged
stuhood merged 1 commit into
pantsbuild:2.7.xfrom
stuhood:stuhood/pick-13559-for-2.7.x
Nov 10, 2021
Merged

Fix caching of binary lookups and avoid re-running pytest setup for environment changes (cherrypick of #13559)#13560
stuhood merged 1 commit into
pantsbuild:2.7.xfrom
stuhood:stuhood/pick-13559-for-2.7.x

Conversation

@stuhood
Copy link
Copy Markdown
Member

@stuhood stuhood commented Nov 10, 2021

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 @rules are re-running.

After these changes, iterating on a single test with -ldebug and no filesystem changes shows only expected re-runs of @rules (for Environment filtering). Fixes #13551.

… 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.
@stuhood
Copy link
Copy Markdown
Member Author

stuhood commented Nov 10, 2021

I'll get a pick out for #13528 first.

@Eric-Arellano
Copy link
Copy Markdown
Contributor

Ah, thanks!

@stuhood
Copy link
Copy Markdown
Member Author

stuhood commented Nov 10, 2021

#13562

@stuhood stuhood merged commit 14cda20 into pantsbuild:2.7.x Nov 10, 2021
@stuhood stuhood deleted the stuhood/pick-13559-for-2.7.x branch November 10, 2021 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants