>我正在使用 Celery 2.6.0rc5,并收到以下错误:
[2012-06-22 23:01:42,016: ERROR/MainProcess] Unrecoverable error: TypeError('handle_event() takes exactly 3 arguments (1 given)',)
Traceback (most recent call last):
File "/home/bmh/celery/celery/worker/__init__.py", line 350, in start
component.start()
File "/home/bmh/celery/celery/worker/consumer.py", line 369, in start
self.consume_messages()
File "/home/bmh/celery/celery/worker/consumer.py", line 435, in consume_messages
readers[fileno](fileno, event)
File "/home/bmh/kombu/kombu/transport/redis.py", line 636, in handle_event
self._callbacks[queue](message)
File "/home/bmh/kombu/kombu/transport/virtual/__init__.py", line 461, in _callback
return callback(message)
File "/home/bmh/kombu/kombu/messaging.py", line 482, in _receive_callback
self.receive(decoded, message)
File "/home/bmh/kombu/kombu/messaging.py", line 454, in receive
[callback(body, message) for callback in callbacks]
File "/home/bmh/celery/celery/worker/consumer.py", line 397, in on_task_received
[callback() for callback in on_task_callbacks]
TypeError: handle_event() takes exactly 3 arguments (1 given)
我刚才从 git 中提取了海带和芹菜,并在 Ubuntu 12.04 LTS 上尝试这样做,并安装了 redis-server
(2:2.2.12-1build1) 作为代理。
我的配置 ( celeryconfig.py
) 是:
BROKER_URL = "redis://localhost:6379/0"
BACKEND_URL = BROKER_URL
CELERY_RESULT_BACKEND = "redis"
CELERY_REDIS_HOST = "localhost"
CELERY_REDIS_PORT = 6379
CELERY_REDIS_DB = 0
我的工作人员 ( worker.py
) 是:
#!/usr/bin/python2.7
from celery import Celery
celery = Celery()
celery.config_from_object('celeryconfig')
@celery.task(ignore_result=True)
def atest(data):
print "Got data: %s" % data
if __name__ == "__main__":
celery.start()
当我使用 $ ./worker.py worker
运行工作线程时,我从 python shell 中按如下方式调用工作线程:
import worker
worker.atest("abc")
工作人员报告上述错误,报告一个较长的错误,最终以工作人员在以下方面退出而告终:
[2012-06-22 23:01:43,025: WARNING/MainProcess] File "/home/bmh/kombu/kombu/utils/eventio.py", line 95, in unregister
[2012-06-22 23:01:43,025: WARNING/MainProcess] self._epoll.unregister(fd)
[2012-06-22 23:01:43,025: WARNING/MainProcess] ValueError
[2012-06-22 23:01:43,025: WARNING/MainProcess] :
[2012-06-22 23:01:43,026: WARNING/MainProcess] I/O operation on closed epoll fd
顺便说一句,当我运行$ ./worker.py shell
并运行"导入海带;海带。版本"它报告2.2.2,据我了解这是最新版本。可能还值得注意的是,其他人遇到了这个问题,但似乎已经通过更新 kombu 解决了它。
由于这真的是我能想象到的最简单的芹菜项目,我对芹菜完全陌生,这是一个开发版本,我有点不知道从这里开始该何去何从,如果有任何帮助,我将不胜感激。
感谢您的阅读。
我似乎已经通过更新到最新版本的台球来解决这个问题:
$ git clone https://github.com/celery/billiard
$ cd billiard
$ python setup.py develop