def start(self):

        # dump some debug info for now
        #self.info("BACKENDS: %r" % (self.backends))
        #self.info("APPS: %r" % (self.apps))

        self.info("Starting %s..." % settings.PROJECT_NAME)
        self.pre_start.send(self)
        self._starting_backends = True
        self._start_all_backends()
        self._start_all_apps()
        self.running = True
        self.debug("Started")

        # now that all of the apps are started, we are ready to start
        # accepting messages. (if we tried to dispatch an message to an
        # app before it had started, it might not be configured yet.)
        self.accepting = True
        self._starting_backends = False

        try:
            while self.running:

                # fetch the next pending incoming message, if one is
                # available immediately. this increments the number of
                # "tasks" on the queue, which MUST be decremented later
                # to avoid deadlock during graceful shutdown. (it calls
                # _queue.join to ensure that all pending messages are
                # processed before stopping.).
                #
                # for more infomation on Queues, see:
                # help(Queue.Queue.task_done)
                try:
                    self.incoming(self._queue.get(block=False))
                    self._queue.task_done()

                # if there were no messages waiting, wait a very short
                # (in human terms) time before looping to check again.
                except Queue.Empty:
                    time.sleep(0.1)

        # stopped via ctrl+c
        except KeyboardInterrupt:
            self.warn("Caught KeyboardInterrupt")
            self.running = False

        # stopped via sys.exit
        except SystemExit:
            self.warn("Caught SystemExit")
            self.running = False

        # while shutting down, refuse to accept any new messages. the
        # backend(s) might have to discard them, but at least they can
        # pass the refusal back to the device/gateway where possible
        self.accepting = False

        self.debug("Stopping...")
        self._stop_all_backends()
        self._stop_all_apps()
        self.info("Stopped")
Return a set of files modified in payload commits.
dataset/ETHPy150Open rapidsms/rapidsms-core-dev/lib/rapidsms/router.py/Router.start--crossover with--dataset/ETHPy150Open openaddresses/machine/openaddr/ci/__init__.py/get_touched_payload_files