You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ro...@apache.org on 2020/12/29 13:39:06 UTC
[buildstream] 04/06: scheduler: remove CacheSize job
This is an automated email from the ASF dual-hosted git repository.
root pushed a commit to branch tiagogomes/issue-573
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 372c48f22d328f8f8bf0a8c186c2909869a2f7bb
Author: Tiago Gomes <ti...@codethink.co.uk>
AuthorDate: Tue Sep 11 12:34:00 2018 +0100
scheduler: remove CacheSize job
Is no longer used now that we update the cache size dynamically all the
time.
Also the ArtifactCache.compute_cache_size() is no longer used externally
and can be removed.
---
buildstream/_artifactcache/artifactcache.py | 15 +----------
buildstream/_scheduler/jobs/__init__.py | 1 -
buildstream/_scheduler/jobs/cachesizejob.py | 42 -----------------------------
3 files changed, 1 insertion(+), 57 deletions(-)
diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py
index ea8a323..412a815 100644
--- a/buildstream/_artifactcache/artifactcache.py
+++ b/buildstream/_artifactcache/artifactcache.py
@@ -252,7 +252,7 @@ class ArtifactCache():
])
# Do a real computation of the cache size once, just in case
- old_cache_size = self.compute_cache_size()
+ old_cache_size = self._cache_size = self.calculate_cache_size()
while self.get_cache_size() >= self._cache_lower_threshold:
try:
@@ -284,19 +284,6 @@ class ArtifactCache():
return old_cache_size - self._cache_size
- # compute_cache_size()
- #
- # Computes the real artifact cache size by calling
- # the abstract calculate_cache_size() method.
- #
- # Returns:
- # (int): The size of the artifact cache.
- #
- def compute_cache_size(self):
- self._cache_size = self.calculate_cache_size()
-
- return self._cache_size
-
# add_artifact_size()
#
# Adds given artifact size to the cache size
diff --git a/buildstream/_scheduler/jobs/__init__.py b/buildstream/_scheduler/jobs/__init__.py
index 4b0b11d..e7e9575 100644
--- a/buildstream/_scheduler/jobs/__init__.py
+++ b/buildstream/_scheduler/jobs/__init__.py
@@ -18,5 +18,4 @@
# Tristan Maat <tr...@codethink.co.uk>
from .elementjob import ElementJob
-from .cachesizejob import CacheSizeJob
from .cleanupjob import CleanupJob
diff --git a/buildstream/_scheduler/jobs/cachesizejob.py b/buildstream/_scheduler/jobs/cachesizejob.py
deleted file mode 100644
index 68cd913..0000000
--- a/buildstream/_scheduler/jobs/cachesizejob.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright (C) 2018 Codethink Limited
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author:
-# Tristan Daniƫl Maat <tr...@codethink.co.uk>
-#
-from .job import Job
-from ..._platform import Platform
-
-
-class CacheSizeJob(Job):
- def __init__(self, *args, complete_cb, **kwargs):
- super().__init__(*args, **kwargs)
- self._complete_cb = complete_cb
-
- platform = Platform.get_platform()
- self._artifacts = platform.artifactcache
-
- def child_process(self):
- return self._artifacts.compute_cache_size()
-
- def parent_complete(self, success, result):
- if success:
- self._artifacts.set_cache_size(result)
-
- if self._complete_cb:
- self._complete_cb(result)
-
- def child_process_data(self):
- return {}