1
This commit is contained in:
1 parent
56a645a5fc
commit
2603709c53
2 files changed
+17
-31
No files matched your search
+1
-31
@@ -1,6 +1,6 @@
|
||||
import os, sys, time, shlex, subprocess, shutil, requests, cv2, numpy as np
|
||||
from PIL import Image
|
||||
import platform,socket,atexit,redis
|
||||
import platform,socket,atexit
|
||||
if platform.system() == 'Windows':
|
||||
sys.path.append('e:\\libs\\')
|
||||
#sys.path.append('libs')
|
||||
@@ -208,40 +208,10 @@ def main(pid, experience=False, makeloop=True,task_distributed_id="",isNoColorTe
|
||||
continue
|
||||
else:
|
||||
experience = False
|
||||
#判断影棚类型,如果是方形影棚,则推入到另外一个重建队列,使用新影棚的建模方式
|
||||
ps_type = get_ps_type(pid)
|
||||
if ps_type == 2:
|
||||
r = create_redis_connection()
|
||||
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pid} 方形影棚数据推入到重建队列用新的建模方式')
|
||||
r.rpush('ai:ai_repeat_for_align_info',pid)
|
||||
libs_db.finish_task({"task_type": "make", "task_key": pid})
|
||||
time.sleep(3)
|
||||
continue
|
||||
|
||||
step1(pid, experience, makeloop,task_distributed_id,isNoColorTexture)
|
||||
else:
|
||||
step1(pid, experience, makeloop,task_distributed_id,isNoColorTexture)
|
||||
|
||||
def create_redis_connection():
|
||||
"""创建 Redis 连接,若连接失败则重试"""
|
||||
while True:
|
||||
try:
|
||||
r = redis.Redis(host="106.14.158.208", password="kcV2000", port=6379, db=6)
|
||||
# 尝试进行一次操作,检查连接是否有效
|
||||
r.ping() # ping 操作是一个简单的连接测试
|
||||
print("Redis连接成功!")
|
||||
return r
|
||||
except ConnectionError:
|
||||
print("Redis连接失败,正在重试...")
|
||||
time.sleep(5)
|
||||
|
||||
|
||||
def get_ps_type(pid):
|
||||
# return 1:圆形影棚 2:方形影棚
|
||||
res = requests.get("https://mp.api.suwa3d.com/api/takephotoOrder/photoStudioInfo", params={'pid': pid})
|
||||
return res.json()['data']['type']
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# 取云端redis任务,完成第一步的数据预处理后,将数据放入共享存储目录,将第二步任务塞入本地mysql队列
|
||||
# 默认循环值守,可传参数运行单一任务,以方便调试
|
||||
|
||||
@@ -27,6 +27,13 @@ def getPSid(pid):
|
||||
res = json.loads(res.text)
|
||||
return str(res['data'])
|
||||
|
||||
def get_ps_type(pid):
|
||||
# return 1:圆形影棚 2:方形影棚
|
||||
res = requests.get("https://mp.api.suwa3d.com/api/takephotoOrder/photoStudioInfo", params={'pid': pid})
|
||||
return res.json()['data']['type']
|
||||
|
||||
|
||||
|
||||
def readTask(key):
|
||||
print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())+"-读取队列-"+'model:'+key)
|
||||
if r.llen('model:'+key) == 0:
|
||||
@@ -39,7 +46,16 @@ def readTask(key):
|
||||
print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())+"-读取的PID为空")
|
||||
return
|
||||
pid = pid.decode('utf-8')
|
||||
|
||||
#判断影棚类型
|
||||
ps_type = get_ps_type(pid)
|
||||
if ps_type == 2:
|
||||
#方形影棚
|
||||
# r.rpush('ai:ai_repeat_build',pid)
|
||||
r.rpush('ai:ai_repeat_for_align_info',pid)
|
||||
return
|
||||
psid = getPSid(pid)
|
||||
|
||||
#判断是否走新的建模系统 2023-11-10 全部走新的建模系统
|
||||
# if libs_db.is_new_make_psid(psid) == False:
|
||||
# #如果不是走新的建模系统就塞回原来的队列
|
||||
|
||||
Reference in new issue
Block a user