[Answered ]-Schedule Django Celery periodic tasks to run from time to other time

2👍

celery.py

from celery.schedule import crontab
app.conf.beat_schedule = {
    'compute-every-minute-mon-through-friday-9-to-5': {
         'task': 'sum',
         'schedule': crontab(minute='*/1',
hour='9-17', day_of_week='mon,tue,wed,thu,fri'),
     },
  }

minute='*/1' – runs every minute

hour='9-17' – runs 9am to 5pm

day_of_week='mon,tue,wed,thu,fri' – Monday through Friday

Most of these are available on the documentation page, check it out!

Leave a comment