How to use the scs.intsup.gSup 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
addr, _, port = addrport.partition(":")
            addrport = (addr, int(port) if port else 8000)
        self.addrport = addrport
        self.connection = celery.broker_connection()
        self.without_httpd = without_httpd
        self.logfile = logfile
        self.loglevel = loglevel
        self.numc = numc
        self.ready_event = ready_event
        self.exit_request = Event()
        if not self.without_httpd:
            self.httpd = gSup(instantiate(self.httpd_cls, addrport),
                              signals.httpd_ready)
        self.supervisor = gSup(instantiate(self.supervisor_cls, sup_interval),
                               signals.supervisor_ready)
        self.controllers = [gSup(instantiate(self.controller_cls,
                                   id="%s.%s" % (self.id, i),
                                   connection=self.connection),
                                 signals.controller_ready)
                                for i in xrange(1, numc + 1)]
        c = [self.supervisor] + self.controllers + [self.httpd]
        c = self.components = list(filter(None, c))
        self._components_ready = dict(zip([z.thread for z in c],
                                          [False] * len(c)))
        super(Agent, self).__init__()
github celery / cyme / scs / agent.py View on Github external
logfile=None, without_httpd=False, numc=2, sup_interval=None,
            ready_event=None, **kwargs):
        self.id = id or gen_unique_id()
        if isinstance(addrport, basestring):
            addr, _, port = addrport.partition(":")
            addrport = (addr, int(port) if port else 8000)
        self.addrport = addrport
        self.connection = celery.broker_connection()
        self.without_httpd = without_httpd
        self.logfile = logfile
        self.loglevel = loglevel
        self.numc = numc
        self.ready_event = ready_event
        self.exit_request = Event()
        if not self.without_httpd:
            self.httpd = gSup(instantiate(self.httpd_cls, addrport),
                              signals.httpd_ready)
        self.supervisor = gSup(instantiate(self.supervisor_cls, sup_interval),
                               signals.supervisor_ready)
        self.controllers = [gSup(instantiate(self.controller_cls,
                                   id="%s.%s" % (self.id, i),
                                   connection=self.connection),
                                 signals.controller_ready)
                                for i in xrange(1, numc + 1)]
        c = [self.supervisor] + self.controllers + [self.httpd]
        c = self.components = list(filter(None, c))
        self._components_ready = dict(zip([z.thread for z in c],
                                          [False] * len(c)))
        super(Agent, self).__init__()
github celery / cyme / scs / intsup.py View on Github external
def stop(self):
        super(gSup, self).stop()
        self.thread.stop()
github celery / cyme / scs / agent.py View on Github external
self.id = id or gen_unique_id()
        if isinstance(addrport, basestring):
            addr, _, port = addrport.partition(":")
            addrport = (addr, int(port) if port else 8000)
        self.addrport = addrport
        self.connection = celery.broker_connection()
        self.without_httpd = without_httpd
        self.logfile = logfile
        self.loglevel = loglevel
        self.numc = numc
        self.ready_event = ready_event
        self.exit_request = Event()
        if not self.without_httpd:
            self.httpd = gSup(instantiate(self.httpd_cls, addrport),
                              signals.httpd_ready)
        self.supervisor = gSup(instantiate(self.supervisor_cls, sup_interval),
                               signals.supervisor_ready)
        self.controllers = [gSup(instantiate(self.controller_cls,
                                   id="%s.%s" % (self.id, i),
                                   connection=self.connection),
                                 signals.controller_ready)
                                for i in xrange(1, numc + 1)]
        c = [self.supervisor] + self.controllers + [self.httpd]
        c = self.components = list(filter(None, c))
        self._components_ready = dict(zip([z.thread for z in c],
                                          [False] * len(c)))
        super(Agent, self).__init__()