推送数据给DTC改为独立执行的任务
This commit is contained in:
28
celery_worker.py
Normal file
28
celery_worker.py
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Celery Worker 启动脚本
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
# 添加项目根目录到Python路径
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from app.celery_app import celery_app
|
||||
from app.logger import get_logger
|
||||
|
||||
logger = get_logger("celery_worker")
|
||||
|
||||
if __name__ == "__main__":
|
||||
logger.info("🌿 启动Celery Worker...")
|
||||
|
||||
# 启动Celery worker
|
||||
celery_app.start([
|
||||
'worker',
|
||||
'--loglevel=info',
|
||||
'--concurrency=4',
|
||||
'--prefetch-multiplier=1',
|
||||
'--max-tasks-per-child=1000',
|
||||
'--time-limit=300', # 5分钟任务超时
|
||||
'--soft-time-limit=240', # 4分钟软超时
|
||||
])
|
||||
Reference in New Issue
Block a user