【发布时间】:2015-02-18 15:17:33
【问题描述】:
我正在使用 celery 并尝试运行 corntab。下面是我的 celery.py
from __future__ import absolute_import
from celery.schedules import crontab
from celery import Celery
app = Celery('Celery_1',
broker='amqp://test:test@localhost//',
include=['Celery_1.tasks'])
# Optional configuration, see the application user guide.
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
CELERYBEAT_SCHEDULE = {
'T1': {
'task': 'Celery_1.tasks.add',
'schedule': crontab(minute='*/1'),
'args': (4, 5)
}
},
CELERY_IMPORTS = ('Celery_1.tasks', )
)
if __name__ == '__main__':
app.start()
还有我的tasks.py
from __future__ import absolute_import
from Celery_1.celery import app
@app.task(name='Celery_1.add')
def add(x, y):
return x + y
当我按 celery beat 安排时
但它并不是每分钟都在运行任务。谁能帮帮我?
【问题讨论】:
-
您的问题解决了吗?如何?我也面临同样的问题