-
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
Request API in repository_ctx to download multiple files simultaneously #19674
Comments
This is how Kleaf works around the issue right now (by defining multiple repositories): This feature request blocks DDKv2 development (Internal bug 298416462) |
@meteorcloudy @Wyverald WDYT? I could imagine implementing something like @jacky8hyf How big are your downloads and how many of them are there and what pain do you experience from this? As long as you don't have an enormous number, repository-level parallelization should work, even if it is, as you say, a bit clunky. What I have pretty strong feelings about is that I'd much rather not get into the business of implementing something like Futures ( From that internal bug, do I understand correctly that this is not a hard blocker, "only" a significant usability hurdle? |
I agree this would be a nice feature. But the team is quite overloaded currently, community contribution is welcome! |
I am working on rules to download kernel prebuilts from ci.android.com, and here are some numbers that may provide some context: For a typical GKI build, I need to download 24 files to support external driver developments. The files range from empty (modules_blocklist), a few bytes (e.g. toolchain_version) to hundreds of megabytes (vmlinux, 294M) For a certain build number that involves driver development kit (DDK):
This is correct. |
I think I'm hitting into a use case for this as well, though in my case splitting the downloads across multiple repos doesn't help, as passing a list of labels to a subsequent repo rule seems to still force downloads to happen serially. Details copied from the Slack thread. To add some detail, I'm attempting to write a module extension that downloads several artifacts, extracts them, and then manipulates the output (in a way that's not amenable to e.g. a Initially I went for the obvious implementation ( I tried to work around this by changing it to more of a hub-and-spoke model: the However, this also seems to result in downloads happening serially -- I'm guessing this is because the label attr prefetch mechanism mentioned in the docs. I've got a minimal-ish repro here if it helps clarify the use-case at all. Please let me know if there's anything I've missed that would make the workaround as described ineffective. |
Draft pull request: #20309 |
@bazel-io fork 7.1.0 |
Just wanted to say thanks for developing this feature, it makes it much easier to implement |
We're glad we could help :) |
This is accomplished by adding a "block" argument to the "download" call. If set, the call returns a "pending download" object with one single method that waits for the download to finish. Appropriate care is taken that downloads don't hang around after the repository function finishes running. Fixes bazelbuild#19674 . RELNOTES: None. PiperOrigin-RevId: 588320352 Change-Id: Ib0f48b6c7c2a07e93a4af602b0045120bd418829
This is accomplished by adding a "block" argument to the "download" call. If set, the call returns a "pending download" object with one single method that waits for the download to finish. Appropriate care is taken that downloads don't hang around after the repository function finishes running. Fixes bazelbuild#19674 . RELNOTES: None. PiperOrigin-RevId: 588320352 Change-Id: Ib0f48b6c7c2a07e93a4af602b0045120bd418829
…0856) This is accomplished by adding a "block" argument to the "download" call. If set, the call returns a "pending download" object with one single method that waits for the download to finish. Appropriate care is taken that downloads don't hang around after the repository function finishes running. Fixes #19674 . Commit 73c1a1e RELNOTES: None. PiperOrigin-RevId: 588320352 Change-Id: Ib0f48b6c7c2a07e93a4af602b0045120bd418829 Co-authored-by: Googler <[email protected]>
May I ask if this is enabled on 7.1.0 onwards? We are on 7.0.2 right now so we are looking for the version number to update to. |
Yes, this is in 7.1.0. |
A fix for this issue has been included in Bazel 7.1.0 RC1. Please test out the release candidate and report any issues as soon as possible. Thanks! |
Description of the feature request:
tl;dr: Request an API that is similar to repository_ctx.download, but download multiple files simultaneously.
Which category does this issue belong to?
Core, External Dependency
What underlying problem are you trying to solve with this feature?
Example to reproduce the issue:
my_repo_rule.bzl
WORKSPACE
BUILD
Then run
You can see that the two files are downloaded in serial, not in parallel.
To workaround this issue, one could define two repositories. For example:
my_repo_rule.bzl
WORKSPACE
However, when there are a lot of files, this approach requires creating a lot of repositories.
The benefit of downloading in parallel is:
Without the API to download multiple files, the above can only be done in WORKSPACE only.
I can't hide all these in a single macro because the load statements interleave with the repository definitions.
Which operating system are you running Bazel on?
Linux
What is the output of
bazel info release
?release 6.3.2
If
bazel info release
returnsdevelopment 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 master; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
https://bazel.build/rules/lib/builtins/repository_ctx#download
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: