Merge pull request #1451 from abderrahim/init-remote-caches
Only show the Initializing remote caches message once
diff --git a/src/buildstream/_assetcache.py b/src/buildstream/_assetcache.py
index 66e2182..e096c5f 100644
--- a/src/buildstream/_assetcache.py
+++ b/src/buildstream/_assetcache.py
@@ -327,19 +327,18 @@
# Hold on to the project specs
self._project_specs = project_specs
- with self.context.messenger.timed_activity("Initializing remote caches", silent_nested=True):
- for spec in specs:
- # This can be called multiple times, ensure that we only try
- # to instantiate each remote once.
- #
- if spec in self._remotes:
- continue
+ for spec in specs:
+ # This can be called multiple times, ensure that we only try
+ # to instantiate each remote once.
+ #
+ if spec in self._remotes:
+ continue
- remote = RemotePair(self.cas, spec)
- if remote.error:
- self.context.messenger.warn("Failed to initialize remote {}: {}".format(spec.url, remote.error))
+ remote = RemotePair(self.cas, spec)
+ if remote.error:
+ self.context.messenger.warn("Failed to initialize remote {}: {}".format(spec.url, remote.error))
- self._remotes[spec] = remote
+ self._remotes[spec] = remote
# Determine overall existance of push or fetch remotes
self._has_fetch_remotes = any(remote.storage for _, remote in self._remotes.items()) and any(
diff --git a/src/buildstream/_context.py b/src/buildstream/_context.py
index 1dc89c5..7a46caa 100644
--- a/src/buildstream/_context.py
+++ b/src/buildstream/_context.py
@@ -593,9 +593,10 @@
# Now initialize the underlying asset caches
#
- self.artifactcache.setup_remotes(self._active_artifact_cache_specs, self.project_artifact_cache_specs)
- self.elementsourcescache.setup_remotes(self._active_source_cache_specs, self.project_source_cache_specs)
- self.sourcecache.setup_remotes(self._active_source_cache_specs, self.project_source_cache_specs)
+ with self.messenger.timed_activity("Initializing remote caches", silent_nested=True):
+ self.artifactcache.setup_remotes(self._active_artifact_cache_specs, self.project_artifact_cache_specs)
+ self.elementsourcescache.setup_remotes(self._active_source_cache_specs, self.project_source_cache_specs)
+ self.sourcecache.setup_remotes(self._active_source_cache_specs, self.project_source_cache_specs)
# get_workspaces():
#