我有一个celeryd和两个worker一起运行,看着他们,我看到他们分别接受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任务上,但日志显示这个任务失败了,正在重试,没有任何问题)
发布于 2012-09-10 11:44:44
这是一个已知的错误,芹菜已在3.0版本中修复。(Issue 707)
https://stackoverflow.com/questions/10855162
复制相似问题