2016-11-13 14:34:38 +00:00
|
|
|
# ~*~ coding: utf-8 ~*~
|
|
|
|
|
|
|
|
from __future__ import absolute_import, unicode_literals
|
|
|
|
import os
|
|
|
|
from datetime import timedelta
|
|
|
|
|
|
|
|
from celery import Celery
|
2017-04-05 11:09:51 +00:00
|
|
|
from celery.schedules import crontab
|
2016-11-13 14:34:38 +00:00
|
|
|
|
|
|
|
# set the default Django settings module for the 'celery' program.
|
|
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'jumpserver.settings')
|
|
|
|
|
|
|
|
from django.conf import settings
|
|
|
|
|
|
|
|
app = Celery('jumpserver')
|
|
|
|
|
|
|
|
# Using a string here means the worker will not have to
|
|
|
|
# pickle the object when using Windows.
|
|
|
|
app.config_from_object('django.conf:settings')
|
2017-01-17 08:34:47 +00:00
|
|
|
app.autodiscover_tasks(lambda: [app_config.split('.')[0]
|
|
|
|
for app_config in settings.INSTALLED_APPS])
|
2016-11-13 14:34:38 +00:00
|
|
|
|
2017-04-05 11:09:51 +00:00
|
|
|
app.conf.update(
|
|
|
|
CELERYBEAT_SCHEDULE={
|
|
|
|
'refresh-asset-hardware-info': {
|
|
|
|
'task': 'assets.tasks.update_assets_hardware_period',
|
|
|
|
'schedule': 60*60*60*24,
|
|
|
|
'args': (),
|
|
|
|
},
|
|
|
|
'test-admin-user-connective': {
|
|
|
|
'task': 'assets.tasks.test_admin_user_connective_period',
|
|
|
|
'schedule': 60*60*60,
|
|
|
|
'args': (),
|
2017-11-14 01:44:16 +00:00
|
|
|
},
|
|
|
|
'clean_terminal_history': {
|
2017-12-01 09:28:47 +00:00
|
|
|
'task': 'terminal.tasks.clean_terminal_history',
|
2017-11-14 01:44:16 +00:00
|
|
|
'schedule': 60*60*60,
|
|
|
|
'args': (),
|
2017-04-05 11:09:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|