summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Smith <joshsmith@codethink.co.uk>2018-07-19 16:28:05 +0100
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-07-23 09:22:39 +0000
commit6559db4c6cebef78d3070bfe40fe1e2bfbf47ee8 (patch)
tree4ab1bb72dd88e166f8fd6380d2bac0106d24188b
parentfe0df616d21395ec2a2ebb70ef79cf5d2a3c9d21 (diff)
downloadbuildstream-6559db4c6cebef78d3070bfe40fe1e2bfbf47ee8.tar.gz
element.py: Make Element._get_brief_display_key() available to Internal API
This change will allow for more detailed info messages throughout the CASCache.
-rw-r--r--buildstream/element.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index 5da14a93d..4b23e0ece 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -613,7 +613,7 @@ class Element(Plugin):
# Time to use the artifact, check once more that it's there
self.__assert_cached()
- with self.timed_activity("Staging {}/{}".format(self.name, self.__get_brief_display_key())):
+ with self.timed_activity("Staging {}/{}".format(self.name, self._get_brief_display_key())):
# Get the extracted artifact
artifact_base, _ = self.__extract()
artifact = os.path.join(artifact_base, 'files')
@@ -1148,6 +1148,19 @@ class Element(Plugin):
length = min(len(cache_key), context.log_key_length)
return (cache_key, cache_key[0:length], dim_key)
+ # _get_brief_display_key()
+ #
+ # Returns an abbreviated cache key for display purposes
+ #
+ # Returns:
+ # (str): An abbreviated hex digest cache key for this Element
+ #
+ # Question marks are returned if information for the cache key is missing.
+ #
+ def _get_brief_display_key(self):
+ _, display_key, _ = self._get_display_key()
+ return display_key
+
# _preflight():
#
# A wrapper for calling the abstract preflight() method on
@@ -1622,7 +1635,7 @@ class Element(Plugin):
return False
# Notify successfull download
- display_key = self.__get_brief_display_key()
+ display_key = self._get_brief_display_key()
self.info("Downloaded artifact {}".format(display_key))
return True
@@ -1662,14 +1675,14 @@ class Element(Plugin):
self.warn("Not pushing tainted artifact.")
return False
- with self.timed_activity("Pushing artifact"):
+ display_key = self._get_brief_display_key()
+ with self.timed_activity("Pushing artifact {}".format(display_key)):
# Push all keys used for local commit
pushed = self.__artifacts.push(self, self.__get_cache_keys_for_commit())
if not pushed:
return False
# Notify successful upload
- display_key = self.__get_brief_display_key()
self.info("Pushed artifact {}".format(display_key))
return True
@@ -1945,19 +1958,6 @@ class Element(Plugin):
def __can_build_incrementally(self):
return bool(self._get_workspace())
- # __get_brief_display_key():
- #
- # Returns an abbreviated cache key for display purposes
- #
- # Returns:
- # (str): An abbreviated hex digest cache key for this Element
- #
- # Question marks are returned if information for the cache key is missing.
- #
- def __get_brief_display_key(self):
- _, display_key, _ = self._get_display_key()
- return display_key
-
# __prepare():
#
# Internal method for calling public abstract prepare() method.
@@ -1980,7 +1980,7 @@ class Element(Plugin):
# Raises an error if the artifact is not cached.
#
def __assert_cached(self):
- assert self._cached(), "{}: Missing artifact {}".format(self, self.__get_brief_display_key())
+ assert self._cached(), "{}: Missing artifact {}".format(self, self._get_brief_display_key())
# __get_tainted():
#