summaryrefslogtreecommitdiff
path: root/src/buildstream/_scheduler/jobs/cachesizejob.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildstream/_scheduler/jobs/cachesizejob.py')
-rw-r--r--src/buildstream/_scheduler/jobs/cachesizejob.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/buildstream/_scheduler/jobs/cachesizejob.py b/src/buildstream/_scheduler/jobs/cachesizejob.py
index 81c012895..ed1cc4131 100644
--- a/src/buildstream/_scheduler/jobs/cachesizejob.py
+++ b/src/buildstream/_scheduler/jobs/cachesizejob.py
@@ -16,7 +16,7 @@
# Author:
# Tristan Daniƫl Maat <tristan.maat@codethink.co.uk>
#
-from .job import Job, JobStatus
+from .job import Job, JobStatus, ChildJob
class CacheSizeJob(Job):
@@ -27,12 +27,21 @@ class CacheSizeJob(Job):
context = self._scheduler.context
self._casquota = context.get_casquota()
- def child_process(self):
- return self._casquota.compute_cache_size()
-
def parent_complete(self, status, result):
if status == JobStatus.OK:
self._casquota.set_cache_size(result)
if self._complete_cb:
self._complete_cb(status, result)
+
+ def create_child_job(self, *args, **kwargs):
+ return ChildCacheSizeJob(*args, casquota=self._scheduler.context._casquota, **kwargs)
+
+
+class ChildCacheSizeJob(ChildJob):
+ def __init__(self, *args, casquota, **kwargs):
+ super().__init__(*args, **kwargs)
+ self._casquota = casquota
+
+ def child_process(self):
+ return self._casquota.compute_cache_size()