[Notes] [Git][BuildStream/buildstream][tiagogomes/issue-573] 3 commits: artifactcache: rename get_quota_exceeded()



Title: GitLab

Tiago Gomes pushed to branch tiagogomes/issue-573 at BuildStream / buildstream

Commits:

2 changed files:

Changes:

  • buildstream/_artifactcache/artifactcache.py
    ... ... @@ -247,7 +247,7 @@ class ArtifactCache():
    247 247
                               "Please increase the cache-quota in {}."
    
    248 248
                               .format(self.context.config_origin or default_conf))
    
    249 249
     
    
    250
    -                if self.get_quota_exceeded():
    
    250
    +                if self.has_quota_exceeded():
    
    251 251
                         raise ArtifactError("Cache too full. Aborting.",
    
    252 252
                                             detail=detail,
    
    253 253
                                             reason="cache-too-full")
    
    ... ... @@ -260,6 +260,14 @@ class ArtifactCache():
    260 260
                     # Remove the actual artifact, if it's not required.
    
    261 261
                     size = self.remove(to_remove)
    
    262 262
                     self._cache_size -= size
    
    263
    +                self._message(MessageType.DEBUG,
    
    264
    +                              "Removed artifact {} ({})".format(
    
    265
    +                                  to_remove[:-(len(key) - self.context.log_key_length)],
    
    266
    +                                  utils._pretty_size(size)))
    
    267
    +
    
    268
    +        self._message(MessageType.INFO,
    
    269
    +                      "New artifact cache size: {}".format(
    
    270
    +                          utils._pretty_size(self._cache_size)))
    
    263 271
     
    
    264 272
             return old_cache_size - self._cache_size
    
    265 273
     
    
    ... ... @@ -272,6 +280,8 @@ class ArtifactCache():
    272 280
         #     artifact_size (int): The size to add.
    
    273 281
         #
    
    274 282
         def add_artifact_size(self, artifact_size):
    
    283
    +        assert utils._is_main_process()
    
    284
    +
    
    275 285
             self._cache_size = self.get_cache_size() + artifact_size
    
    276 286
             self._write_cache_size(self._cache_size)
    
    277 287
     
    
    ... ... @@ -291,14 +301,14 @@ class ArtifactCache():
    291 301
     
    
    292 302
             return self._cache_size
    
    293 303
     
    
    294
    -    # get_quota_exceeded()
    
    304
    +    # has_quota_exceeded()
    
    295 305
         #
    
    296 306
         # Checks if the current artifact cache size exceeds the quota.
    
    297 307
         #
    
    298 308
         # Returns:
    
    299 309
         #    (bool): True of the quota is exceeded
    
    300 310
         #
    
    301
    -    def get_quota_exceeded(self):
    
    311
    +    def has_quota_exceeded(self):
    
    302 312
             return self.get_cache_size() > self._cache_quota
    
    303 313
     
    
    304 314
         ################################################
    

  • buildstream/_scheduler/scheduler.py
    ... ... @@ -249,8 +249,9 @@ class Scheduler():
    249 249
         def check_cache_size(self):
    
    250 250
             artifacts = Platform.get_platform().artifactcache
    
    251 251
     
    
    252
    -        if artifacts.get_quota_exceeded():
    
    253
    -            job = CleanupJob(self, 'cleanup', 'cleanup/cleanup',
    
    252
    +        if artifacts.has_quota_exceeded():
    
    253
    +            job = CleanupJob(self, 'Clean artifact cache',
    
    254
    +                             'cleanup/cleanup',
    
    254 255
                                  resources=[ResourceType.CACHE,
    
    255 256
                                             ResourceType.PROCESS],
    
    256 257
                                  exclusive_resources=[ResourceType.CACHE])
    



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