Remove verbose warning message from _try_install_from_binary_cache (#34994)

In the past we checked remote binary mirrors for existence of a spec
before attempting to download it. That changed to only checking local
copies of index.jsons (if available) to prioritize certain mirrors where
we expect to find a tarball. That was faster for CI since fetching
index.json and loading it just to order mirrors takes more time than
just attempting to fetch tarballs -- and also if we have a direct hit
there's no point to look at other mirrors.

Long story short: the info message only makes sense in the old version
of Spack, so it's better to remove it.
This commit is contained in:
Harmen Stoppels 2023-01-18 15:25:48 +01:00 committed by GitHub
parent 548aa21b18
commit 3bc943ae51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 41 deletions

View file

@ -364,14 +364,13 @@ def _process_external_package(pkg, explicit):
def _process_binary_cache_tarball( def _process_binary_cache_tarball(
pkg, binary_spec, explicit, unsigned, mirrors_for_spec=None, timer=timer.NULL_TIMER pkg, explicit, unsigned, mirrors_for_spec=None, timer=timer.NULL_TIMER
): ):
""" """
Process the binary cache tarball. Process the binary cache tarball.
Args: Args:
pkg (spack.package_base.PackageBase): the package being installed pkg (spack.package_base.PackageBase): the package being installed
binary_spec (spack.spec.Spec): the spec whose cache has been confirmed
explicit (bool): the package was explicitly requested by the user explicit (bool): the package was explicitly requested by the user
unsigned (bool): ``True`` if binary package signatures to be checked, unsigned (bool): ``True`` if binary package signatures to be checked,
otherwise, ``False`` otherwise, ``False``
@ -383,29 +382,23 @@ def _process_binary_cache_tarball(
bool: ``True`` if the package was extracted from binary cache, bool: ``True`` if the package was extracted from binary cache,
else ``False`` else ``False``
""" """
timer.start("fetch") with timer.measure("fetch"):
download_result = binary_distribution.download_tarball( download_result = binary_distribution.download_tarball(
binary_spec, unsigned, mirrors_for_spec=mirrors_for_spec pkg.spec, unsigned, mirrors_for_spec
) )
timer.stop("fetch")
# see #10063 : install from source if tarball doesn't exist
if download_result is None: if download_result is None:
tty.msg("{0} exists in binary cache but with different hash".format(pkg.name))
return False return False
pkg_id = package_id(pkg) tty.msg("Extracting {0} from binary cache".format(package_id(pkg)))
tty.msg("Extracting {0} from binary cache".format(pkg_id))
# don't print long padded paths while extracting/relocating binaries with timer.measure("install"), spack.util.path.filter_padding():
timer.start("install")
with spack.util.path.filter_padding():
binary_distribution.extract_tarball( binary_distribution.extract_tarball(
binary_spec, download_result, allow_root=False, unsigned=unsigned, force=False pkg.spec, download_result, allow_root=False, unsigned=unsigned, force=False
) )
pkg.installed_from_binary_cache = True pkg.installed_from_binary_cache = True
spack.store.db.add(pkg.spec, spack.store.layout, explicit=explicit) spack.store.db.add(pkg.spec, spack.store.layout, explicit=explicit)
timer.stop("install")
return True return True
@ -424,16 +417,13 @@ def _try_install_from_binary_cache(pkg, explicit, unsigned=False, timer=timer.NU
if not spack.mirror.MirrorCollection(): if not spack.mirror.MirrorCollection():
return False return False
pkg_id = package_id(pkg) tty.debug("Searching for binary cache of {0}".format(package_id(pkg)))
tty.debug("Searching for binary cache of {0}".format(pkg_id))
timer.start("search") with timer.measure("search"):
matches = binary_distribution.get_mirrors_for_spec(pkg.spec, index_only=True) matches = binary_distribution.get_mirrors_for_spec(pkg.spec, index_only=True)
timer.stop("search")
return _process_binary_cache_tarball( return _process_binary_cache_tarball(
pkg, pkg,
pkg.spec,
explicit, explicit,
unsigned, unsigned,
mirrors_for_spec=matches, mirrors_for_spec=matches,

View file

@ -205,16 +205,6 @@ def test_process_external_package_module(install_mockery, monkeypatch, capfd):
assert "has external module in {0}".format(spec.external_modules) in out assert "has external module in {0}".format(spec.external_modules) in out
def test_process_binary_cache_tarball_none(install_mockery, monkeypatch, capfd):
"""Tests of _process_binary_cache_tarball when no tarball."""
monkeypatch.setattr(spack.binary_distribution, "download_tarball", _none)
s = spack.spec.Spec("trivial-install-test-package").concretized()
assert not inst._process_binary_cache_tarball(s.package, None, False, False)
assert "exists in binary cache but" in capfd.readouterr()[0]
def test_process_binary_cache_tarball_tar(install_mockery, monkeypatch, capfd): def test_process_binary_cache_tarball_tar(install_mockery, monkeypatch, capfd):
"""Tests of _process_binary_cache_tarball with a tar file.""" """Tests of _process_binary_cache_tarball with a tar file."""
@ -229,7 +219,7 @@ def _spec(spec, unsigned=False, mirrors_for_spec=None):
monkeypatch.setattr(spack.database.Database, "add", _noop) monkeypatch.setattr(spack.database.Database, "add", _noop)
spec = spack.spec.Spec("a").concretized() spec = spack.spec.Spec("a").concretized()
assert inst._process_binary_cache_tarball(spec.package, spec, False, False) assert inst._process_binary_cache_tarball(spec.package, explicit=False, unsigned=False)
out = capfd.readouterr()[0] out = capfd.readouterr()[0]
assert "Extracting a" in out assert "Extracting a" in out