Max
Max

Reputation: 135

Celery schedule

I have some schedule problem in Celery. The task works, however I want it to run once on Monday, but it runs every minute. My schedule config:

    CELERY_BEAT_SCHEDULE = {
    'kek': {
        'task': 'kek',
        'schedule': crontab(day_of_week=1),
    }
}

Upvotes: 0

Views: 131

Answers (1)

Eliakin Costa
Eliakin Costa

Reputation: 960

Welcome to SO, @Sturm.

Just define hour and minute:

# Executes every Monday morning at 8:30 a.m.
crontab(hour=8, minute=30, day_of_week=1)#Monday is 1

This is happening because the default for crontab is to execute the task every minute.

For further information, just check the documentation for crontab.

Upvotes: 1

Related Questions