我正试图在芹菜中守护我的任务,我已经在没有守护进行测试的情况下运行良好。
但我不能像教程所说的那样守护(http://docs.celeryproject.org/en/latest/tutorials/daemonizing.html#daemonizing) 我有我的档案:
solr_desa.py
from celery import Celery
celery = Celery('solrdesa')
celery.config_from_object('celeryconfig')
@celery.task(name = "doSomething")
def doSomething():
return 6
celeryconfig.py
from celery.schedules import crontab
BROKER_URL = '127.0.0.1'
BROKER_PORT = 5673
CELERY_RESULT_BACKEND = 'redis://127.0.0.1:6969/0'
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TIMEZONE = 'America/Santiago'
CELERY_IMPORTS = ('solr_desa', )
CELERYBEAT_SCHEDULE = {
'solr_schedule': {
'task': 'doSomething',
'schedule': crontab(minute=9, hour=12)
},
}
还有 的的/ etc /默认/ celeryd
CELERY_NODES="w1"
CELERYD_CHDIR="/opt/latam/script/solr"
CELERYD_OPTS="--time-limit=300 --concurrency=8"
CELERY_CONFIG_MODULE="celeryconfig"
CELERYD_LOG_FILE="/var/log/celery/%n.log"
CELERYD_PID_FILE="/var/run/celery/%n.pid"
我使用https://github.com/celery/celery/blob/3.0/extra/generic-init.d/celeryd中的默认celeryd执行,但任务只是排队,但看起来没有工人:(
我的配置错误在哪里? :(
答案 0 :(得分:0)
你的经纪人网址错了它应该是这样的
BROKER_URL : transport://userid:password@hostname:port/virtual_host
#example
BROKER_URL = "amqp://{username}:{password}@{host}:{port}//"
阅读here了解更多详情