Open
Description
Summary:
Custom schedule type is not being used, so is_due
is never called.
- Celery Version: 5.3.5
- Celery-Beat Version: 2.5.0
Exact steps to reproduce the issue:
from app import is_last_day_of_month
CELERY_BEAT_SCHEDULE = {
'foo': {
'options': {'queue': DATABASE_NAME},
'kwargs': {'creator_name': 'system'},
'task': 'tasks.foo', # it doesn't matter what the task is, the issue is with the schedule class
'schedule': is_last_day_of_month(run_every=120),
},
}
Last day of month func. Note that the `is_due` method is never executed - this is because the schedule class is always `schedule` and never `is_last_day_of_month`.
from celery import schedules
class is_last_day_of_month(schedules.schedule):
def is_due(self, last_run_at: datetime) -> tuple[bool, datetime]:
now = date.today()
day_range = calendar.monthrange(now.year, now.month)
eom = now.replace(day=day_range[1])
return (now.day == eom.day, 86400)
Detailed information
Appears to be caused by this:
class IntervalSchedule(models.Model):
...
def schedule(self):
return schedules.schedule(
timedelta(**{self.period: self.every}),
nowfun=lambda: make_aware(now())
)
Metadata
Metadata
Assignees
Labels
No labels