Browse Source

Merge "Track known repair scripts and their routing keys"

Jenkins 4 years ago
parent
commit
99a921150b
1 changed files with 6 additions and 0 deletions
  1. 6
    0
      entropy/engine.py

+ 6
- 0
entropy/engine.py View File

@@ -66,6 +66,9 @@ class Engine(object):
66 66
         self.run_queue = collections.deque()
67 67
         # Private variables
68 68
         self._watchdog_event_fn = {self.repair_cfg: self.repair_modified}
69
+        # Private variables to keep track of repair scripts.
70
+        self._repairs = []
71
+        self._known_routing_keys = set()
69 72
         LOG.info('Created engine obj %s', self.name)
70 73
 
71 74
     # TODO(praneshp): Move to utils?
@@ -183,6 +186,7 @@ class Engine(object):
183 186
             new_additions.sort(key=operator.itemgetter('time'))
184 187
             self.run_queue.extend(new_additions)
185 188
             LOG.info("Run queue till %s is %s", next_iteration, self.run_queue)
189
+            LOG.info("Repair scripts at %s: %s", next_iteration, self._repairs)
186 190
         except Exception:
187 191
             LOG.exception("Could not run serializer for %s at %s",
188 192
                           self.name, current_time)
@@ -244,6 +248,7 @@ class Engine(object):
244 248
                                   data['routing_key'])
245 249
             if message_queue not in self.known_queues:
246 250
                 self.known_queues.append(message_queue)
251
+            self._known_routing_keys.add(data['routing_key'])
247 252
             kwargs = data
248 253
             kwargs['conf'] = script_args['cfg']
249 254
             kwargs['exchange'] = self.entropy_exchange
@@ -252,6 +257,7 @@ class Engine(object):
252 257
             self.running_repairs.append(script)
253 258
             imported_module = imp.load_module(react_script, *available_modules)
254 259
             future = self.executor.submit(imported_module.main, **kwargs)
260
+            self._repairs.append(future)
255 261
             return future
256 262
         except Exception:
257 263
             LOG.exception("Could not setup %s", script)

Loading…
Cancel
Save