Django Celery Beat admin updating Cron Schedule Periodic task not taking effect?
like this http://stackoverflow.com/questions/40579804/django-celery-beat-admin-updating-cron-schedule-periodic-task-not-taking-effect
Same issue here. Whenever I update or create a PeriodickTask I have to reload beat to get this changes updated on worker. There a process (I guess pulling process) every 3 minutes on beat saying Writing entries... but nothing happens if you don't restart beat. Are we missing something?
Using: celery 4.0.0 Django 1.9.9 django-celery-beat 1.0.1 Ubuntu 14.04 Redis 2.8.4
Configuration:
BROKER_URL = 'redis://localhost:6379/0'
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERYBEAT_SCHEDULER = 'django_celery_beat.schedulers:DatabaseScheduler'
I have test other celery version and djcelery, it work well. So, it's a bug ? I have read the source code already. The DatabaseScheduler property method 'schedule' have received the changes, but the method 'reserve' can Not get it. Because I do not know about the project,so I do not know why.
Not sure if this helps, but with Celery 4, your setting name should be prefixed. BROKER_URL should be CELERY_BROKER_URL and CELERYBEAT_SCHEDULER should be CELERY_BEAT_SCHEDULER. I don't think you need to specify JSON for any of the serializers because it should be default now.
@mheppner yes I know, config was just a copy paste which contains lines which comes from older Celery versions. The worker and beat process shows config on start which is OK and it reads and writes on Redis and on Django database correctly. DB changes simply don't come to reserve function as @kendazheng says. Anyway, thank you.
@wen96 that's what I figured, but I thought I'd check anyways. I tried using the django-celery-beat scheduler after I made that comment and I also experienced the same issue. A full restart is needed. I'll look at it tonight and see if I can figure out why.
Same here. Any further developments?
It doesn't look like the scheduler itself is ever checked again and I'm not sure why. I think the beat process itself needs to access DatabaseScheduler.schedule() on each tick for it to even detect if something changed, but it's never accessed after the first time.
Exact same issue I am facing, and it is working well with celery==3.1.23 and djcelery.
I had the same issue because I forgot to start the worker with -S django like celery -A proj beat -l info -S django
http://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html
I had the same issue with all options set to worker properly, but had investigated that the schedule has been updated after adding new record and has not been updated after modifying existing record of intervals
However, it was just a message in logs like DatabaseScheduler: Schedule changed. But nothing was really changed in the schedule, nor new task wasn't added neither old task wasn't modified
I had the same issue, i use command celery -A app beat -l info -S django, but tasks doesn't run. My celery config file:
""" from future import absolute_import import os from django.conf import settings from celery import Celery
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings') app = Celery('track') app.config_from_object('django.conf:settings') app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) app.conf.update( CELERY_BROKER_URL='amqp://guest:guest@localhost//', CELERY_ACCEPT_CONTENT=['json'], CELERY_TASK_SERIALIZER='json', CELERY_RESULT_SERIALIZER='json', ) """ my tasks file: """ import logging from app import celery_app
from .models import Note
logger = logging.getLogger(name)
@celery_app.task def create_note(): logger.info('running tasks') Note.new_note() logger.info('tasks finished') """
The create_note method run if i execute in django shell but celery cannont run staks, why???
Hi, same issue here, when modifying a task from admin or even via shell nothings happens, when adding or removing celery beat logs "DatabaseScheduler: Schedule changed." and logs the right scheduleed task, but task are note being executed ( if added to db) or keep exececuting ( if removed from db)
$ pip freeze
amqp==2.1.1
anyjson==0.3.3
Babel==2.3.4
billiard==3.5.0.2
celery==4.0.0
Django==1.10.3
django-celery-beat==1.0.1
django-celery-results==1.0.1
flower==0.9.1
kombu==4.0.0
pkg-resources==0.0.0
pytz==2016.7
tornado==4.2
vine==1.1.3
@roofcat Are you running the command "celery -A app worker -l info" too, in another shell? Celery beat is the scheduler, celery worker spawns a woker which can process the task scheduled by beat. This issue is different from yours, we manage to get the tasks running, our changes to the table periodictask are not picked up by the beat scheduler unless we restart it.
@Squalluca ohh thanks, IT WORKS!!!! i have not realized
Any updates on this, I am also experiencing this issue. Changes after beat has started log a : DatabaseScheduler: Schedule changed. message but the changes do not actually take effect. Newly scheduled tasks dont run and disabled tasks continue to run.
I have a question with celerybeat daemon doesn't run
My /etc/default/celeryd file: `ENV_PYTHON="/home/crojas/.virtualenvs/az-track/bin/python"
CELERY_BIN="/home/crojas/.virtualenvs/az-track/bin/celery"
CELERYD_CHDIR="/home/crojas/az-track"
CELERY_APP_ARG="app"
export DJANGO_SETTINGS_MODULE="app.settings"
CELERYD_NODES=3
CELERYD_OPTS="--concurrency=3"
CELERYD_LOG_LEVEL="INFO"
CELERY_CONFIG_MODULE="app.celery"
CELERYD_LOG_FILE="/var/log/celery/%n.log"
CELERYD_PID_FILE="/var/run/celery/%n.pid"
CELERYD_USER="celery"
CELERYD_GROUP="celery"
CELERY_CREATE_DIRS=1 `
And my /etc/default/celerybeat file: `CELERY_BIN="/home/crojas/.virtualenvs/az-track/bin/celery"
CELERY_APP_ARG="app"
CELERYBEAT_CONFIG_MODULE="app.celery"
CELERYBEAT_OPTS="-S django"
CELERYBEAT_LOG_LEVEL="INFO"
CELERYBEAT_USER="celery"
CELERYBEAT_GROUP="celery"
CELERY_CREATE_DIRS=1 ` My celery worker daemon it works, but celery beat cannot run, why? thanks all
@roofcat if you're using celery 4 and django-celery-beat, you need to follow the upgrade guide and change your settings to the new format.
@mheppner i can run celery beat with manual command successful, but cannot run with daemon :(
the error is: WARNING/MainProcess] DBAccessError WARNING/MainProcess] (13, 'Permission denied')
in my celery.py config: """ from future import absolute_import import os from django.conf import settings from celery import Celery
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings')
app = Celery('test')
app.config_from_object('django.conf:settings') app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
app.conf.update( broker_url='amqp://guest:guest@localhost//', beat_scheduler='django_celery_beat.schedulers.DatabaseScheduler', )
having the same issue, celery 4.0, django 1.10.2, django_celery_beat 1.0.1