Lin / backend /celery_beat_config.py
Zelyanoth's picture
fff
25f22bf
raw
history blame
661 Bytes
from celery import Celery
from celery.schedules import crontab
import os
# Create Celery instance for Beat scheduler
celery_beat = Celery('lin_scheduler')
# Configure Celery Beat
celery_beat.conf.broker_url = os.environ.get('CELERY_BROKER_URL', 'redis://localhost:6379/0')
celery_beat.conf.result_backend = os.environ.get('CELERY_RESULT_BACKEND', 'redis://localhost:6379/0')
# Configure schedules
celery_beat.conf.beat_schedule = {
# This task will run every 5 minutes to load schedules from the database
'load-schedules': {
'task': 'load_schedules_task',
'schedule': crontab(minute='*/5'),
},
}
celery_beat.conf.timezone = 'UTC'