[Notes] [Git][BuildStream/buildstream][bst-1.2] 4 commits: element.py: Make Element._get_brief_display_key() available to Internal API



Title: GitLab

Qinusty pushed to branch bst-1.2 at BuildStream / buildstream

Commits:

2 changed files:

Changes:

  • buildstream/_artifactcache/cascache.py
    ... ... @@ -221,6 +221,8 @@ class CASCache(ArtifactCache):
    221 221
                 try:
    
    222 222
                     remote.init()
    
    223 223
     
    
    224
    +                element.info("Pulling {} <- {}".format(element._get_brief_display_key(), remote.spec.url))
    
    225
    +
    
    224 226
                     request = buildstream_pb2.GetReferenceRequest()
    
    225 227
                     request.key = ref
    
    226 228
                     response = remote.ref_storage.GetReference(request)
    
    ... ... @@ -263,6 +265,8 @@ class CASCache(ArtifactCache):
    263 265
             for remote in push_remotes:
    
    264 266
                 remote.init()
    
    265 267
     
    
    268
    +            element.info("Pushing {} -> {}".format(element._get_brief_display_key(), remote.spec.url))
    
    269
    +
    
    266 270
                 try:
    
    267 271
                     for ref in refs:
    
    268 272
                         tree = self.resolve_ref(ref)
    
    ... ... @@ -276,6 +280,8 @@ class CASCache(ArtifactCache):
    276 280
     
    
    277 281
                             if response.digest.hash == tree.hash and response.digest.size_bytes == tree.size_bytes:
    
    278 282
                                 # ref is already on the server with the same tree
    
    283
    +                            element.info("Skipping {}, remote ({}) already has artifact cached".format(
    
    284
    +                                element._get_brief_display_key(), remote.spec.url))
    
    279 285
                                 continue
    
    280 286
     
    
    281 287
                         except grpc.RpcError as e:
    

  • buildstream/element.py
    ... ... @@ -618,7 +618,7 @@ class Element(Plugin):
    618 618
             # Time to use the artifact, check once more that it's there
    
    619 619
             self.__assert_cached()
    
    620 620
     
    
    621
    -        with self.timed_activity("Staging {}/{}".format(self.name, self.__get_brief_display_key())):
    
    621
    +        with self.timed_activity("Staging {}/{}".format(self.name, self._get_brief_display_key())):
    
    622 622
                 # Get the extracted artifact
    
    623 623
                 artifact_base, _ = self.__extract()
    
    624 624
                 artifact = os.path.join(artifact_base, 'files')
    
    ... ... @@ -1157,6 +1157,19 @@ class Element(Plugin):
    1157 1157
             length = min(len(cache_key), context.log_key_length)
    
    1158 1158
             return (cache_key, cache_key[0:length], dim_key)
    
    1159 1159
     
    
    1160
    +    # _get_brief_display_key()
    
    1161
    +    #
    
    1162
    +    # Returns an abbreviated cache key for display purposes
    
    1163
    +    #
    
    1164
    +    # Returns:
    
    1165
    +    #    (str): An abbreviated hex digest cache key for this Element
    
    1166
    +    #
    
    1167
    +    # Question marks are returned if information for the cache key is missing.
    
    1168
    +    #
    
    1169
    +    def _get_brief_display_key(self):
    
    1170
    +        _, display_key, _ = self._get_display_key()
    
    1171
    +        return display_key
    
    1172
    +
    
    1160 1173
         # _preflight():
    
    1161 1174
         #
    
    1162 1175
         # A wrapper for calling the abstract preflight() method on
    
    ... ... @@ -1631,7 +1644,7 @@ class Element(Plugin):
    1631 1644
                 return False
    
    1632 1645
     
    
    1633 1646
             # Notify successfull download
    
    1634
    -        display_key = self.__get_brief_display_key()
    
    1647
    +        display_key = self._get_brief_display_key()
    
    1635 1648
             self.info("Downloaded artifact {}".format(display_key))
    
    1636 1649
             return True
    
    1637 1650
     
    
    ... ... @@ -1671,14 +1684,14 @@ class Element(Plugin):
    1671 1684
                 self.warn("Not pushing tainted artifact.")
    
    1672 1685
                 return False
    
    1673 1686
     
    
    1674
    -        with self.timed_activity("Pushing artifact"):
    
    1687
    +        display_key = self._get_brief_display_key()
    
    1688
    +        with self.timed_activity("Pushing artifact {}".format(display_key)):
    
    1675 1689
                 # Push all keys used for local commit
    
    1676 1690
                 pushed = self.__artifacts.push(self, self.__get_cache_keys_for_commit())
    
    1677 1691
                 if not pushed:
    
    1678 1692
                     return False
    
    1679 1693
     
    
    1680 1694
                 # Notify successful upload
    
    1681
    -            display_key = self.__get_brief_display_key()
    
    1682 1695
                 self.info("Pushed artifact {}".format(display_key))
    
    1683 1696
                 return True
    
    1684 1697
     
    
    ... ... @@ -1954,19 +1967,6 @@ class Element(Plugin):
    1954 1967
         def __can_build_incrementally(self):
    
    1955 1968
             return bool(self._get_workspace())
    
    1956 1969
     
    
    1957
    -    # __get_brief_display_key():
    
    1958
    -    #
    
    1959
    -    # Returns an abbreviated cache key for display purposes
    
    1960
    -    #
    
    1961
    -    # Returns:
    
    1962
    -    #    (str): An abbreviated hex digest cache key for this Element
    
    1963
    -    #
    
    1964
    -    # Question marks are returned if information for the cache key is missing.
    
    1965
    -    #
    
    1966
    -    def __get_brief_display_key(self):
    
    1967
    -        _, display_key, _ = self._get_display_key()
    
    1968
    -        return display_key
    
    1969
    -
    
    1970 1970
         # __prepare():
    
    1971 1971
         #
    
    1972 1972
         # Internal method for calling public abstract prepare() method.
    
    ... ... @@ -1989,7 +1989,7 @@ class Element(Plugin):
    1989 1989
         # Raises an error if the artifact is not cached.
    
    1990 1990
         #
    
    1991 1991
         def __assert_cached(self):
    
    1992
    -        assert self._cached(), "{}: Missing artifact {}".format(self, self.__get_brief_display_key())
    
    1992
    +        assert self._cached(), "{}: Missing artifact {}".format(self, self._get_brief_display_key())
    
    1993 1993
     
    
    1994 1994
         # __get_tainted():
    
    1995 1995
         #
    



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]