django-celery-beat icon indicating copy to clipboard operation
django-celery-beat copied to clipboard

AttributeError 'NoneType' object has no attribute 'keys' on startup

Open HugoArts opened this issue 8 years ago • 13 comments

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.

HugoArts avatar Oct 11 '18 09:10 HugoArts

Are you using sqlite as the backend storage in Django ?

tinylambda avatar Oct 11 '18 14:10 tinylambda

Hey @HugoArts we are also facing the same issue, as reported here https://github.com/celery/django-celery-beat/issues/169

pkolios avatar Oct 11 '18 14:10 pkolios

This was biting us as well... postgres, redis, rabbitmq

xeor avatar Oct 12 '18 12:10 xeor

@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.

HugoArts avatar Oct 12 '18 12:10 HugoArts

can you check if the issue still occurs if using code from latest master? may have been fixed by #181

rsichnyi avatar Oct 13 '18 10:10 rsichnyi

please try to install from github master and lets us know

auvipy avatar Oct 13 '18 11:10 auvipy

Same issue happens for me. Using the latest master here from github. Django==2.1.1 Celery==4.2.1

weestack avatar Oct 14 '18 17:10 weestack

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.

weestack avatar Oct 14 '18 18:10 weestack

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.

normoes avatar Oct 17 '18 04:10 normoes

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..

xeor avatar Oct 25 '18 05:10 xeor

Getting the Latest from Master Worked for me, just Waiting for Release on PIP

PauloPeres avatar Nov 01 '18 22:11 PauloPeres

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!

slavpetroff avatar Nov 05 '18 12:11 slavpetroff

1.3.0 should resolve this issue.

thedrow avatar Nov 13 '18 11:11 thedrow