コード例 #1
0
ファイル: process.py プロジェクト: Whitespace/Tinman
    def on_sighup(self, signal_unused, frame_unused):
        """Reload the configuration

        :param int signal_unused: Unused signal number
        :param frame frame_unused: Unused frame the signal was caught in

        """
        self.config = self.fixup_configuration(self.manager.config)
        clihelper.setup_logging(self.manager.debug)

        # Update HTTP configuration
        for setting in self.http_config:
            if getattr(self.http_server, setting) != self.http_config[setting]:
                LOGGER.debug('Changing HTTPServer %s setting', setting)
                setattr(self.http_server, setting, self.http_config[setting])

        # Update Application Settings
        for setting in self.settings:
            if self.app.settings[setting] != self.settings[setting]:
                LOGGER.debug('Changing Application %s setting', setting)
                self.app.settings[setting] = self.settings[setting]

        # Update the routes
        routes = self.app.prepare_routes(self.routes)
        self.app.handlers = []
        self.app.named_handlers = {}
        self.app.add_handlers(".*$", routes)

        LOGGER.info('Configuration reloaded')
コード例 #2
0
ファイル: process.py プロジェクト: Whitespace/Tinman
    def run(self):
        """Called when the process has started

        :param int port: The HTTP Server port

        """
        LOGGER.debug('Initializing process')

        # Now in a child process so setup logging for this process
        clihelper.setup_logging(self.manager.debug)

        # Register the signal handlers
        self.setup_signal_handlers()

        # Create the application instance
        self.app = self.create_application()

        # Create the HTTPServer
        self.http_server = self.create_http_server()

        # Hold on to the IOLoop in case it's needed for responding to signals
        self.ioloop = ioloop.IOLoop.instance()

        # Start the IOLoop, blocking until it is stopped
        try:
            self.ioloop.start()
        except KeyboardInterrupt:
            pass
コード例 #3
0
ファイル: process.py プロジェクト: pyzen/Tinman
    def run(self):
        """Called when the process has started

        :param int port: The HTTP Server port

        """
        logger.debug('Initializing process')

        # Now in a child process so setup logging for this process
        clihelper.setup_logging(self._debug)

        # Register the signal handlers
        self._setup_signal_handlers()

        # Create the application instance
        self._app = self._application(self._get_application_config())

        # Setup the auto-created IO services
        self._setup_services()

        # Create the HTTPServer
        self._server = self._http_server(self._get_http_server_config())

        # Hold on to the IOLoop in case it's needed for responding to signals
        self._ioloop = ioloop.IOLoop.instance()

        # Start the IOLoop, blocking until it is stopped
        try:
            self._ioloop.start()
        except KeyboardInterrupt:
            pass