Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run(self):
state.is_agent = True
self.prepare_signals()
setup_logging(self.loglevel, self.logfile)
self.info("Starting with id %r", self.id)
[g.start() for g in self.components]
self.exit_request.wait()
def get(self, name=None):
objects = self.state.objects
if not name:
return objects.get_default()
if name not in self._cache:
app = self._get(name)
if state.is_agent:
# copy app to local
self._cache[name] = objects.recreate(**app)
else:
self._cache[name] = objects.instance(**app)
return self._cache[name]
def _can_restart(self):
"""Returns true if the supervisor is allowed to restart
nodes at this point."""
if state.broker_last_revived is None:
return True
return state.time_since_broker_revived \
> self.wait_after_broker_revived
def _can_restart(self):
"""Returns true if the supervisor is allowed to restart
nodes at this point."""
if state.broker_last_revived is None:
return True
return state.time_since_broker_revived \
> self.wait_after_broker_revived