Vic Nicethemer
Vic Nicethemer

Reputation: 1111

Django: CeleryBeat with Supervisor on server doesn't schedule periodic task

I have fully working Django 1.8.5 + Celery 3.1.18 on localhost with periodic task settings. But on server (Ubuntu 14.04) i need additional file celerybeat.conf (first is celery.conf) to make periodic tasks working on server. If i launch manually celery on server simple tasks are working (UPD: also periodic tasks works too with -B option):

celery worker -A engine -B -l debug

but if run with Supervisor it starts, detect periodic task (in settings.py django) but do nothing. No errors in logs (only warnings), no task scheduling

sudo supervisorctl reread
sudo supervisorctl restart celery

How to fix?

here is settings.py

# Celery settings

BROKER_URL = 'django://'

from kombu.serialization import registry
registry.enable('pickle')
import djcelery
djcelery.setup_loader()

CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_RESULT_EXPIRES=3600
CELERY_RESULT_BACKEND='djcelery.backends.database:DatabaseBackend'
CELERY_RESULT_SERIALIZER = 'json' #json pickle msgpack
CELERY_TASK_SERIALIZER = 'json'
CELERY_IMPORTS=["wall.tasks"]
CELERY_TIMEZONE = 'Africa/Nairobi'
CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler"
CELERYBEAT_SCHEDULE_FILENAME = '/var/lib/celery/beat.db'

SECRET_KEY = 'nbx.........#)i0onegi)as%d80hpcxp98%d9sphh^aqgt'
from celery.schedules import crontab
CELERYBEAT_SCHEDULE = {
    'get_all_data': {
        'task': 'tasks.get_all_data',
        'schedule': crontab(minute="*/4"),
        #'args': (16, 16),
    },
}

Upvotes: 0

Views: 1476

Answers (1)

ittus
ittus

Reputation: 22393

Can you post your celerybeat.conf and supervisord.conf here? I have found a very good tutorial at http://www.lexev.org/en/2014/django-celery-setup/

Upvotes: 1

Related Questions