[Notes] [Git][BuildStream/buildstream][tristan/cache-management] _scheduler/jobs/cleanupjob.py: Update cache size while processing



Title: GitLab

Tristan Van Berkom pushed to branch tristan/cache-management at BuildStream / buildstream

Commits:

1 changed file:

Changes:

  • buildstream/_scheduler/jobs/cleanupjob.py
    ... ... @@ -28,7 +28,20 @@ class CleanupJob(Job):
    28 28
             self._artifacts = context.artifactcache
    
    29 29
     
    
    30 30
         def child_process(self):
    
    31
    -        return self._artifacts.clean()
    
    31
    +        def progress():
    
    32
    +            self.send_message('update-cache-size',
    
    33
    +                              self._artifacts.get_cache_size())
    
    34
    +        return self._artifacts.clean(progress)
    
    35
    +
    
    36
    +    def handle_message(self, message_type, message):
    
    37
    +
    
    38
    +        # Update the cache size in the main process as we go,
    
    39
    +        # this provides better feedback in the UI.
    
    40
    +        if message_type == 'update-cache-size':
    
    41
    +            self._artifacts.set_cache_size(message)
    
    42
    +            return True
    
    43
    +
    
    44
    +        return False
    
    32 45
     
    
    33 46
         def parent_complete(self, status, result):
    
    34 47
             if status == JobStatus.OK:
    



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