Celery 3.1.11
settings.py
# Celery transport
BROKER_URL = 'django://'
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = 'json'
from celery.schedules import crontab
CELERYBEAT_SCHEDULE = {
'every-minute': {
'task': 'tasks.sync_oracle_history',
'schedule': crontab(minute='*/1'),
},
}
in project.apps.proj folder, add a tasks.py
from __future__ import absolute_import
from celery import task
@task(name='tasks.sync_oracle_history')
def sync_oracle_history():
print "="*30
print "TODO: sync_oracle_history pending"
no idea, any hints for me is welcome.
in bash shell,when run command: celery beat -A proj -l info, only send to queue, not runing the task,
but change the command celery worker -A proj -l info, the task will trigger.
Beat does not execute tasks, it just sends the messages. You need both a beat instance and a worker instance!
thanks @ask
Hi, how can i do for don't use those commands every time i want to run the tasks? @xiaods @ask
Most helpful comment
Beat does not execute tasks, it just sends the messages. You need both a beat instance and a worker instance!