diff options
author | Jürg Billeter <j@bitron.ch> | 2018-09-26 10:03:29 +0100 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-04-14 16:25:19 +0900 |
commit | 80ce97623fc6ed86d2374227016c458ff15f6235 (patch) | |
tree | d0a553e127e250e197bc32372a3bc239b75794af | |
parent | 2eba3edc13d1299d1550918bda95e06037e740f7 (diff) | |
download | buildstream-80ce97623fc6ed86d2374227016c458ff15f6235.tar.gz |
_scheduler: Migrate to Context.artifactcache
-rw-r--r-- | buildstream/_scheduler/jobs/cachesizejob.py | 5 | ||||
-rw-r--r-- | buildstream/_scheduler/jobs/cleanupjob.py | 5 | ||||
-rw-r--r-- | buildstream/_scheduler/queues/buildqueue.py | 5 | ||||
-rw-r--r-- | buildstream/_scheduler/scheduler.py | 6 |
4 files changed, 8 insertions, 13 deletions
diff --git a/buildstream/_scheduler/jobs/cachesizejob.py b/buildstream/_scheduler/jobs/cachesizejob.py index fb56ca016..a96b92353 100644 --- a/buildstream/_scheduler/jobs/cachesizejob.py +++ b/buildstream/_scheduler/jobs/cachesizejob.py @@ -17,7 +17,6 @@ # Tristan Daniël Maat <tristan.maat@codethink.co.uk> # from .job import Job, JobStatus -from ..._platform import Platform class CacheSizeJob(Job): @@ -25,8 +24,8 @@ class CacheSizeJob(Job): super().__init__(*args, **kwargs) self._complete_cb = complete_cb - platform = Platform.get_platform() - self._artifacts = platform.artifactcache + context = self._scheduler.context + self._artifacts = context.artifactcache def child_process(self): return self._artifacts.compute_cache_size() diff --git a/buildstream/_scheduler/jobs/cleanupjob.py b/buildstream/_scheduler/jobs/cleanupjob.py index 97b45901f..b378b3dab 100644 --- a/buildstream/_scheduler/jobs/cleanupjob.py +++ b/buildstream/_scheduler/jobs/cleanupjob.py @@ -17,7 +17,6 @@ # Tristan Daniël Maat <tristan.maat@codethink.co.uk> # from .job import Job, JobStatus -from ..._platform import Platform class CleanupJob(Job): @@ -25,8 +24,8 @@ class CleanupJob(Job): super().__init__(*args, **kwargs) self._complete_cb = complete_cb - platform = Platform.get_platform() - self._artifacts = platform.artifactcache + context = self._scheduler.context + self._artifacts = context.artifactcache def child_process(self): return self._artifacts.clean() diff --git a/buildstream/_scheduler/queues/buildqueue.py b/buildstream/_scheduler/queues/buildqueue.py index df8364552..49ded7e2c 100644 --- a/buildstream/_scheduler/queues/buildqueue.py +++ b/buildstream/_scheduler/queues/buildqueue.py @@ -21,7 +21,6 @@ from . import Queue, QueueStatus from ..jobs import JobStatus from ..resources import ResourceType -from ..._platform import Platform # A queue which assembles elements @@ -55,8 +54,8 @@ class BuildQueue(Queue): # as returned from Element._assemble() to the estimated # artifact cache size # - platform = Platform.get_platform() - artifacts = platform.artifactcache + context = self._scheduler.context + artifacts = context.artifactcache artifacts.add_artifact_size(artifact_size) diff --git a/buildstream/_scheduler/scheduler.py b/buildstream/_scheduler/scheduler.py index 30e70a4fc..68c115c1b 100644 --- a/buildstream/_scheduler/scheduler.py +++ b/buildstream/_scheduler/scheduler.py @@ -29,7 +29,6 @@ from contextlib import contextmanager # Local imports from .resources import Resources, ResourceType from .jobs import JobStatus, CacheSizeJob, CleanupJob -from .._platform import Platform # A decent return code for Scheduler.run() @@ -286,6 +285,8 @@ class Scheduler(): # Callback for the cache size job def _cache_size_job_complete(self, status, cache_size): + context = self.context + artifacts = context.artifactcache # Deallocate cache size job resources self._cache_size_running = None @@ -295,9 +296,6 @@ class Scheduler(): if status != JobStatus.OK: return - platform = Platform.get_platform() - artifacts = platform.artifactcache - if artifacts.has_quota_exceeded(): self._cleanup_scheduled = True |