-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing starlark build setting always discards the analysis cache. #13591
Comments
This is true for most flags (not just Starlark flags). I agree that we should expand the benefit of bazel/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java Lines 327 to 332 in 4801bf5
The referenced bug refers to some arcane technical details about Bazel's execution engine. Basically a previous build's action output may not be triggered to reflect the flag change, which would harm incremental builds. I can elaborate if you like. But short story is we'd have to address that before expanding this behavior. Where in particular do you consume your flags? If you know only top-level targets (i.e. the binaries requested at their command line, not their deps), read the flags, that could open up an easier path. |
We have two use cases:
If we wanted to combine |
CC @sdtwigg , who's leading |
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
In the meantime we've found a workaround for this: |
@gregestren I would be interested in learning more about the details in b/144932999. |
I realize this is old. But if we're talking about flags we know are only used by the top-level target we have some stronger options. The challenge is providing a generic enough API to capture this. But this particularly is an interesting use case. |
Is it possible to keep at least two or N caches? I found most of the scenario I only have two compilation_mode one with |
I've been thinking about this more and have the following idea. I haven't prototyped it yet, so it's definitely possible that is has a fatal flaw. The goal is to implement the equivalent of Starlark's
Since configured targets only depend on their diff against the respective baseline configuration, Skyframe's change pruning should ensure that the new entries are reused for those targets whose transitive closure does not depend on the changed flags. At the same time, entries that aren't obviously relevant in the new configuration are removed from the graph, thus avoiding the graph from growing indefinitely and, possibly, resolving the remaining correctness issues with analysis cache preservation. |
Description of the problem / feature request:
Changing starlark build settings always discards the analysis cache. It would be nice to have a way of disabling that for certain build settings.
Feature requests: what underlying problem are you trying to solve with this feature?
When using starlark build settings that are limited to certain targets, it would be nice if the analysis cache could be maintained. Similar to
--test_filter
, for certain build settings, the values of the settings might be changed often, but would only cause a small number of additional configured targets to have to be cached. That's why--trim_test_configuration
was introduced.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Create a starlark build setting, change its value, observe
INFO: Build option --//tools/settings:your_setting has changed, discarding analysis cache.
What operating system are you running Bazel on?
What's the output of
bazel info release
?If
bazel info release
returns "development version" or "(@non-git)", tell us how you built Bazel.From https://github.com/NixOS/nixpkgs/blob/0e3229d628b3a1c56cc9279c39e6a40720794773/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix.
Have you found anything relevant by searching the web?
#7466
#6011
#6842 (comment)
The text was updated successfully, but these errors were encountered: