1

我有一个 celeryd 和两个工人一起运行,看着他们我看到他们每个接受 4 个任务,处理它们,然后停止处理任务。(请注意,这些任务运行时间很长,最多需要 2 分钟才能处理)。

celeryctl 提供以下信息:

django@server: ./manage.py celeryctl inspect active
<- active
DEBUG 2012-06-01 12:51:11,330 amqplib 661 Start from server, version: 8.0, properties: {u'information': u'Licensed under the MPL.  See http://www.rabbitmq.com/', u'product': u'RabbitMQ', u'copyright': u'Copyright (C) 2007-2012 VMware, Inc.', u'capabilities': {}, u'platform': u'Erlang/OTP', u'version': u'2.8.2'}, mechanisms: [u'PLAIN', u'AMQPLAIN'], locales: [u'en_US']
DEBUG 2012-06-01 12:51:11,331 amqplib 507 Open OK! known_hosts []
DEBUG 2012-06-01 12:51:11,331 amqplib 70 using channel_id: 1
DEBUG 2012-06-01 12:51:11,332 amqplib 484 Channel open
-> eso-dev: OK
    - empty -

django@server:  ./manage.py celeryctl inspect scheduled
<- scheduled
DEBUG 2012-06-01 12:52:07,107 amqplib 661 Start from server, version: 8.0, properties: {u'information': u'Licensed under the MPL.  See http://www.rabbitmq.com/', u'product': u'RabbitMQ', u'copyright': u'Copyright (C) 2007-2012 VMware, Inc.', u'capabilities': {}, u'platform': u'Erlang/OTP', u'version': u'2.8.2'}, mechanisms: [u'PLAIN', u'AMQPLAIN'], locales: [u'en_US']
DEBUG 2012-06-01 12:52:07,108 amqplib 507 Open OK! known_hosts []
DEBUG 2012-06-01 12:52:07,108 amqplib 70 using channel_id: 1
DEBUG 2012-06-01 12:52:07,109 amqplib 484 Channel open
-> eso-dev: OK
    - empty -

django@server: ./manage.py celeryctl inspect registered
<- registered
DEBUG 2012-06-01 12:52:20,567 amqplib 661 Start from server, version: 8.0, properties: {u'information': u'Licensed under the MPL.  See http://www.rabbitmq.com/', u'product': u'RabbitMQ', u'copyright': u'Copyright (C) 2007-2012 VMware, Inc.', u'capabilities': {}, u'platform': u'Erlang/OTP', u'version': u'2.8.2'}, mechanisms: [u'PLAIN', u'AMQPLAIN'], locales: [u'en_US']
DEBUG 2012-06-01 12:52:20,568 amqplib 507 Open OK! known_hosts []
DEBUG 2012-06-01 12:52:20,568 amqplib 70 using channel_id: 1
DEBUG 2012-06-01 12:52:20,569 amqplib 484 Channel open
-> eso-dev: OK
    * celery.backend_cleanup
    * celery.chord
    * celery.chord_unlock
    *
celery_haystack.tasks.CeleryHaystackSignalHandler
    *
celery_haystack.tasks.CeleryHaystackUpdateIndex
    * convert.tasks.create_pdf
    * convert.tasks.create_pngs

此外,每次发生这种情况时,要打印到日志的最后一件事是:

[2012-06-01 12:17:53,777: INFO/MainProcess] Task convert.tasks.create_pdf[319984de-5bc4-47fc-891f-273d827d625f] retry: None
None
[2012-06-01 12:17:54,327: INFO/MainProcess] Task convert.tasks.create_pdf[8a89f3c1-e991-487e-a2db-a57d23bae17f] retry: None
None

这些任务也恰好在打印之前失败了,在我的代码中,我调用的是:

except HTTPError, e:
    statsd.incr('A.stat')
    log.warn('Woops: %s', e)
    create_pdf.retry()

如果我杀死 celeryd (^C,它立即死亡,无需等待任务)并重新启动它,它会继续,就像其他一些任务没有发生任何事情并再次死亡(我认为它总是在create_pdf任务中,但日志显示此任务失败并重试没有问题)

4

1 回答 1

0

这是在 v3.0 中修复的 celery 已知错误。(第 707 期

于 2012-09-10T03:44:44.410 回答