This is an automated email from the ASF dual-hosted git repository. root pushed a commit to branch testing/local-cache-expiry in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit e3eda8626bbfaa193ce3dcb856ca8656a4e3b572 Author: Tristan Maat <[email protected]> AuthorDate: Wed Jul 11 11:26:55 2018 +0100 scheduler.py: Add cleanup function --- buildstream/_scheduler/scheduler.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/buildstream/_scheduler/scheduler.py b/buildstream/_scheduler/scheduler.py index 5a991a8..c33c9d1 100644 --- a/buildstream/_scheduler/scheduler.py +++ b/buildstream/_scheduler/scheduler.py @@ -393,13 +393,24 @@ class Scheduler(): # Local Private Methods # ####################################################### + def _run_cleanup(self, cache_size): + if cache_size and cache_size < self.context.cache_quota: + return + + logpath = os.path.join(self.context.logdir, 'cleanup.{pid}.log') + job = CleanupJob(self, 'cleanup', logpath, + resources=[ResourceType.CACHE, + ResourceType.PROCESS], + exclusive_resources=[ResourceType.CACHE], + complete_cb=None) + def _check_cache_size_real(self): logpath = os.path.join(self.context.logdir, 'cache_size.{pid}.log') job = CacheSizeJob(self, 'cache_size', logpath, resources=[ResourceType.CACHE, ResourceType.PROCESS], exclusive_resources=[ResourceType.CACHE], - complete_cb=None) + complete_cb=self._run_cleanup) # _suspend_jobs() #
