Exemplo n.º 1
0
    def run(self):
        """Run the executor thread.

        This function will repeatedly read jobs from the scheduler and
        execute them.
        """
        _LOGGER.info("Started.")

        ExecutorThread.local_thread.executor_object = self
        self.__persister = _persistence.MySQLPersister()
        _persistence.PersistentMeta.init_thread(self.__persister)

        procedure = None
        while True:
            if procedure is None or procedure.is_complete():
                procedure = self._next_procedure(procedure)
                _LOGGER.debug("Executing procedure (%s).", procedure)
                if procedure is None:
                    break

            self.__job = self.__queue.get()
            _LOGGER.debug("Reading next job from queue, found %s.", self.__job)
            self.__job.execute(self.__persister, self.__scheduler,
                               self.__queue)
            self.__queue.done()

        _persistence.PersistentMeta.deinit_thread()
Exemplo n.º 2
0
    def dispatch(self):
        """Setup Fabric Storage System.
        """
        # Configure logging.
        _configure_logging(self.config, False)

        # Configure connections.
        _configure_connections(self.config)

        # Create database and objects.
        _persistence.setup(config=self.config)

        credentials.check_initial_setup(self.config,
                                        _persistence.MySQLPersister())
Exemplo n.º 3
0
    def dispatch(self, daemonize=False):
        """Start the Fabric server.
        """
        # Configure logging.
        _configure_logging(self.config, daemonize)

        # Configure connections.
        _configure_connections(self.config)

        credentials.check_initial_setup(self.config,
                                        _persistence.MySQLPersister(),
                                        check_only=True)

        # Daemonize ourselves.
        if daemonize:
            _utils.daemonize()

        # Start Fabric server.
        _start(self.options, self.config)
        _services.ServiceManager().wait()
Exemplo n.º 4
0
    def dispatch(self, daemonize=False):
        """Start the Fabric server.
        """
        # Configure logging.
        _configure_logging(self.config, daemonize)

        # Configure connections.
        _configure_connections(self.config)

        try:
            credentials.check_initial_setup(self.config,
                                            _persistence.MySQLPersister(),
                                            check_only=True)
        except _errors.CredentialError as error:
            _LOGGER.debug(str(error))
            return

        # Daemonize ourselves.
        if daemonize:
            _utils.daemonize()

        # Start Fabric server.
        _start(self.options, self.config)
        _services.ServiceManager().wait()