A recent upgrade to django-celery-beat causes the following exception to appear when attempting to start celery beat:
[2018-10-11 11:28:28,973: CRITICAL/MainProcess] beat raised exception <class 'AttributeError'>: AttributeError("'NoneType' object has no attribute 'keys'",)
Traceback (most recent call last):
File "/Users/hugo/projects/envs/qollap/lib/python3.6/site-packages/celery/apps/beat.py", line 109, in start_scheduler
service.start()
File "/Users/hugo/projects/envs/qollap/lib/python3.6/site-packages/celery/beat.py", line 588, in start
interval = self.scheduler.tick()
File "/Users/hugo/projects/envs/qollap/lib/python3.6/site-packages/celery/beat.py", line 291, in tick
not self.schedules_equal(self.old_schedulers, self.schedule)):
File "/Users/hugo/projects/envs/qollap/lib/python3.6/site-packages/celery/beat.py", line 317, in schedules_equal
if set(old_schedules.keys()) != set(new_schedules.keys()):
AttributeError: 'NoneType' object has no attribute 'keys'
The command used to start beat is celery -A project beat -S django. This issue does not occur when using django-celery-beat 1.1.0.
Are you using sqlite as the backend storage in Django ?
Hey @HugoArts we are also facing the same issue, as reported here https://github.com/celery/django-celery-beat/issues/169
This was biting us as well... postgres, redis, rabbitmq
@tinylambda we are using postgres as the backend. Celery is at 4.2.0, django 1.11.14
It does indeed look like a duplicate of #169, good catch.
can you check if the issue still occurs if using code from latest master? may have been fixed by #181
please try to install from github master and lets us know
Same issue happens for me.
Using the latest master here from github.
Django==2.1.1
Celery==4.2.1
So to continue my message about me experiencing the same issue as HugoArts.
If I run celery beat local with celery -A proj beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler It works fine.
If I do the same on my ubuntu server, I reach above error.
This works:
celery 4.2.1
Django 2.1.2
django-celery-beat 1.1.1
With django-celery-beat==1.1.2 it does not.
I started getting into problems because I had 1.2.0 db-schema and it gave me errors like IntegrityError: null value in column "timezone" violates not-null constraint.
Had to install 1.2.0 once again, then doing a ./manage.py migrate django_celery_beat 0004_auto_20170221_0000, before going back to 1.1.0..
Getting the Latest from Master Worked for me, just Waiting for Release on PIP
I have got the same error using django-celery-beat from pip, removed it and cleared the database migrations and installed it from github. Now it works!
1.3.0 should resolve this issue.
Most helpful comment
This works:
With
django-celery-beat==1.1.2it does not.