定时调外部任务开启api
This commit is contained in:
25
run_flower.py
Normal file
25
run_flower.py
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python3
|
||||
"""启动Flower监控服务"""
|
||||
from celery import Celery
|
||||
from flower import command as flower_command
|
||||
|
||||
def start_flower():
|
||||
"""启动Flower监控"""
|
||||
print("启动Flower监控服务...")
|
||||
print("监控地址: http://localhost:5555")
|
||||
print("按 Ctrl+C 停止服务")
|
||||
|
||||
# Flower配置
|
||||
flower_options = {
|
||||
'broker': 'redis://localhost:6379/0',
|
||||
'port': 5555,
|
||||
'basic_auth': None, # 可以设置用户名:密码,如 'admin:password'
|
||||
'inspect_timeout': 1000,
|
||||
'purge_offline_workers': 60,
|
||||
}
|
||||
|
||||
# 启动Flower
|
||||
flower_command.flower_command(flower_options)
|
||||
|
||||
if __name__ == '__main__':
|
||||
start_flower()
|
||||
Reference in New Issue
Block a user