gpt4 book ai didi

python - Flower-Celery异步任务监视工具-在Flask/Docker Web API上

转载 作者:行者123 更新时间:2023-12-02 20:03:49 34 4
gpt4 key购买 nike

无法运行Flower来监视在我的docker部署的flask应用程序上运行的celery异步任务。我已经尝试了所有方法,但是有关在docker部署环境中运行花的文档非常稀少,但我仍然相对较新。

我的docker-compose.yml文件的Web, celery 和花朵部分

version: "3.6"

services:
web:
image: <image here>
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints: [node.role == manager] # this parameter should be worker when in the cloud with managers and workers
command: ./docker_setup.sh postgres postgres_test
depends_on:
- celery
environment:
- PYTHONUNBUFFERED=1
secrets:
- <secret shtuff>
networks:
- webnet
labels:
- <local deployment label>

celery:
image: <image here>
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints: [node.role == manager] # this parameter should be worker when in the cloud with managers and workers
command: celery worker -A celery_worker.celery --loglevel=info
depends_on:
- postgres
- redis
environment:
- PYTHONUNBUFFERED=1
secrets:
- <secret shtuff>
networks:
- webnet
labels:
- <local deployment label>

flower:
image: <image here>
environment:
- PYTHONUNBUFFERED=1
working_dir: /code
command: celery flower -A celery_worker.celery --port=5555
depends_on:
- postgres
- redis
- celery
ports:
- "5555:5555"
links:
- db
- redis
networks:
- webnet

当我通过docker本地部署(以便可以通过 localhost访问Web API)时,它运行良好,并且可以通过celery日志查看该应用程序正在运行并顺利处理异步请求。但是,当我尝试通过执行 $ flower并转到 http://localhost:5555来访问花监控应用程序时,花应用程序会加载,但未显示任何线程或工作程序。任何建议或帮助将不胜感激!

最佳答案

哇。愚蠢的疏忽并忘记了在我的应用程序的我的requirements.txt文件中包括flower==0.9.2。完成该操作后,在进行本地部署后,flower在localhost:5555上公开。奇迹般有效!

关于python - Flower-Celery异步任务监视工具-在Flask/Docker Web API上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51601953/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com