Example #1
0
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()
Example #2
0
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()
Example #3
0
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()
Example #4
0
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)
Example #5
0
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)