调试完成
This commit is contained in:
@@ -7,24 +7,33 @@ logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# 创建Celery应用
|
||||
app = Celery('tasks', broker='redis://localhost:6379/0', backend='redis://localhost:6379/0')
|
||||
app = Celery(
|
||||
'tasks',
|
||||
broker='redis://localhost:6379/0',
|
||||
backend='redis://localhost:6379/0',
|
||||
include=['call_api_task']
|
||||
)
|
||||
|
||||
# 配置Celery
|
||||
app.conf.update(
|
||||
timezone='Asia/Shanghai',
|
||||
enable_utc=True,
|
||||
enable_utc=False,
|
||||
broker_url='redis://localhost:6379/0',
|
||||
result_backend='redis://localhost:6379/0',
|
||||
task_serializer='json',
|
||||
accept_content=['json'],
|
||||
result_serializer='json',
|
||||
ask_track_started=True,
|
||||
|
||||
# Beat 调度配置
|
||||
# crontab(hour=9, minute=0), # 每天上午9点执行
|
||||
beat_schedule={
|
||||
'daily-morning-task': {
|
||||
'task': 'tasks.daily_morning_task',
|
||||
'schedule': 60.0 * 2.0, # 每2分钟执行一次
|
||||
'options': {'queue': 'default'}
|
||||
'task': 'call_api',
|
||||
'schedule': 60.0 * 2.0
|
||||
},
|
||||
},
|
||||
|
||||
# Flower监控配置
|
||||
worker_send_task_events=True,
|
||||
task_send_sent_event=True,
|
||||
|
||||
Reference in New Issue
Block a user