summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-03-04 21:05:21 +0000
committerGerrit Code Review <review@openstack.org>2019-03-04 21:05:21 +0000
commit967828b1f05a2676b1c06714add052108a9f3102 (patch)
treeb025795fdea7c8c7579071870839fb3583f3dd8a
parentf72682f4772a4b88073ced489cce142c2fef0718 (diff)
parent0a394ad67e8d106969d935f02765cb3dd3af56ed (diff)
Merge "Optionally disable disk_limit_per_job"
-rw-r--r--doc/source/admin/components.rst2
-rw-r--r--tests/unit/test_disk_accountant.py12
-rw-r--r--zuul/executor/server.py9
3 files changed, 22 insertions, 1 deletions
diff --git a/doc/source/admin/components.rst b/doc/source/admin/components.rst
index c0038a8..1a7320e 100644
--- a/doc/source/admin/components.rst
+++ b/doc/source/admin/components.rst
@@ -597,7 +597,7 @@ The following sections of ``zuul.conf`` are used by the executor:
597 This integer is the maximum number of megabytes that any one job 597 This integer is the maximum number of megabytes that any one job
598 is allowed to consume on disk while it is running. If a job's 598 is allowed to consume on disk while it is running. If a job's
599 scratch space has more than this much space consumed, it will be 599 scratch space has more than this much space consumed, it will be
600 aborted. 600 aborted. Set to -1 to disable the limit.
601 601
602 .. attr:: trusted_ro_paths 602 .. attr:: trusted_ro_paths
603 603
diff --git a/tests/unit/test_disk_accountant.py b/tests/unit/test_disk_accountant.py
index e12846d..646808a 100644
--- a/tests/unit/test_disk_accountant.py
+++ b/tests/unit/test_disk_accountant.py
@@ -65,6 +65,18 @@ class TestDiskAccountant(BaseTestCase):
65 da.stop() 65 da.stop()
66 self.assertFalse(da.thread.is_alive()) 66 self.assertFalse(da.thread.is_alive())
67 67
68 def test_disk_accountant_no_limit(self):
69 jobs_dir = tempfile.mkdtemp(
70 dir=os.environ.get("ZUUL_TEST_ROOT", None))
71 cache_dir = tempfile.mkdtemp()
72 executor_server = FakeExecutor()
73 da = DiskAccountant(jobs_dir, -1, executor_server.stopJobByJobDir,
74 cache_dir)
75 da.start()
76 self.assertFalse(da.running)
77 da.stop()
78 self.assertFalse(da.running)
79
68 def test_cache_hard_links(self): 80 def test_cache_hard_links(self):
69 root_dir = tempfile.mkdtemp( 81 root_dir = tempfile.mkdtemp(
70 dir=os.environ.get("ZUUL_TEST_ROOT", None)) 82 dir=os.environ.get("ZUUL_TEST_ROOT", None))
diff --git a/zuul/executor/server.py b/zuul/executor/server.py
index bf17451..4413175 100644
--- a/zuul/executor/server.py
+++ b/zuul/executor/server.py
@@ -149,16 +149,25 @@ class DiskAccountant(object):
149 self.stop_event.wait(delay_time) 149 self.stop_event.wait(delay_time)
150 150
151 def start(self): 151 def start(self):
152 if self.limit < 0:
153 # No need to start if there is no limit.
154 return
152 self._running = True 155 self._running = True
153 self.thread.start() 156 self.thread.start()
154 157
155 def stop(self): 158 def stop(self):
159 if not self.running:
160 return
156 self._running = False 161 self._running = False
157 self.stop_event.set() 162 self.stop_event.set()
158 # We join here to avoid whitelisting the thread -- if it takes more 163 # We join here to avoid whitelisting the thread -- if it takes more
159 # than 5s to stop in tests, there's a problem. 164 # than 5s to stop in tests, there's a problem.
160 self.thread.join(timeout=5) 165 self.thread.join(timeout=5)
161 166
167 @property
168 def running(self):
169 return self._running
170
162 171
163class Watchdog(object): 172class Watchdog(object):
164 def __init__(self, timeout, function, args): 173 def __init__(self, timeout, function, args):