I try to use this solution but with no success. How can I specify a day of month at which task should be executed? My solution was
class DayOfMonth(schedule):
def __init__(self, day=1):
self.day = day
def is_due(self, last_run_at):
now = datetime.datetime.now()
if now.month != last_run_at.month and now.day == self.day:
return True, 3000
return False, 3000
def __eq__(self, other):
if isinstance(other, DayOfMonth):
return self.day == other.day and self.month == other.month
return False
I try tu run it with django-celery, but I still receive error that run_every is not specified.
EDIT 1:
I run my task adding:
"my_task": {
"task": "util.tasks.CeleryManagementCommand",
"schedule": DayOfMonth(day=4),
"args": ('my_task',),
},
to CELERYBEAT_SHEDULE
dict
EDIT 2:
When I specify run_every in init -> self.run_every = None
I receive an error that None type object has no attribute total_seconds