Generalize buildcache fetching#50596
Conversation
86d8c4e to
d6b7f92
Compare
|
@spackbot fix style |
|
Let me see if I can fix that for you! |
|
I was able to run spack style --fix==> Running style checks on spack
selected: import, isort, black, flake8, mypy
==> Modified files
lib/spack/spack/binary_distribution.py
lib/spack/spack/url_buildcache.py
==> Running import checks
import checks were clean
==> Running isort checks
Fixing /tmp/tmpjs3xv987/spack/lib/spack/spack/binary_distribution.py
Fixing /tmp/tmpjs3xv987/spack/lib/spack/spack/url_buildcache.py
isort checks were clean
==> Running black checks
reformatted lib/spack/spack/url_buildcache.py
All done! ✨ 🍰 ✨
1 file reformatted, 1 file left unchanged.
black checks were clean
==> Running flake8 checks
lib/spack/spack/url_buildcache.py:1150: [F401] 'spack.binary_distribution.buildcache_relative_specs_url' imported but unused
flake8 found errors
==> Running mypy checks
Success: no issues found in 611 source files
mypy checks were clean
I've updated the branch with style fixes. |
0fc3a4c to
96680ef
Compare
ed1fc56 to
cc5c975
Compare
cc5c975 to
38ffd9b
Compare
scottwittenburg
left a comment
There was a problem hiding this comment.
This is looking good @mvandenburgh, thanks! I requested a couple docstring changes and mentioned one other thing for you to look at, hopefully it should be quick.
And one other thing: I don't think that the unit tests run on images with aws installed, can you test that path manually? On a machine where you have the aws command available, you just need to rebuild in the index of a mirror that lives in s3. Since I know you have permission 😜 it could be as simple as:
spack buildcache update-index --keys s3://spack-binaries/develop/build_systems
Feel free to ping me if you have any questions, and thanks again!
880386b to
7b953bf
Compare
|
@scottwittenburg I made a pass on updating the docstrings, PTAL. I also ran the |
scottwittenburg
left a comment
There was a problem hiding this comment.
Thanks for testing the aws code path manually, as it's clear from the coverage report that it's not tested in unit tests. Otherwise, everything else here looks good to me, thanks @mvandenburgh!
Move the functions responsible for retrieving buildcache manifests into the url_buildcache.py module, and generalize the API so that manifests for any type of buildcache component (specs, indices, keys, etc) can be fetched the same way.
This PR moves the functions responsible for retrieving blobs and manifests from a buildcache from
binary_distribution.pyintourl_buildcache.pyand generalizes the API so that any type of "buildcache component" (specs, blobs, indexes, keys, key indexes, tarballs, or layout JSONs) can be fetched. This refactor lays the groundwork for implementing buildcache analysis and pruning.Changes
url_buildcachefunctionsget_entries_from_cache,_entries_from_cache_aws_cli, and_entries_from_cache_fallbackfunctions replace the oldbinary_distributionfunctions_spec_files_from_cache,_specs_from_cache_fallback, and_specs_from_cache_aws_cli, respectively.URLBuildcacheEntry, fetching its manifest, and returning aSpec, theurl_buildcachefunctions now simply construct and return theURLBuildcacheEntrydirectly. Callers can still get aSpecfrom theURLBuildcacheEntrythemselves if needed. This change will allow this function to be used to fetch arbitrary objects from the buildcache instead of being limited to specs.component_type, to allow fetching of any component type (instead of just specs). This parameter defaults toBuildcacheComponent.SPEC, so existing usage of it does not have to change (aside from the function name).Future work