feat(新功能):
fix(修复bug): 图片生成服务优化,避免mq连接超时 docs(文档变更): refactor(重构): test(增加测试):
This commit is contained in:
@@ -21,6 +21,7 @@ from tritonclient.utils import np_to_triton_dtype
|
||||
|
||||
from app.core.config import *
|
||||
from app.schemas.pose_transform import PoseTransformModel
|
||||
from app.service.generate_image.utils.mq import publish_status
|
||||
from app.service.generate_image.utils.pose_transform_upload import upload_gif, upload_video, upload_first_image
|
||||
from app.service.utils.oss_client import oss_get_image
|
||||
|
||||
@@ -114,23 +115,12 @@ class PoseTransformService:
|
||||
raise Exception(str(e))
|
||||
finally:
|
||||
dict_pose_transform_data, str_pose_transform_data = self.read_tasks_status()
|
||||
if DEBUG is False:
|
||||
publish_status(str_pose_transform_data)
|
||||
if not DEBUG:
|
||||
publish_status(json.dumps(str_pose_transform_data), PS_RABBITMQ_QUEUES)
|
||||
logger.info(
|
||||
f" [x] Sent to: {PS_RABBITMQ_QUEUES} data:@@@@ {json.dumps(dict_pose_transform_data, indent=4)}")
|
||||
|
||||
|
||||
def publish_status(message):
|
||||
connection = pika.BlockingConnection(pika.ConnectionParameters(**RABBITMQ_PARAMS))
|
||||
channel = connection.channel()
|
||||
channel.queue_declare(queue=PS_RABBITMQ_QUEUES, durable=True)
|
||||
channel.basic_publish(exchange='',
|
||||
routing_key=PS_RABBITMQ_QUEUES,
|
||||
body=json.dumps(message),
|
||||
properties=pika.BasicProperties(
|
||||
delivery_mode=2,
|
||||
))
|
||||
connection.close()
|
||||
|
||||
|
||||
def infer_cancel(tasks_id):
|
||||
|
||||
Reference in New Issue
Block a user