当我使用龙卷风组合整合龙卷风和芹菜时,会发生错误:````
traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1369, in _stack_context_handle_exception
raise_exc_info((type, value, traceback))
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 314, in wrapped
ret = fn(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1581, in future_complete
f.result()
File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 215, in result
raise_exc_info(self._exc_info)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 876, in run
yielded = self.gen.throw(*exc_info)
File "/home/q/celeryTest/webui.py", line 18, in get
response = yield tornado.gen.Task(common_check.apply_async, args=[rids, None,None])
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 870, in run
value = future.result()
File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 215, in result
raise_exc_info(self._exc_info)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 505, in Task
func(*args, callback=_argument_adapter(set_result), **kwargs)
File "/usr/local/lib/python2.7/dist-packages/celery/app/task.py", line 565, in apply_async
**dict(self._get_exec_options(), **options)
File "/usr/local/lib/python2.7/dist-packages/celery/app/base.py", line 354, in send_task
reply_to=reply_to or self.oid, **options
File "/usr/local/lib/python2.7/dist-packages/celery/app/amqp.py", line 310, in publish_task
**kwargs
File "build/bdist.linux-x86_64/egg/tcelery/producer.py", line 104, in publish
self.consumer.wait_for(task_id,
File "/usr/local/lib/python2.7/dist-packages/kombu/utils/__init__.py", line 325, in __get__
value = obj.__dict__[self.__name__] = self.__get(obj)
File "build/bdist.linux-x86_64/egg/tcelery/producer.py", line 118, in consumer
"tornado-redis must be installed to use the redis backend")
RuntimeError: tornado-redis must be installed to use the redis backend
ERROR:tornado.access:500 GET /check?rids=3001626 (127.0.0.1) 3.52ms
龙卷风代码是:
import tornado.web
import tornado.gen
import tcelery
from route_check_task.check_worker import common_check
tcelery.setup_nonblocking_producer()
class CheckHandler(tornado.web.RequestHandler):
@tornado.web.asynchronous
@tornado.gen.coroutine
def get(self):
rids = self.get_argument('rids').split(',')
print rids
response = yield tornado.gen.Task(common_check.apply_async, args=[rids, None,None])
self.write(str(response.result))
self.finish
application = tornado.web.Application([
(r"/check", CheckHandler),
])
if __name__ == "__main__":
application.listen(8889)
tornado.ioloop.IOLoop.instance().start()
和芹菜是:
@app.task
def common_check(rids, tts_enids, wrapperids):
check_list = load_checks()
results = []
rids_all = rids
if not rids_all or len(rids_all) == 0:
pre_results = check(check_list=check_list, rids=rids, tts_enids=tts_enids, wrapperids=wrapperids, ops=0)
results.append(pre_results)
else:
for i in xrange(0, len(rids_all), PRE_COUNT):
rids = rids_all[i: i + PRE_COUNT]
pre_results = check(check_list=check_list, rids=rids, tts_enids=tts_enids, wrapperids=wrapperids, ops=0)
results.append(pre_results)
logger_routecheck.info("check rids len={}".format(len(rids)))
print results
return results
错误显示我应该安装龙卷风雷迪斯,但我添加了,PIP显示:
tornado (4.2)
tornado-celery (0.3.5)
tornado-redis (2.4.2)
我应该如何解决这个问题,谢谢!
已解决,龙卷风 - 雷迪斯版本太低。当我将版本更新为最新版本时:龙卷风 - 雷迪斯(2.4.18),一切都可以。