diff --git a/Dockerfile b/Dockerfile index c1131cd..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"] \ 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 diff --git a/app/api/api_test.py b/app/api/api_test.py index cd9df51..d6e7dcc 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"} + return {"message": RABBITMQ_QUEUES} 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") 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() diff --git a/docker-compose.yml b/docker-compose.yml index 495f258..dacfbab 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,8 @@ version: "3" services: - trinity_aida: - build: . - container_name: trinity_aida + trinity_aida_dev: + image: "trinity_client_aida_dev:latest" + container_name: trinity_aida_dev volumes: - ./trinity_client_aida:/trinity ports: