How to use the scs.state.state function in scs

To help you get started, we’ve selected a few scs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github celery / cyme / scs / agent.py View on Github external
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()
github celery / cyme / scs / controller.py View on Github external
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]
github celery / cyme / scs / supervisor.py View on Github external
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
github celery / cyme / scs / supervisor.py View on Github external
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