【问题标题】:Celeryd does not execute my workersCeleryd 不会处决我的工人
【发布时间】:2012-12-07 07:39:57
【问题描述】:

我正在尝试在 celery 中对我的任务进行守护进程,我已经在没有守护进程的情况下进行了测试,并且效果很好。

但我不能像教程所说的那样守护进程 (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/default/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 执行,但任务刚刚入队,但看起来没有工人 :(

我的配置错误在哪里? :(

【问题讨论】:

    标签: celery celeryd celery-task


    【解决方案1】:

    您的代理 url 错误,应该是这样的

    BROKER_URL : transport://userid:password@hostname:port/virtual_host
    #example
    BROKER_URL = "amqp://{username}:{password}@{host}:{port}//"
    

    阅读here了解更多详情

    【讨论】:

      猜你喜欢
      • 2011-12-09
      • 2016-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-18
      • 2012-03-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多