使用Celery 2.6.0rc5时发生TypeError

时间:2012-06-22 23:30:25

标签: python redis celery celery-task

我正在使用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)

pulled both kombu and celery from git just moments ago,我在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运行worker时,我从python shell调用worker如下:

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并运行“import kombu; kombu。版本”时,它会报告2.2.2,我知道这是最新版本。值得注意的是someone else encountered this,但似乎通过更新kombu来解决它。

由于这是我能想象的最简单的芹菜项目,我对芹菜来说是全新的,这是一个开发版本,我对从这里去哪里感到有点难过,并且会感激任何帮助。

感谢您的阅读。

1 个答案:

答案 0 :(得分:2)

我似乎通过更新到Billiard的最新版本来解决这个问题:

$ git clone https://github.com/celery/billiard
$ cd billiard 
$ python setup.py develop