From 39678f011bce87b47f9aa0243de4a2183f786884 Mon Sep 17 00:00:00 2001 From: zchen Date: Tue, 26 Mar 2024 11:34:54 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=B5=8B=E8=AF=95RABBITMQ=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- app/api/api_test.py | 5 +++-- app/core/config.py | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index c1131cd..a56015f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,4 +19,4 @@ LABEL maintainer="zchengrong@yeah.net" \ name="trinity_aida" -CMD ["gunicorn", "-c", "gunicorn_config.py", "app.main:app"] \ No newline at end of file +CMD ["gunicorn", "-c", "gunicorn_config.py", "app.main:app" , "-e", "RABBITMQ_QUEUES=123"] \ No newline at end of file diff --git a/app/api/api_test.py b/app/api/api_test.py index cd9df51..9c4772d 100644 --- a/app/api/api_test.py +++ b/app/api/api_test.py @@ -2,13 +2,14 @@ import logging from fastapi import APIRouter +from app.core.config import RABBITMQ_QUEUES + logger = logging.getLogger() router = APIRouter() - - @router.get("") def test(): + logger.info(RABBITMQ_QUEUES) logger.info("test") return {"message": "ok"} diff --git a/app/core/config.py b/app/core/config.py index b55fa65..8b8ce60 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -69,3 +69,5 @@ RABBITMQ_PARAMS = { "credentials": pika.credentials.PlainCredentials(username='rabbit', password='123456'), "virtual_host": "/" } + +RABBITMQ_QUEUES = os.getenv("RABBITMQ_QUEUES", "SuperResolution-local") From 17ecd7bf0ae0fa479521dde0e0f0256776df1f97 Mon Sep 17 00:00:00 2001 From: zchen Date: Tue, 26 Mar 2024 11:41:45 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=B5=8B=E8=AF=95RABBITMQ=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a56015f..fa30e10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,4 +19,4 @@ LABEL maintainer="zchengrong@yeah.net" \ name="trinity_aida" -CMD ["gunicorn", "-c", "gunicorn_config.py", "app.main:app" , "-e", "RABBITMQ_QUEUES=123"] \ No newline at end of file +CMD ["gunicorn", "-c", "gunicorn_config.py", "app.main:app" , "-e", "RABBITMQ_QUEUES=SuperResolution-dev"] \ No newline at end of file From 6ab174b0cfb57656d260716f949230b7b506def0 Mon Sep 17 00:00:00 2001 From: zchen Date: Tue, 26 Mar 2024 11:50:57 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=B5=8B=E8=AF=95RABBITMQ=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 2 +- app/service/super_resolution/service.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index 8b8ce60..cf72b85 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -70,4 +70,4 @@ RABBITMQ_PARAMS = { "virtual_host": "/" } -RABBITMQ_QUEUES = os.getenv("RABBITMQ_QUEUES", "SuperResolution-local") +RABBITMQ_QUEUES = os.getenv("RABBITMQ_QUEUES", "SuperResolution-dev") diff --git a/app/service/super_resolution/service.py b/app/service/super_resolution/service.py index d788e20..f015c6c 100644 --- a/app/service/super_resolution/service.py +++ b/app/service/super_resolution/service.py @@ -16,7 +16,7 @@ import tritonclient.grpc as grpcclient from PIL import Image from minio import Minio -from app.core.config import MINIO_IP, MINIO_ACCESS, MINIO_SECRET, MINIO_SECURE, MINIO_PORT, REDIS_HOST, REDIS_PORT, REDIS_DB, SR_MODEL_NAME, RABBITMQ_PARAMS +from app.core.config import MINIO_IP, MINIO_ACCESS, MINIO_SECRET, MINIO_SECURE, MINIO_PORT, REDIS_HOST, REDIS_PORT, REDIS_DB, SR_MODEL_NAME, RABBITMQ_PARAMS, RABBITMQ_QUEUES from app.schemas.super_resolution import SuperResolutionModel from app.service.utils.decorator import RunTime @@ -136,7 +136,7 @@ def publish_message(sr_data): connection = pika.BlockingConnection(pika.ConnectionParameters(**RABBITMQ_PARAMS)) channel = connection.channel() # 发布消息,并设置回调函数 - channel.basic_publish(exchange='', routing_key='SuperResolution-local', body=sr_data) + channel.basic_publish(exchange='', routing_key=RABBITMQ_QUEUES, body=sr_data) logger.info(f" [x] Sent {sr_data}") connection.close() From 6ed08102edd3eec470db0ac1131e1fad76df8d57 Mon Sep 17 00:00:00 2001 From: zchen Date: Tue, 26 Mar 2024 11:51:31 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=B5=8B=E8=AF=95RABBITMQ=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/core/config.py b/app/core/config.py index cf72b85..8b8ce60 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -70,4 +70,4 @@ RABBITMQ_PARAMS = { "virtual_host": "/" } -RABBITMQ_QUEUES = os.getenv("RABBITMQ_QUEUES", "SuperResolution-dev") +RABBITMQ_QUEUES = os.getenv("RABBITMQ_QUEUES", "SuperResolution-local") From fcbb3d9981151ea1225f0026f032d379fc7585a3 Mon Sep 17 00:00:00 2001 From: zchen Date: Tue, 26 Mar 2024 14:25:35 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=B5=8B=E8=AF=95RABBITMQ=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index b14f06c..dacfbab 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,8 @@ version: "3" services: - trinity_aida: - image: "trinity_client_aida:latest" - container_name: trinity_aida + trinity_aida_dev: + image: "trinity_client_aida_dev:latest" + container_name: trinity_aida_dev volumes: - ./trinity_client_aida:/trinity ports: From 1f674fcb092993ade06c225c3e29665ad8fb816c Mon Sep 17 00:00:00 2001 From: zchen Date: Tue, 26 Mar 2024 14:55:20 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=B5=8B=E8=AF=95RABBITMQ=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/api_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/api_test.py b/app/api/api_test.py index 9c4772d..d6e7dcc 100644 --- a/app/api/api_test.py +++ b/app/api/api_test.py @@ -12,4 +12,4 @@ router = APIRouter() def test(): logger.info(RABBITMQ_QUEUES) logger.info("test") - return {"message": "ok"} + return {"message": RABBITMQ_QUEUES}