def main(): application = make_app(debug=options.debug) with open(options.logging_config, 'r') as conf: conf_dictionary = json.load(conf) logging.config.dictConfig(conf_dictionary) if options.prometheus_port: start_http_server(options.prometheus_port) if options.debug: application.listen(address=options.address, port=options.port) else: server = tornado.httpserver.HTTPServer( application, xheaders=True, max_body_size=options.max_body_size) server.bind(options.port) server.start() logger.info('Using asyncio') from tornado.platform.asyncio import AsyncIOMainLoop AsyncIOMainLoop.current().start()
def main(): application = make_app(debug=options.debug) with open(options.logging_config, 'r') as conf: conf_dictionary = json.load(conf) logging.config.dictConfig(conf_dictionary) if options.prometheus_port: start_http_server(options.prometheus_port) if options.debug: application.listen(address=options.address, port=options.port) else: server = tornado.httpserver.HTTPServer(application, xheaders=True, max_body_size=options.max_body_size) server.bind(options.port) server.start() logger.info('Using asyncio') from tornado.platform.asyncio import AsyncIOMainLoop AsyncIOMainLoop.current().start()
def main(): application = make_app(debug=options.debug) with open(options.logging_config, 'r') as conf: conf_dictionary = json.load(conf) logging.config.dictConfig(conf_dictionary) if options.prometheus_port: start_http_server(options.prometheus_port) if options.debug: application.listen(options.port) else: server = tornado.httpserver.HTTPServer(application) server.bind(options.port) server.start() if options.asyncio: logger.info('Using asyncio') from tornado.platform.asyncio import AsyncIOMainLoop AsyncIOMainLoop.current().start() else: logger.info('Using IOLoop') from tornado.ioloop import IOLoop IOLoop.current().start()
def sigint_handler(sig, frame): asyncio_loop = AsyncIOMainLoop.current() asyncio_loop.add_callback_from_signal(asyncio_loop.stop) io_loop = IOLoop.current() io_loop.add_callback_from_signal(io_loop.stop)