diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-01-22 11:57:53 -0500 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-01-24 13:02:08 -0500 |
commit | bcd19266ead5cabd2805054db2c9375e572f25d9 (patch) | |
tree | 8874c43ea3208146c41b1171055caac3de64138b /buildstream | |
parent | 3616e9398932ae4cf31edefd51b5ef4642922e1f (diff) | |
download | buildstream-bcd19266ead5cabd2805054db2c9375e572f25d9.tar.gz |
_scheduler/jobs/cleanupjob.py: Update cache size while processing
Updates the known cache size in the main process while the cleanup
process is ongoing, so that the status indicators update live
while the cleanup happens.
Diffstat (limited to 'buildstream')
-rw-r--r-- | buildstream/_scheduler/jobs/cleanupjob.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/buildstream/_scheduler/jobs/cleanupjob.py b/buildstream/_scheduler/jobs/cleanupjob.py index b378b3dab..a1d49f339 100644 --- a/buildstream/_scheduler/jobs/cleanupjob.py +++ b/buildstream/_scheduler/jobs/cleanupjob.py @@ -28,7 +28,20 @@ class CleanupJob(Job): self._artifacts = context.artifactcache def child_process(self): - return self._artifacts.clean() + def progress(): + self.send_message('update-cache-size', + self._artifacts.get_cache_size()) + return self._artifacts.clean(progress) + + def handle_message(self, message_type, message): + + # Update the cache size in the main process as we go, + # this provides better feedback in the UI. + if message_type == 'update-cache-size': + self._artifacts.set_cache_size(message) + return True + + return False def parent_complete(self, status, result): if status == JobStatus.OK: |