Browse Source

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>
Paul Belanger 3 months ago
parent
commit
47aa6b12b2
3 changed files with 10 additions and 9 deletions
  1. 1
    1
      zuul/executor/server.py
  2. 8
    7
      zuul/lib/fingergw.py
  3. 1
    1
      zuul/merger/server.py

+ 1
- 1
zuul/executor/server.py View File

@@ -2313,7 +2313,6 @@ class ExecutorServer(object):
2313 2313
             self._running = False
2314 2314
             self._command_running = False
2315 2315
             workers = list(self.job_workers.values())
2316
-        self.command_socket.stop()
2317 2316
 
2318 2317
         for job_worker in workers:
2319 2318
             try:
@@ -2344,6 +2343,7 @@ class ExecutorServer(object):
2344 2343
             self.statsd.gauge(base_key + '.pct_used_ram', 0)
2345 2344
             self.statsd.gauge(base_key + '.running_builds', 0)
2346 2345
 
2346
+        self.command_socket.stop()
2347 2347
         self.log.debug("Stopped")
2348 2348
 
2349 2349
     def join(self):

+ 8
- 7
zuul/lib/fingergw.py View File

@@ -184,13 +184,6 @@ class FingerGateway(object):
184 184
         self.log.info("Finger gateway is started")
185 185
 
186 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 187
         if self.server:
195 188
             try:
196 189
                 self.server.shutdown()
@@ -206,6 +199,14 @@ class FingerGateway(object):
206 199
             except Exception:
207 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 210
         self.log.info("Finger gateway is stopped")
210 211
 
211 212
     def wait(self):

+ 1
- 1
zuul/merger/server.py View File

@@ -87,8 +87,8 @@ class MergeServer(object):
87 87
         self.log.debug("Stopping")
88 88
         self._running = False
89 89
         self._command_running = False
90
-        self.command_socket.stop()
91 90
         self.worker.shutdown()
91
+        self.command_socket.stop()
92 92
         self.log.debug("Stopped")
93 93
 
94 94
     def join(self):

Loading…
Cancel
Save