diff options
author | Jürg Billeter <j@bitron.ch> | 2018-09-26 10:03:29 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2018-09-27 10:18:03 +0100 |
commit | ef1cb374b590c3b32ef59aaf0d17dffaea037fd6 (patch) | |
tree | 8ce56b1274c17b03d326850cf7604ca8b80dcf82 | |
parent | a5025c33e34ee1e5a40e0606afa5e255bd9be021 (diff) | |
download | buildstream-ef1cb374b590c3b32ef59aaf0d17dffaea037fd6.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 | 5 |
4 files changed, 8 insertions, 12 deletions
diff --git a/buildstream/_scheduler/jobs/cachesizejob.py b/buildstream/_scheduler/jobs/cachesizejob.py index 68cd91331..d46fd4c16 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 -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 399435ad9..8bdbba0ed 100644 --- a/buildstream/_scheduler/jobs/cleanupjob.py +++ b/buildstream/_scheduler/jobs/cleanupjob.py @@ -17,15 +17,14 @@ # Tristan Daniël Maat <tristan.maat@codethink.co.uk> # from .job import Job -from ..._platform import Platform class CleanupJob(Job): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - 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 39ed83a32..984a5457a 100644 --- a/buildstream/_scheduler/queues/buildqueue.py +++ b/buildstream/_scheduler/queues/buildqueue.py @@ -24,7 +24,6 @@ from . import Queue, QueueStatus from ..jobs import ElementJob from ..resources import ResourceType from ..._message import MessageType -from ..._platform import Platform # A queue which assembles elements @@ -94,8 +93,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 8faf58e65..090d490ba 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 CacheSizeJob, CleanupJob -from .._platform import Platform # A decent return code for Scheduler.run() @@ -348,8 +347,8 @@ class Scheduler(): # which will report the calculated cache size. # def _run_cleanup(self, cache_size): - platform = Platform.get_platform() - artifacts = platform.artifactcache + context = self.context + artifacts = context.artifactcache if not artifacts.has_quota_exceeded(): return |