diff --git a/lms/celery.py b/lms/celery.py index 78168d7..9ba6937 100644 --- a/lms/celery.py +++ b/lms/celery.py @@ -3,6 +3,7 @@ import os from celery import Celery from raven import Client from raven.contrib.celery import register_signal, register_logger_signal +from celery.schedules import crontab # set the default Django settings module for the 'celery' program. @@ -18,6 +19,13 @@ client = Client('http://caaea487274f4e23a9107862484c79f3:3d463ad4717942508536f7a register_logger_signal(client) register_signal(client) +@app.on_after_configure.connect +def setup_periodic_tasks(sender, **kwargs): + sender.add_periodic_task( + # crontab(minute='0',hour='*/3',), + crontab(minute='*/1'), + 'finance.tasks.periodic_billing' + ) @app.task(bind=True) def debug_task(self): diff --git a/lms/settings.py b/lms/settings.py index a700424..adb44a1 100644 --- a/lms/settings.py +++ b/lms/settings.py @@ -4,7 +4,6 @@ import os import raven import environ import socket -from celery.schedules import crontab root = environ.Path(__file__) - 2 @@ -33,14 +32,6 @@ CELERY_EMAIL_TASK_CONFIG = { 'ignore_result': False, } -CELERYBEAT_SCHEDULE= { - 'periodic_billing': { - 'task': 'finance.tasks.periodic_billing', - 'schedule': crontab(minute='*/1'), - # 'schedule': crontab(minute='0',hour='*/3',), - }, -} - CELERYD_TASK_TIME_LIMIT = 300 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))