Merge remote-tracking branch 'origin/develop' into develop

# Conflicts:
#	docker-compose.yml
This commit is contained in:
zhouchengrong
2024-04-03 10:27:08 +08:00
5 changed files with 12 additions and 9 deletions

View File

@@ -19,4 +19,4 @@ LABEL maintainer="zchengrong@yeah.net" \
name="trinity_aida" name="trinity_aida"
CMD ["gunicorn", "-c", "gunicorn_config.py", "app.main:app"] CMD ["gunicorn", "-c", "gunicorn_config.py", "app.main:app" , "-e", "RABBITMQ_QUEUES=SuperResolution-dev"]

View File

@@ -2,13 +2,14 @@ import logging
from fastapi import APIRouter from fastapi import APIRouter
from app.core.config import RABBITMQ_QUEUES
logger = logging.getLogger() logger = logging.getLogger()
router = APIRouter() router = APIRouter()
@router.get("") @router.get("")
def test(): def test():
logger.info(RABBITMQ_QUEUES)
logger.info("test") logger.info("test")
return {"message": "ok"} return {"message": RABBITMQ_QUEUES}

View File

@@ -69,3 +69,5 @@ RABBITMQ_PARAMS = {
"credentials": pika.credentials.PlainCredentials(username='rabbit', password='123456'), "credentials": pika.credentials.PlainCredentials(username='rabbit', password='123456'),
"virtual_host": "/" "virtual_host": "/"
} }
RABBITMQ_QUEUES = os.getenv("RABBITMQ_QUEUES", "SuperResolution-local")

View File

@@ -16,7 +16,7 @@ import tritonclient.grpc as grpcclient
from PIL import Image from PIL import Image
from minio import Minio 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.schemas.super_resolution import SuperResolutionModel
from app.service.utils.decorator import RunTime from app.service.utils.decorator import RunTime
@@ -136,7 +136,7 @@ def publish_message(sr_data):
connection = pika.BlockingConnection(pika.ConnectionParameters(**RABBITMQ_PARAMS)) connection = pika.BlockingConnection(pika.ConnectionParameters(**RABBITMQ_PARAMS))
channel = connection.channel() 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}") logger.info(f" [x] Sent {sr_data}")
connection.close() connection.close()

View File

@@ -1,8 +1,8 @@
version: "3" version: "3"
services: services:
trinity_aida: trinity_aida_dev:
build: . image: "trinity_client_aida_dev:latest"
container_name: trinity_aida container_name: trinity_aida_dev
volumes: volumes:
- ./trinity_client_aida:/trinity - ./trinity_client_aida:/trinity
ports: ports: