ShrAwan Poudel
ShrAwan Poudel

Reputation: 174

Celery interval schedule time

I am using django celery beat to schedule my task . Currently i am just creating a interval schedule of 2 days and creating a periodic task to run at that interval .

My main problem is , when i schedule a task to run at 2 days , at what time does it run ? and cant i change that time , because i need to run the interval task at certain time provided by the user . The code written so far is

        periodic_task=PeriodicTask.objects.update_or_create(
            name='my-interval-task,
            defaults={
                'interval': schedule, #interval schedule object 
                'task': 'myapp.tasks.auto_refresh',
            }
        )

Upvotes: 2

Views: 1280

Answers (1)

Michael
Michael

Reputation: 11

Have a look at the crontab class

Eg. schedule = crontab(hour=0, minute=0, day_of_month='2-30/3') fires every even numbered day at midnight

Upvotes: 1

Related Questions