Tristan Van Berkom pushed to branch tristan/cache-management at BuildStream / buildstream
Commits:
-
c0e1b75d
by Tristan Van Berkom at 2019-01-22T19:29:20Z
1 changed file:
Changes:
| ... | ... | @@ -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:
|
