summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-03-07 19:14:44 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-03-07 20:44:37 +0900
commit7fdddf30992efb9f2a88686638f997208b01d0f2 (patch)
tree4ab5752c1d925978b55341f9f7e467fd7c5b1d67
parent141484fc3b17d558d053ccb11de2d24c632f09a6 (diff)
downloadbuildstream-7fdddf30992efb9f2a88686638f997208b01d0f2.tar.gz
Silence messages from Source cache interrogation
Source interrogation usually involves calling out to host tools to quickly check if a given ref exists. This has however regressed over time when running `bst build --track`. This patch adds a new context manager to silence the messages, and silences messages while calling `Source.get_consistency()` Fixes #280
-rw-r--r--buildstream/_context.py13
-rw-r--r--buildstream/source.py6
2 files changed, 18 insertions, 1 deletions
diff --git a/buildstream/_context.py b/buildstream/_context.py
index 332b2c020..3f5a4d62f 100644
--- a/buildstream/_context.py
+++ b/buildstream/_context.py
@@ -343,6 +343,19 @@ class Context():
self._message_handler(message, context=self)
return
+ # _silence()
+ #
+ # A context manager to silence messages, this behaves in
+ # the same way as the `silent_nested` argument of the
+ # Context._timed_activity() context manager: especially
+ # important messages will not be silenced.
+ #
+ @contextmanager
+ def _silence(self):
+ self._push_message_depth(True)
+ yield
+ self._pop_message_depth()
+
# _timed_activity()
#
# Context manager for performing timed activities and logging those
diff --git a/buildstream/source.py b/buildstream/source.py
index d8c36ba99..849227967 100644
--- a/buildstream/source.py
+++ b/buildstream/source.py
@@ -296,7 +296,11 @@ class Source(Plugin):
return
if self.__consistency < Consistency.CACHED:
- self.__consistency = self.get_consistency()
+
+ # Source consistency interrogations are silent.
+ context = self._get_context()
+ with context._silence():
+ self.__consistency = self.get_consistency()
if self._has_workspace() and \
self.__consistency > Consistency.INCONSISTENT: