-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[workspace] Elevate drake_models to public visibility #19104
[workspace] Elevate drake_models to public visibility #19104
Conversation
Update version control documentation to match. Simplify its package.BUILD.bazel, to better match how a bare ROS package would work (just a pile of bare files). Enhance the drake_bazel_installed workflow to provide drake_models as an external repository to avoid extra downloading at runtime. Remove the models pre-fetching from the drake_bazel_installed_test. We still meet the DRAKE_ALLOW_NETWORK=none criterion (i.e., PackageMap does not download anything) because the bazel repository rules fetch the models now, which isn't part of what's governed.
+@rpoyner-tri for feature review, please. (We'll tap Xuchen for platform after feature is done.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moderate regret for statically listing all the files, but I realize that's probably the right interface for a public dependency.
Reviewed 29 of 29 files at r1, all commit messages.
Reviewable status: needs at least two assigned reviewers (waiting on @jwnimmer-tri)
+@xuchenhan-tri for platform review per schedule, please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moderate regret for statically listing all the files, but I realize that's probably the right interface for a public dependency.
Can someone explain why statically listing all files is better than globbing everything in a directory, even when the list is tediously long?
Reviewed 29 of 29 files at r1, all commit messages.
Reviewable status: 1 unresolved discussion (waiting on @jwnimmer-tri)
-- commits
line 10 at r1:
BTW, what about non-bazel workflows. When does model downloading for those happen?
Code quote:
Enhance the drake_bazel_installed workflow to provide drake_models as
an external repository to avoid extra downloading at runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can someone explain why statically listing all files is better than globbing everything in a directory, ...
You can only glob within your own bazel package, i.e., where your BUILD.bazel file lives. Trying to glob someone else's package is an error.
... even when the list is tediously long?
Hah. This is nothing. Personally, I think listing out a dozen files when writing an example program is way easier than trying to debug why someone's glob() has gone awry and not found what they wanted it to find. BUILD files should be direct and explicit, for clarity.
Reviewable status: 1 unresolved discussion (waiting on @xuchenhan-tri)
Previously, xuchenhan-tri wrote…
BTW, what about non-bazel workflows. When does model downloading for those happen?
When building Drake from source via Bazel (e.g., in Anzu), the model downloading happens via repository rules at "bazel fetch" time (which itself happens implicitly as part of "bazel build"). Our C++ code never downloads anything in this case.
In most other cases, package://drake_models
is downloaded on demand the first time someone calls package_map.GetPath("drake_models")
, and then cached for future use so there are no more downloads (of that git version pin). This is what happens for apt or pip users -- the download cached into their $HOME/.cache
directory or alike.
The problem this PR solves (in part) is when someone is using a Drake binary release but doing it via Bazel. In that case, tests cannot write to $HOME/.cache
(because of sandboxing) so even though the download happens and the test passes, there is no caching so it's downloaded over and over again, for any test that happens to use those models. We solve it here for anyone using the drake_bazel_external
pattern from drake-external-examples. What still remains to be solved is how to solve it for drake binary + bazel users who are not using that ruleset (e.g., if they are using rules_python
with pip instead).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can only glob within your own bazel package, i.e., where your BUILD.bazel file lives. Trying to glob someone else's package is an error.
Thanks for the reference. Is it possible for the model directory to glob the mtl/obj/other files and export them for easy consumption of the drake BUILD file?
Reviewable status:
complete! all discussions resolved, LGTM from assignees rpoyner-tri(platform),xuchenhan-tri(platform) (waiting on @jwnimmer-tri)
Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
When building Drake from source via Bazel (e.g., in Anzu), the model downloading happens via repository rules at "bazel fetch" time (which itself happens implicitly as part of "bazel build"). Our C++ code never downloads anything in this case.
In most other cases,
package://drake_models
is downloaded on demand the first time someone callspackage_map.GetPath("drake_models")
, and then cached for future use so there are no more downloads (of that git version pin). This is what happens for apt or pip users -- the download cached into their$HOME/.cache
directory or alike.The problem this PR solves (in part) is when someone is using a Drake binary release but doing it via Bazel. In that case, tests cannot write to
$HOME/.cache
(because of sandboxing) so even though the download happens and the test passes, there is no caching so it's downloaded over and over again, for any test that happens to use those models. We solve it here for anyone using thedrake_bazel_external
pattern from drake-external-examples. What still remains to be solved is how to solve it for drake binary + bazel users who are not using that ruleset (e.g., if they are usingrules_python
with pip instead).
The explanation is very helpful. Thank you!
Yes it's possible in Bazel in general, but I am purposefully avoiding it. The design I am aiming for is that |
Towards #15774.
Towards #19094 -- this fixes the
drake_bazel_installed
but notrules_python
.(Sorry, I know this is like the third time I've rewritten this code in the past two weeks.)
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)