summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Belanger <pabelanger@redhat.com>2019-01-07 10:19:48 -0500
committerPaul Belanger <pabelanger@redhat.com>2019-01-07 10:19:48 -0500
commit47aa6b12b2c9d819a626934e0ab98e7767d44bab (patch)
tree409ed44ea2cf7aa8670f177baa4f0b6982e26045
parent8f4f827ed3817c35ea17462277ccf3628103e811 (diff)
Ensure command_socket is last thing to close
This updates all services to how zuul-scheduler works, we close the command_socket at the last possible moment. This also means we can now use the command socket on the filesystem as an idicator that zuul properly shutdown. Change-Id: I5fe1bc96c87e1177a2b94d73a9cbe505a7807202 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
Notes
Notes (review): Code-Review+2: Tobias Henkel <tobias.henkel@bmw.de> Code-Review+2: Monty Taylor <mordred@inaugust.com> Workflow+1: Monty Taylor <mordred@inaugust.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 09 Jan 2019 14:43:50 +0000 Reviewed-on: https://review.openstack.org/628995 Project: openstack-infra/zuul Branch: refs/heads/master
-rw-r--r--zuul/executor/server.py2
-rw-r--r--zuul/lib/fingergw.py15
-rw-r--r--zuul/merger/server.py2
3 files changed, 10 insertions, 9 deletions
diff --git a/zuul/executor/server.py b/zuul/executor/server.py
index 7956628..854e58d 100644
--- a/zuul/executor/server.py
+++ b/zuul/executor/server.py
@@ -2313,7 +2313,6 @@ class ExecutorServer(object):
2313 self._running = False 2313 self._running = False
2314 self._command_running = False 2314 self._command_running = False
2315 workers = list(self.job_workers.values()) 2315 workers = list(self.job_workers.values())
2316 self.command_socket.stop()
2317 2316
2318 for job_worker in workers: 2317 for job_worker in workers:
2319 try: 2318 try:
@@ -2344,6 +2343,7 @@ class ExecutorServer(object):
2344 self.statsd.gauge(base_key + '.pct_used_ram', 0) 2343 self.statsd.gauge(base_key + '.pct_used_ram', 0)
2345 self.statsd.gauge(base_key + '.running_builds', 0) 2344 self.statsd.gauge(base_key + '.running_builds', 0)
2346 2345
2346 self.command_socket.stop()
2347 self.log.debug("Stopped") 2347 self.log.debug("Stopped")
2348 2348
2349 def join(self): 2349 def join(self):
diff --git a/zuul/lib/fingergw.py b/zuul/lib/fingergw.py
index 51cfa91..4f603f3 100644
--- a/zuul/lib/fingergw.py
+++ b/zuul/lib/fingergw.py
@@ -184,13 +184,6 @@ class FingerGateway(object):
184 self.log.info("Finger gateway is started") 184 self.log.info("Finger gateway is started")
185 185
186 def stop(self): 186 def stop(self):
187 if self.command_socket:
188 self.command_running = False
189 try:
190 self.command_socket.stop()
191 except Exception:
192 self.log.exception("Error stopping command socket:")
193
194 if self.server: 187 if self.server:
195 try: 188 try:
196 self.server.shutdown() 189 self.server.shutdown()
@@ -206,6 +199,14 @@ class FingerGateway(object):
206 except Exception: 199 except Exception:
207 self.log.exception("Error stopping RCP client:") 200 self.log.exception("Error stopping RCP client:")
208 201
202 if self.command_socket:
203 self.command_running = False
204
205 try:
206 self.command_socket.stop()
207 except Exception:
208 self.log.exception("Error stopping command socket:")
209
209 self.log.info("Finger gateway is stopped") 210 self.log.info("Finger gateway is stopped")
210 211
211 def wait(self): 212 def wait(self):
diff --git a/zuul/merger/server.py b/zuul/merger/server.py
index b7d0fd4..a2f2303 100644
--- a/zuul/merger/server.py
+++ b/zuul/merger/server.py
@@ -87,8 +87,8 @@ class MergeServer(object):
87 self.log.debug("Stopping") 87 self.log.debug("Stopping")
88 self._running = False 88 self._running = False
89 self._command_running = False 89 self._command_running = False
90 self.command_socket.stop()
91 self.worker.shutdown() 90 self.worker.shutdown()
91 self.command_socket.stop()
92 self.log.debug("Stopped") 92 self.log.debug("Stopped")
93 93
94 def join(self): 94 def join(self):