-
Notifications
You must be signed in to change notification settings - Fork 313
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
Bazel: It should be possible to disable the disk cache #8802
Comments
Instead of adding a parameter, would it be an option that ORT simply takes care of creating the directory in case it does not exist? |
I've just tried to reproduce the issue, by deleting Could the problem be a permission issue rather than the non-existance of the dir? |
But did you test with the
Creating this directory works but I don't see how ORT can get the name of this directory? By parsing the Don't forget that some projects can use a custom Bazel RC e.g. |
Oh no, I missed that this step is required. In my view, it could be a good solution to always overwrite any disk cache directory configured in
Maybe a better directory could be choosen. |
One additional question I just came across is whether the content of the cache dir should be re-used across scans on CI. |
Yes I agree: better to use an empty temp directory for disk cache. However I am not sure the commands run by ORT will fill the cache: these are not doing "a real build", no ? |
I'm not into this implementation deeply, but I do recall from the code review that there may be a build involved. As I played around anyway, I quickly made a PR to illustrate my thinking. Let's discuss there |
When the disk-cache is set via `.bazelrc` to a non-existing directory, `bazel mod graph` fails with a complaint about permissions, which in turn makes the analysis fail. The disk cache is a build cache which seems to target speeding up builds in case of code changes (such as switching branches) [1]. During ORT analysis code changes are not in play, so the disk cache seems to be of little use anyway. Simply disable it to avoid running into that permission issue. Fixes: #8802. [1] https://stackoverflow.com/questions/61282419/bazel-how-outputroot-and-disk-cache-relate-regarding-local-caching Signed-off-by: Frank Viernau <[email protected]>
When the disk-cache is set via `.bazelrc` to a non-existing directory, `bazel mod graph` fails with a complaint about permissions, which in turn makes the analysis fail. The disk cache is a build cache which seems to target speeding up builds in case of code changes (such as switching branches) [1]. During ORT analysis code changes are not in play, so the disk cache seems to be of little use anyway. Simply disable it to avoid running into that permission issue. Fixes: #8802. [1] https://stackoverflow.com/questions/61282419/bazel-how-outputroot-and-disk-cache-relate-regarding-local-caching Signed-off-by: Frank Viernau <[email protected]>
When the disk-cache is set via `.bazelrc` to a non-existing directory, `bazel mod graph` fails with a complaint about permissions, which in turn makes the analysis fail. The disk cache is a build cache which seems to target speeding up builds in case of code changes (such as switching branches) [1]. During ORT analysis code changes are not in play, so the disk cache seems to be of little use anyway. Simply disable it to avoid running into that permission issue. Fixes: #8802. [1] https://stackoverflow.com/questions/61282419/bazel-how-outputroot-and-disk-cache-relate-regarding-local-caching Signed-off-by: Frank Viernau <[email protected]>
When the disk-cache is set via `.bazelrc` to a non-existing directory, `bazel mod graph` fails with a complaint about permissions, which in turn makes the analysis fail. The disk cache is a build cache which seems to target speeding up builds in case of code changes (such as switching branches) [1]. During ORT analysis code changes are not in play, so the disk cache seems to be of little use anyway. Simply disable it to avoid running into that permission issue. Fixes: #8802. [1] https://stackoverflow.com/questions/61282419/bazel-how-outputroot-and-disk-cache-relate-regarding-local-caching Signed-off-by: Frank Viernau <[email protected]>
Thanks for the fix @fviernau! |
The user can configure the usage of a disk cache in the .bazelrc file:
The pointed directory can be outside of the repository due to a specific environment.
When the pointed directory does not exist, ORT crashes on any
bazel
command, evenbazel --version
:The workaround (taken here) is to pass
--disk_cache=
as extra parameter to the Bazel commands run by ORT.TBD if it should be configurable or passed every time.
@haikoschol FYI
The text was updated successfully, but these errors were encountered: