Selectively silence warnings from the bazel downloader
#23.173 geöffnet am 31. Juli 2024
Repository-Metriken
- Stars
- (25.384 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 22T 20h) (77 gemergte PRs in 30 T)
Beschreibung
Description of the feature request:
Provide a way to silence warnings from the Bazel downloader.
I'm pretty neutral on the implementation. Options include:
- a command line arg that sets the log level for the downloader.
- Eg:
--downloader_logging_level=<0 <= an integer <= 6>mimicking--logging.
- Eg:
- an attribute on https://bazel.build/rules/lib/builtins/module_ctx#download as @aignas suggested in https://github.com/bazelbuild/rules_python/issues/2100
- IMO this is probably the better option, as it can be set on a per-context basis. For example,
rules_pythonwould be updated to silence warnings just for the pip downloads, and then other things using the downloader would still show warnings.
- IMO this is probably the better option, as it can be set on a per-context basis. For example,
- something that you fine folk come up with
Which category does this issue belong to?
Core
What underlying problem are you trying to solve with this feature?
https://github.com/bazelbuild/rules_python/issues/2100
The current implementation of rules_python's experimental "use bazel downloader to download python packages" will search all indexes - the primary index defined by experimental_index_url and all of the indexes defined by experimental_extra_index_urls - for all packages.
However, only one of the python package indexes will contain the given package, and the rest will either not contain the package (404) or will fail auth (401). This results in a lot of WARNING messages:
$ bazel test //src/pyle_xc/fab/package_tester:web_api_test
Starting local Bazel server and connecting to it...
WARNING: Download from https://[REDACTED]/simple/rsa/ failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://[REDACTED]/simple/uv/ failed: class java.io.FileNotFoundException GET returned 404 Not Found
...
For python projects that have a lot of dependencies, this creates a wall of warnings in the terminal.
Current workarounds include:
- use
experimental_index_url_overridesinrules_python- Not super feasible when there are a lot of packages, as now multiple package definitions need to stay in sync (the requirements lock file and MODULE.bazel)
- Use a single virtual repository.
- This causes all packages to be downloaded from a single source and then 404 errors are real.
- I'm trying to convince our software ops team to implement this, but it's slow going :upside_down_face:
Which operating system are you running Bazel on?
gLinux
What is the output of bazel info release?
release 7.2.0
If bazel info release returns development version or (@non-git), tell us how you built Bazel.
No response
What's the output of git remote get-url origin; git rev-parse HEAD ?
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response