当Celery收到任务时,此任务永远不会被执行,只是挂起: 这些任务是以非常低的负载随机到达的。
芹菜 3.1.20
[2016-03-02 22:33:08,300: INFO/MainProcess] Received task: catalogue.cluster.deploy_cluster.imbue_cluster[A5C030C4E0]
[2016-03-02 22:33:08,303: INFO/MainProcess] Scaling up 1 processes.
在此之后,没有任何反应。
我使用shell脚本使用supervisord启动芹菜:
source ~/.profile
CELERY_LOGFILE=/usr/local/src/imbue/application/imbue/log/celeryd.log
CELERYD_OPTS=" --loglevel=INFO --autoscale=10,5"
cd /usr/local/src/imbue/application/imbue/conf
exec celery worker -n celeryd@%h -f $CELERY_LOGFILE $CELERYD_OPTS
我的配置:
CELERYD_CHDIR=settings.filepath
CELERY_IGNORE_RESULT = False
CELERY_RESULT_BACKEND = "amqp"
CELERY_TASK_RESULT_EXPIRES = 360000
CELERY_RESULT_PERSISTENT = True
BROKER_URL=<rabbitmq>
CELERY_ENABLE_UTC=True
CELERY_TIMEZONE= "US/Eastern"
CELERY_IMPORTS=("catalogue.cluster.deploy_cluster",
"tools.deploy_tools",)
这就是我调用任务的方式:
celery = Celery()
celery.config_from_object('conf.celeryconfig')
celery.send_task("catalogue.cluster.deploy_cluster.imbue_cluster",
kwargs={'configuration': configuration,
'job': job_instance,
'api_call': True},
task_id=job_instance.reference)
@task(bind=True, default_retry_delay=300, max_retries=5)
def imbue_cluster(...)
类似问题:
http://comments.gmane.org/gmane.comp.python.amqp.celery.user/4990 https://groups.google.com/forum/#!topic/cloudify-users/ANvSv7mV7h4