summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-01-22 11:57:53 -0500
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-01-24 13:02:08 -0500
commitbcd19266ead5cabd2805054db2c9375e572f25d9 (patch)
tree8874c43ea3208146c41b1171055caac3de64138b
parent3616e9398932ae4cf31edefd51b5ef4642922e1f (diff)
downloadbuildstream-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.
-rw-r--r--buildstream/_scheduler/jobs/cleanupjob.py15
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: