Hi,I’m new to django and I have a strange problem in django celery-beat.

When I shutdown and reboot my Win10PC that was setup django program,
ddjango celery-beat is booted by windows startup bat.
But infrequently somehow this django celery-beat startup bat does not work.
When I checked django celery-beat console window, which was displayed below message.

celery beat v5.2.6 (dawn-chorus) is starting.
get() returned more than one IntervalSchedule – it returned 2!__???-???.. _???-???
LocalTime → 2022-08-23 14:01:18
Configuration ->???. broker → redis://localhost:6379//???. loader → scheduler →

???. logfile → [stderr]@%INFO???. maxinterval → 5.00 seconds (5s)
[2022-08-23 14:01:18,094: INFO/MainProcess] beat: Starting…

Ordinarily, above message “get() returned more than one IntervalSchedule – it returned 2!__???-???.. __???-???_” is not displayed in console window.
I investigated the cause, it seems that this message was display by ‘django_celery_beat.schedulers.DatabaseScheduler’
was set 2 records.( I made sure 2 records by Django admin panel Intervals table.)
I deleted the one of 2 records and I took reboot django celery-beat.
As a result,above message is not displyed in console window.

I want to know the cause why this phenomenon is happend and the conditions what kind of operation will cause it.

The program I develop is using django, celery and celery-beat.
The version of celery,celery-beat and django that I am using is below.

  • ・celery 5.2.6
  • ・Django 3.2.9
  • ・django-celery-beat 2.2.1

I would be grateful if someone could answer.

well, purely a guess but…

Somewhere in their code, they must do something like:

    interval = IntervalSchedule.objects.get(
        # filter here
except IntervalSchedule.DoesNotExist:

and forgot to do it in this way:

    interval = IntervalSchedule.objects.get(
        # filter here
except IntervalSchedule.DoesNotExist:
except IntervalSchedule.MultipleObjectsReturned:
    # take first one only, for example

Which kind of makes sense. Or would.
The same would happen if you had three, or four, or more intervals of the same duration (60 secs, in this instance) defined in you django admin.

What I do not understand is why you are defining two intervals with exactly the same duration between two ticks. There is not point do so, I believe?
So I think you should examine why you do this in the first place.

Hi plopidou.

Thank you for showing how to get IntervalSchedule.
This way is very helpful for me.

And your question why I have two intervals of same duration is key point of this topic.
Naturally, I don’t need two intervals of my program.
But,somehow it defined two intervals, and I don’t know the cause of this.
The program of celery-beat starting define IntervalSchedule like as follows.

FileMonitoringPeriod = 60

schedule, created = IntervalSchedule.objects.get_or_create(

interval = schedule,
name = ‘programname’,
task = ‘tasksname’

Like above program, it defined django-celery-beat’s time interval value when I reboot by WinPC startup bat every time.
Ordinally, After reboot the PC, one interval value is setted up.
But, I think it maybe insert interval value by this situation that changing status of django celery-beat like updating source file before stopping celery-beat background process or changing the PCtime while working celey-beat.
Because I have faced this incident during developing and testing this program.
(In program testing, I operated and executed in various way.)

Now, I am investigating the situation that happend inserting interval value.
I would be happy if you could tell me any idea.