0

我正在使用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 中提取了 kombu 和 celeryredis-server ,并在安装了 (2:2.2.12-1build1) 作为代理的 Ubuntu 12.04 LTS 上进行了尝试。

我的配置(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 时$ ./worker.py 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.version 时,它会报告 2.2.2,据我所知是最新版本。可能还值得注意的是,其他人遇到了这个问题,但似乎通过更新 kombu 解决了这个问题。

因为这真的是我能想象到的最简单的 celery 项目,我对 celery 完全陌生,而且这是一个开发版本,我有点不知道从哪里开始,如果有任何帮助,我将不胜感激。

感谢您的阅读。

4

1 回答 1

2

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

$ git clone https://github.com/celery/billiard
$ cd billiard 
$ python setup.py develop
于 2012-06-23T00:32:03.547 回答