feat(新功能):
fix(修复bug): 图片生成服务优化,避免mq连接超时 docs(文档变更): refactor(重构): test(增加测试):
This commit is contained in:
@@ -20,6 +20,7 @@ from tritonclient.utils import np_to_triton_dtype
|
||||
|
||||
from app.core.config import *
|
||||
from app.schemas.generate_image import GenerateRelightImageModel
|
||||
from app.service.generate_image.utils.mq import publish_status
|
||||
from app.service.generate_image.utils.upload_sd_image import upload_SDXL_image
|
||||
from app.service.utils.oss_client import oss_get_image
|
||||
|
||||
@@ -28,10 +29,6 @@ logger = logging.getLogger()
|
||||
|
||||
class GenerateRelightImage:
|
||||
def __init__(self, request_data):
|
||||
if DEBUG is False:
|
||||
self.connection = pika.BlockingConnection(pika.ConnectionParameters(**RABBITMQ_PARAMS))
|
||||
self.channel = self.connection.channel()
|
||||
# self.minio_client = Minio(MINIO_URL, access_key=MINIO_ACCESS, secret_key=MINIO_SECRET, secure=MINIO_SECURE)
|
||||
self.grpc_client = grpcclient.InferenceServerClient(url=GRI_MODEL_URL)
|
||||
self.redis_client = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB, decode_responses=True)
|
||||
self.category = "relight_image"
|
||||
@@ -137,10 +134,8 @@ class GenerateRelightImage:
|
||||
raise Exception(str(e))
|
||||
finally:
|
||||
dict_gen_product_data, str_gen_product_data = self.read_tasks_status()
|
||||
if DEBUG is False:
|
||||
self.channel.basic_publish(exchange='', routing_key=GRI_RABBITMQ_QUEUES, body=str_gen_product_data)
|
||||
self.connection.close()
|
||||
logger.info(f" [x] Sent to: {GRI_RABBITMQ_QUEUES} data:@@@@ {json.dumps(dict_gen_product_data, indent=4)}")
|
||||
if not DEBUG:
|
||||
publish_status(str_gen_product_data, GRI_RABBITMQ_QUEUES)
|
||||
|
||||
|
||||
def infer_cancel(tasks_id):
|
||||
|
||||
Reference in New Issue
Block a user