芹菜周期性任务不会执行

时间:2015-04-16 07:58:49

标签: python-2.7 celery cloud9-ide

我正在使用cloud 9在线IDE for python dev。 这是我的代码:

from celery import Celery
from celery.schedules import crontab 
from datetime import timedelta

RESULT_URL = 'mongodb://********' 
BROKER_URL = 'redis://*********'

app = Celery('tasks', backend=RESULT_URL,broker=BROKER_URL)
CELERY_TIMEZONE = 'UTC'

 CELERYBEAT_SCHEDULE = {
'add-every-30-seconds': {
    'task': 'tasks.add',
    'schedule': timedelta(seconds=30),
    'args': (16, 16)
},
}

@app.task
def add(x, y):
    print x+y
    return x + y

我正在用命令开始:

celery -A tasks worker --loglevel=info --beat

Celery启动正常,但停止那里的所有活动。手动调用的任务工作正常。 这是控制台日志:

[2015-04-16 07:53:30,954: INFO/Beat] beat: Starting...
[2015-04-16 07:53:32,696: INFO/MainProcess] Connected to redis://*******
[2015-04-16 07:53:34,722: INFO/MainProcess] mingle: searching for neighbors
[2015-04-16 07:53:37,685: INFO/MainProcess] mingle: all alone
[2015-04-16 07:53:40,343: WARNING/MainProcess] celery@*****-demo-project-563148 ready.

我使用RedisLabs免费版作为Broker,使用自托管mongo作为后端存储。我哪里错了?

0 个答案:

没有答案