You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.0 KiB
33 lines
1.0 KiB
from __future__ import absolute_import, unicode_literals
|
|
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.
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lms.settings')
|
|
|
|
app = Celery('lms')
|
|
|
|
app.config_from_object('django.conf:settings', namespace='CELERY')
|
|
|
|
app.autodiscover_tasks()
|
|
|
|
client = Client('http://caaea487274f4e23a9107862484c79f3:3d463ad4717942508536f7a659921950@sentry.skillbox.ru/7')
|
|
register_logger_signal(client)
|
|
register_signal(client)
|
|
|
|
app.conf.beat_schedule = {
|
|
'periodic_billing': {
|
|
# 'schedule': crontab(day_of_month='1', hour='1', minute='1'), # заглушка на время отладки
|
|
'schedule': crontab(minute='0', hour='*/3',),
|
|
'task': 'finance.tasks.periodic_billing'
|
|
}
|
|
}
|
|
|
|
|
|
@app.task(bind=True)
|
|
def debug_task(self):
|
|
print('Request: {0!r}'.format(self.request))
|
|
|