Run your app in one tornado event loop process

    :param app: wsgi application, Microservice instance
    :param port: port for listen, int, default: 5000
    :param address: address for listen, str, default: ""
    :param use_gevent: if True, app.wsgi will be run in gevent.spawn
    :param start: if True, will be call utils.tornado_start()
    :param Container: your class, bases on tornado.wsgi.WSGIContainer, default: tornado.wsgi.WSGIContainer
    :param monkey_patch: boolean, use gevent.monkey.patch_all() for patching standard modules, default: use_gevent
    :param Server: your class, bases on tornado.httpserver.HTTPServer, default: tornado.httpserver.HTTPServer
    :return: tornado server

def tornado_run(app, port=5000, address="", use_gevent=False, start=True,
                monkey_patch=None, Container=None,
                Server=None, threadpool=None):  # pragma: no cover
    """Run your app in one tornado event loop process

    :param app: wsgi application, Microservice instance
    :param port: port for listen, int, default: 5000
    :param address: address for listen, str, default: ""
    :param use_gevent: if True, app.wsgi will be run in gevent.spawn
    :param start: if True, will be call utils.tornado_start()
    :param Container: your class, bases on tornado.wsgi.WSGIContainer, default: tornado.wsgi.WSGIContainer
    :param monkey_patch: boolean, use gevent.monkey.patch_all() for patching standard modules, default: use_gevent
    :param Server: your class, bases on tornado.httpserver.HTTPServer, default: tornado.httpserver.HTTPServer
    :return: tornado server
    """
    if Container is None:
        from tornado.wsgi import WSGIContainer
        Container = WSGIContainer

    if Server is None:
        from tornado.httpserver import HTTPServer
        Server = HTTPServer

    if monkey_patch is None:
        monkey_patch = use_gevent

    CustomWSGIContainer = Container

    if use_gevent:
        if monkey_patch:
            from gevent import monkey
            monkey.patch_all()

        import gevent

        class GeventWSGIContainer(Container):
            def __call__(self, *args, **kwargs):
                def async_task():
                    super(GeventWSGIContainer, self).__call__(*args, **kwargs)

                gevent.spawn(async_task)

        CustomWSGIContainer = GeventWSGIContainer

    if threadpool is not None:
        from multiprocessing.pool import ThreadPool

        if not isinstance(threadpool, ThreadPool):
            threadpool = ThreadPool(threadpool)

        class ThreadPoolWSGIContainer(Container):
            def __call__(self, *args, **kwargs):
                def async_task():
                    super(ThreadPoolWSGIContainer, self).__call__(*args, **kwargs)

                threadpool.apply_async(async_task)

        CustomWSGIContainer = ThreadPoolWSGIContainer

    http_server = Server(CustomWSGIContainer(app))
    http_server.listen(port, address)
    if start:
        tornado_start()
    return http_server