Tristan Van Berkom pushed to branch tristan/cache-management at BuildStream / buildstream
Commits:
- 
74eae4ac
by Tristan Van Berkom at 2019-01-22T19:14:09Z
 
1 changed file:
Changes:
| ... | ... | @@ -28,7 +28,18 @@ 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
 | 
|
| 32 | 43 | 
 | 
| 33 | 44 | 
     def parent_complete(self, status, result):
 | 
| 34 | 45 | 
         if status == JobStatus.OK:
 | 
