celery.py
1 from __future__ import absolute_import 2 3 import os 4 from datetime import timedelta 5 6 from django.conf import settings 7 from celery import Celery 8 9 os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cabot.settings') 10 11 app = Celery('cabot') 12 app.config_from_object('cabot.celeryconfig') 13 app.autodiscover_tasks() 14 15 app.conf.beat_schedule = { 16 'run-all-checks': { 17 'task': 'cabot.cabotapp.tasks.run_all_checks', 18 'schedule': timedelta(seconds=60), 19 }, 20 'update-shifts': { 21 'task': 'cabot.cabotapp.tasks.update_shifts', 22 'schedule': timedelta(seconds=1800), 23 }, 24 'clean-db': { 25 'task': 'cabot.cabotapp.tasks.clean_db', 26 'schedule': timedelta(seconds=60 * 60 * 24), 27 }, 28 }