Files

32 lines
984 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from celery.schedules import schedule
from backend.app.task.utils.tzcrontab import TzAwareCrontab
# 参考https://docs.celeryq.dev/en/stable/userguide/periodic-tasks.html
LOCAL_BEAT_SCHEDULE = {
'测试同步任务': {
'task': 'task_demo',
'schedule': schedule(30),
},
'测试异步任务': {
'task': 'task_demo_async',
'schedule': TzAwareCrontab('1'),
},
'测试传参任务': {
'task': 'task_demo_params',
'schedule': TzAwareCrontab('1'),
'args': ['你好,'],
'kwargs': {'b': '世界'},
},
'清理操作日志': {
'task': 'backend.app.task.tasks.db_log.tasks.delete_db_opera_log',
'schedule': TzAwareCrontab('0', '0', day_of_week='6'),
},
'清理登录日志': {
'task': 'backend.app.task.tasks.db_log.tasks.delete_db_login_log',
'schedule': TzAwareCrontab('0', '0', day_of_month='15'),
},
}