我有一个芹菜和两个工人一起运行,看着他们,我看到他们每人接受 4 个任务,处理它们,然后停止处理任务。(请注意,这些任务运行时间很长,最多需要 2 分钟才能处理)。
芹菜提供以下信息:
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()
如果我杀死芹菜(^C,它立即死亡,无需等待任务)并再次启动它,它继续,就像什么都没发生一样,再做几个任务并再次死亡(我认为它总是在create_pdf
任务上,但日志显示此任务失败并重试没有问题)
这是一个已知的芹菜错误,已在 v3.0 中修复。(问题 707)