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-04-14 16:54:30 +0900
commiteff3bfff1499790575a0bdcab4288ab0fe03d1ac (patch)
treecf75639d3e3bdfcc4b22392d92c48f99414d33fd
parenteea2d7ee0d61edb035f89029428703e908153154 (diff)
downloadbuildstream-eff3bfff1499790575a0bdcab4288ab0fe03d1ac.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: