Skip to content
Snippets Groups Projects
Commit 786a0394 authored by Jürg Billeter's avatar Jürg Billeter
Browse files

_scheduler: Migrate to Context.artifactcache

parent 1e658e80
No related branches found
No related tags found
No related merge requests found
......@@ -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()
......
......@@ -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()
......
......@@ -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)
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment