def stop_ioloop(): logging.info("stopping ws_rpc ioloop") ioloop = tornado.ioloop.IOLoop.instance() ioloop.add_callback(ioloop.stop)