我们从Python开源项目中,提取了以下36个代码示例,用于说明如何使用tornado.ioloop.IOLoop.clear_current()。
def setUp(self): self.io_loop = None IOLoop.clear_current()
def start(self): old_current = IOLoop.current(instance=False) try: self._setup_logging() self.make_current() self.asyncio_loop.run_forever() finally: if old_current is None: IOLoop.clear_current() else: old_current.make_current()
def start(self): old_current = IOLoop.current(instance=False) try: self._setup_logging() self.make_current() self.reactor.run() finally: if old_current is None: IOLoop.clear_current() else: old_current.make_current()
def run(self): #logging.basicConfig(filename='runserver.log',level=logging.DEBUG) IOLoop.clear_current() IOLoop.clear_instance() self.io_loop = IOLoop.instance() ws_connection_handler = WebSocketConnectionHandler() results_cache = ResultCache() tornado_app = Application(handlers=[ (r"/ws/(.*)", AsyncRunHandler, {'connection_handler': ws_connection_handler, 'result_cache': results_cache, 'io_loop': self.io_loop, }), (r"/ping", PingRequestHandler)]) self.http_server = HTTPServer(tornado_app) try: self.http_server.listen(port=SERVER_PORT, address=SERVER_ADDR) if not self.io_loop._running: print('Running Server Loop') self.io_loop.start() else: print("IOLoop already running") except OSError: print("Server is already running!") except KeyboardInterrupt: # SIGINT, SIGTERM print('Closing Server Loop') self.http_server.close_all_connections() self.io_loop.stop()