Django-celery-beat: Cannot update or create new periodic task in django admin interface

Created on 9 Oct 2018  路  8Comments  路  Source: celery/django-celery-beat

After updating to 1.2.0, cannot update or create new periodic task, met with error that must have only one of time schedule, crontab or solar schedule.

adal==1.1.0
amqp==2.3.2
argon2-cffi==18.1.0
asn1crypto==0.24.0
billiard==3.5.0.4
boto3==1.9.19
botocore==1.12.19
celery==4.2.1
certifi==2018.8.24
cffi==1.11.5
chardet==3.0.4
cryptography==2.3.1
Django==2.1.2
django-appconf==1.0.2
django-axes==4.4.0
django-celery-beat==1.2.0
django-celery-results==1.0.1
django-crispy-forms==1.7.2
django-ipware==2.1.0
django-polymorphic==2.0.3
django-smtp-ssl==1.0
django-timezone-field==3.0
dnspython==1.15.0
docutils==0.14
eventlet==0.24.1
future-fstrings==0.4.4
greenlet==0.4.15
idna==2.7
jmespath==0.9.3
kombu==4.2.1
monotonic==1.5
psycopg2==2.7.5
pycparser==2.19
pycurl==7.43.0.2
PyJWT==1.6.4
pypowerbi==0.22
python-crontab==2.3.5
python-dateutil==2.7.3
pytz==2018.5
raven==6.9.0
requests==2.19.1
s3transfer==0.1.13
six==1.11.0
urllib3==1.23
vine==1.1.4

Most helpful comment

Here is how I fixed this.

  1. If you already applied migrations from 1.2.0:
$ ./manage.py showmigrations django_celery_beat
django_celery_beat
 [X] 0001_initial
 [X] 0002_auto_20161118_0346
 [X] 0003_auto_20161209_0049
 [X] 0004_auto_20170221_0000
 [X] 0005_add_solarschedule_events_choices
 [X] 0006_auto_20180322_0932
 [X] 0007_auto_20180521_0826
 [X] 0008_auto_20180914_1922

you should unapply them first: ./manage.py migrate django_celery_beat zero. Because migrations from 1.1.1 and 1.2.0 are not compatible.

  1. Downgrade: pip install django-celery-beat==1.1.1
  2. Apply news migrations:
$ ./manage.py migrate django_celery_beat
Operations to perform:
  Apply all migrations: django_celery_beat
Running migrations:
  Applying django_celery_beat.0001_initial... OK
  Applying django_celery_beat.0002_auto_20161118_0346... OK
  Applying django_celery_beat.0003_auto_20161209_0049... OK
  Applying django_celery_beat.0004_auto_20170221_0000... OK
  Applying django_celery_beat.0005_add_solarschedule_events_choices... OK
  Applying django_celery_beat.0006_auto_20180210_1226... OK
  1. Check that everything is ok:
$ ./manage.py showmigrations django_celery_beat
django_celery_beat
 [X] 0001_initial
 [X] 0002_auto_20161118_0346
 [X] 0003_auto_20161209_0049
 [X] 0004_auto_20170221_0000
 [X] 0005_add_solarschedule_events_choices
 [X] 0006_auto_20180210_1226

As you can see, migration #6 from 1.1.1 and migration #6 from 1.2.0 are different. Here is why you should unapply them first.

P. S. If migrations are not compatible, how to upgrade back to 1.2.1 when it's released?

All 8 comments

https://github.com/celery/django-celery-beat/blob/master/django_celery_beat/models.py#L328

or should be replaced by and

This update appears to have been reverted. The error message "Only one of interval, crontab, or solar must be set" appears when either a single interval or single solar value is selected.

Is anyone gonna make a release in PyPi with this fix? This is a blocker and deserves a quick release.

Installing from git till the fix reaches the PyPi.

Here is how I fixed this.

  1. If you already applied migrations from 1.2.0:
$ ./manage.py showmigrations django_celery_beat
django_celery_beat
 [X] 0001_initial
 [X] 0002_auto_20161118_0346
 [X] 0003_auto_20161209_0049
 [X] 0004_auto_20170221_0000
 [X] 0005_add_solarschedule_events_choices
 [X] 0006_auto_20180322_0932
 [X] 0007_auto_20180521_0826
 [X] 0008_auto_20180914_1922

you should unapply them first: ./manage.py migrate django_celery_beat zero. Because migrations from 1.1.1 and 1.2.0 are not compatible.

  1. Downgrade: pip install django-celery-beat==1.1.1
  2. Apply news migrations:
$ ./manage.py migrate django_celery_beat
Operations to perform:
  Apply all migrations: django_celery_beat
Running migrations:
  Applying django_celery_beat.0001_initial... OK
  Applying django_celery_beat.0002_auto_20161118_0346... OK
  Applying django_celery_beat.0003_auto_20161209_0049... OK
  Applying django_celery_beat.0004_auto_20170221_0000... OK
  Applying django_celery_beat.0005_add_solarschedule_events_choices... OK
  Applying django_celery_beat.0006_auto_20180210_1226... OK
  1. Check that everything is ok:
$ ./manage.py showmigrations django_celery_beat
django_celery_beat
 [X] 0001_initial
 [X] 0002_auto_20161118_0346
 [X] 0003_auto_20161209_0049
 [X] 0004_auto_20170221_0000
 [X] 0005_add_solarschedule_events_choices
 [X] 0006_auto_20180210_1226

As you can see, migration #6 from 1.1.1 and migration #6 from 1.2.0 are different. Here is why you should unapply them first.

P. S. If migrations are not compatible, how to upgrade back to 1.2.1 when it's released?

https://github.com/celery/django-celery-beat/blob/master/django_celery_beat/models.py#L328

or should be replaced by and

Apply these changes and all will work on .../django_celery_beat/models.py https://github.com/celery/django-celery-beat/pull/38

@Markez so you modified the package file ?

This should be fixed with 1.3.0.

Was this page helpful?
0 / 5 - 0 ratings