diff --git a/dedal/bll/SpackManager.py b/dedal/bll/SpackManager.py index e5fae221c7093bff86a4adf541e4664fda353dff..075d7518f72a3f7480c0a67f365fc08e510e88ca 100644 --- a/dedal/bll/SpackManager.py +++ b/dedal/bll/SpackManager.py @@ -17,7 +17,7 @@ class SpackManager: return SpackOperationCreator.get_spack_operator(self._spack_config, self._use_cache) def install_spack(self, version: str, bashrc_path=os.path.expanduser("~/.bashrc")): - self._get_spack_operation().install_spack(spack_version=f'v{version}', bashrc_path=bashrc_path) + self._get_spack_operation().install_spack(spack_version=f'{version}', bashrc_path=bashrc_path) def add_spack_repo(self, repo: SpackDescriptor): """ diff --git a/dedal/build_cache/BuildCacheManager.py b/dedal/build_cache/BuildCacheManager.py index 98fd234de0ec5282dbde338608371a09fb49d049..63b8b455775c3bbfcb7e588af1e75040c568b611 100644 --- a/dedal/build_cache/BuildCacheManager.py +++ b/dedal/build_cache/BuildCacheManager.py @@ -83,7 +83,7 @@ class BuildCacheManager(BuildCacheManagerInterface): return self._client.get_tags(self._oci_registry_path) except Exception as e: self._logger.error(f"Failed to list tags: {e}") - return None + return [] def download(self, download_dir: Path): """ diff --git a/dedal/spack_factory/SpackOperation.py b/dedal/spack_factory/SpackOperation.py index b0c0a78b8fd75cca7f989eb838c71f5ed574b444..ca7175721040e77429f232852b5bcb469f70251f 100644 --- a/dedal/spack_factory/SpackOperation.py +++ b/dedal/spack_factory/SpackOperation.py @@ -363,7 +363,7 @@ class SpackOperation: log_command(install_result, str(Path(os.getcwd()).resolve() / ".generate_cache.log")) return install_result - def install_spack(self, spack_version=f'v{SPACK_VERSION}', spack_repo='https://github.com/spack/spack', + def install_spack(self, spack_version=f'{SPACK_VERSION}', spack_repo='https://github.com/spack/spack', bashrc_path=os.path.expanduser("~/.bashrc")): """Install spack. Args: @@ -371,6 +371,7 @@ class SpackOperation: spack_repo (str): Git path to the Spack repository. bashrc_path (str): Path to the .bashrc file. """ + spack_version = f'v{spack_version}' try: user = os.getlogin() except OSError: diff --git a/dedal/spack_factory/SpackOperationUseCache.py b/dedal/spack_factory/SpackOperationUseCache.py index 751945980f0fdd98923f43182ea89b2a639774f2..45c0ab4f189f8d5d35f0e2f53f84f31f64171df5 100644 --- a/dedal/spack_factory/SpackOperationUseCache.py +++ b/dedal/spack_factory/SpackOperationUseCache.py @@ -60,7 +60,6 @@ class SpackOperationUseCache(SpackOperation): NoSpackEnvironmentException: If the spack environment is not set up. """ concretization_redo = False - self.cache_dependency.download(self.spack_config.concretization_dir) if file_exists_and_not_empty(self.spack_config.concretization_dir / 'spack.lock'): concretization_file_path = self.env_path / 'spack.lock' copy_file(self.spack_config.concretization_dir / 'spack.lock', self.env_path) @@ -72,6 +71,10 @@ class SpackOperationUseCache(SpackOperation): # redo the concretization step if spack.lock file was not downloaded from the cache super().concretize_spack_env(force=True, test=test) concretization_redo = True + if concretization_redo is True: + self.logger.info(f'Redo of concretization step.') + else: + self.logger.info(f'USed concretization from cache.') return concretization_redo @check_spack_env @@ -94,4 +97,5 @@ class SpackOperationUseCache(SpackOperation): exception_msg=f"Error installing spack packages for {self.spack_config.env.name}", exception=SpackInstallPackagesException) log_command(install_result, str(Path(os.getcwd()).resolve() / ".generate_cache.log")) + self.logger.info(f'Finished installation of spack packages from cache.') return install_result diff --git a/dedal/tests/integration_tests/spack_install_test.py b/dedal/tests/integration_tests/spack_install_test.py index 0c6cf1273cf57b5ccb82e4c4cd79fc913aebeaaf..b0e42ae0f88cbdd0fee5588058d60d0d7a6f393a 100644 --- a/dedal/tests/integration_tests/spack_install_test.py +++ b/dedal/tests/integration_tests/spack_install_test.py @@ -7,6 +7,7 @@ def test_spack_install_scratch(tmp_path): install_dir = tmp_path spack_config = SpackConfig(install_dir=install_dir) spack_operation = SpackOperation(spack_config) - spack_operation.install_spack(spack_version=f'v{SPACK_VERSION}') + spack_operation.install_spack(spack_version=f'{SPACK_VERSION}') installed_spack_version = spack_operation.get_spack_installed_version() assert SPACK_VERSION == installed_spack_version +