celery 报错 在启动worker的时候 Attribute
2019-07-22 本文已影响0人
Jayce_xi
1. 错误描述
celeryworker_1 | [2018-11-20 13:30:07,838: WARNING/MainProcess] celery@cd4e42f8b190 ready.
celeryworker_1 | [2018-11-20 13:30:07,927: ERROR/MainProcess] Unrecoverable error: AttributeError("'str' object has no attribute 'items'",)
celeryworker_1 | Traceback (most recent call last):
celeryworker_1 | File "/usr/local/lib/python3.6/site-packages/celery/worker/__init__.py", line 206, in start
celeryworker_1 | self.blueprint.start(self)
celeryworker_1 | File "/usr/local/lib/python3.6/site-packages/celery/bootsteps.py", line 123, in start
celeryworker_1 | step.start(parent)
celeryworker_1 | File "/usr/local/lib/python3.6/site-packages/celery/bootsteps.py", line 374, in start
celeryworker_1 | return self.obj.start()
celeryworker_1 | File "/usr/local/lib/python3.6/site-packages/celery/worker/consumer.py", line 280, in start
celeryworker_1 | blueprint.start(self)
celeryworker_1 | File "/usr/local/lib/python3.6/site-packages/celery/bootsteps.py", line 123, in start
celeryworker_1 | step.start(parent)
celeryworker_1 | File "/usr/local/lib/python3.6/site-packages/celery/worker/consumer.py", line 884, in start
celeryworker_1 | c.loop(*c.loop_args())
celeryworker_1 | File "/usr/local/lib/python3.6/site-packages/celery/worker/loops.py", line 76, in asynloop
celeryworker_1 | next(loop)
celeryworker_1 | File "/usr/local/lib/python3.6/site-packages/kombu/async/hub.py", line 340, in create_loop
celeryworker_1 | cb(*cbargs)
celeryworker_1 | File "/usr/local/lib/python3.6/site-packages/kombu/transport/redis.py", line 1019, in on_readable
celeryworker_1 | self._callbacks[queue](message)
celeryworker_1 | File "/usr/local/lib/python3.6/site-packages/kombu/transport/virtual/__init__.py", line 534, in _callback
celeryworker_1 | self.qos.append(message, message.delivery_tag)
celeryworker_1 | File "/usr/local/lib/python3.6/site-packages/kombu/transport/redis.py", line 146, in append
celeryworker_1 | pipe.zadd(self.unacked_index_key, delivery_tag, time()) \
celeryworker_1 | File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 2263, in zadd
celeryworker_1 | for pair in iteritems(mapping):
celeryworker_1 | File "/usr/local/lib/python3.6/site-packages/redis/_compat.py", line 123, in iteritems
celeryworker_1 | return iter(x.items())
celeryworker_1 | AttributeError: 'str' object has no attribute 'items'
2. 原因
redis 版本原因,详情见
github/issues/1868
3. 解决
pip install redis==2.10.6