Ejemplo n.º 1
0
    def run(self):
        application = self._create_tornado_web_app()

        init_model_evaluator(self.settings, self.tabpy_state,
                             self.python_service)

        protocol = self.settings[SettingsParameters.TransferProtocol]
        if protocol == 'http':
            application.listen(self.settings[SettingsParameters.Port])
        elif protocol == 'https':
            application.listen(
                self.settings[SettingsParameters.Port],
                ssl_options={
                    'certfile':
                    self.settings[SettingsParameters.CertificateFile],
                    'keyfile': self.settings[SettingsParameters.KeyFile]
                })
        else:
            msg = f'Unsupported transfer protocol {protocol}.'
            logger.critical(msg)
            raise RuntimeError(msg)

        logger.info('Web service listening on port '
                    f'{str(self.settings[SettingsParameters.Port])}')
        tornado.ioloop.IOLoop.instance().start()
Ejemplo n.º 2
0
    def run(self):
        application = self._create_tornado_web_app()
        max_request_size =\
            int(self.settings[SettingsParameters.MaxRequestSizeInMb]) *\
            1024 * 1024
        logger.info(f'Setting max request size to {max_request_size} bytes')

        init_model_evaluator(self.settings, self.tabpy_state,
                             self.python_service)

        protocol = self.settings[SettingsParameters.TransferProtocol]
        ssl_options = None
        if protocol == 'https':
            ssl_options = {
                'certfile': self.settings[SettingsParameters.CertificateFile],
                'keyfile': self.settings[SettingsParameters.KeyFile]
            }
        elif protocol != 'http':
            msg = f'Unsupported transfer protocol {protocol}.'
            logger.critical(msg)
            raise RuntimeError(msg)

        application.listen(self.settings[SettingsParameters.Port],
                           ssl_options=ssl_options,
                           max_buffer_size=max_request_size,
                           max_body_size=max_request_size)

        logger.info('Web service listening on port '
                    f'{str(self.settings[SettingsParameters.Port])}')
        tornado.ioloop.IOLoop.instance().start()
Ejemplo n.º 3
0
    def run(self):
        application = self._create_tornado_web_app()
        max_request_size = (
            int(self.settings[SettingsParameters.MaxRequestSizeInMb]) * 1024 * 1024
        )
        logger.info(f"Setting max request size to {max_request_size} bytes")

        init_model_evaluator(self.settings, self.tabpy_state, self.python_service)

        protocol = self.settings[SettingsParameters.TransferProtocol]
        ssl_options = None
        if protocol == "https":
            ssl_options = {
                "certfile": self.settings[SettingsParameters.CertificateFile],
                "keyfile": self.settings[SettingsParameters.KeyFile],
            }
        elif protocol != "http":
            msg = f"Unsupported transfer protocol {protocol}."
            logger.critical(msg)
            raise RuntimeError(msg)

        application.listen(
            self.settings[SettingsParameters.Port],
            ssl_options=ssl_options,
            max_buffer_size=max_request_size,
            max_body_size=max_request_size,
        )

        logger.info(
            "Web service listening on port "
            f"{str(self.settings[SettingsParameters.Port])}"
        )
        tornado.ioloop.IOLoop.instance().start()