分布式任务的修改,step2 和 step3 一起跑

This commit is contained in:
dongchangxi committed 2023-10-29 17:57:21 +08:00
1 parent 5f92f7e230
commit fe9c6e6267
3 files changed
+34 -6

No files matched your search

+14 -2
View File
@@ -41,8 +41,16 @@ def make3d(pid):
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} 定位点导入完成')
# defind_distance
#死循环阻塞获取
while True:
time.sleep(3)
#判断是否有 pid_1 的的值
if redisLocal.sismember('model:auto_distance', pid+"_1") == False:
continue
#如果存在就移除掉并退出死循环
redisLocal.lrem('model:auto_distance', 0, pid+"_0")
break
time.sleep(35)
shutil.move(os.path.join(config.workdir, pid, f'{pid}_wait.rcproj'), os.path.join(config.workdir, pid, f'{pid}.rcproj'))
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} 定义定位点距离完成')
#2023-10-27为了解决老版本使用step1 的 重建区域框的问题,这里加入了 -set "sfmEnableCameraPrior=True" -align -set "sfmEnableCameraPrior=False" align 使相机的对齐线统一向下后,再进行重建区域的设置
@@ -90,10 +98,14 @@ def step2(pid,task_distributed_id=""):
if task_distributed_id == "":
os.system(f'python d:\\make2\\main_step3.py {pid}')
else:
main_service_db.update_task_distributed_detail({"task_distributed_id":task_distributed_id,"finished_at":time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())})
#暂时 step2 step3 一起连续执行
os.system(f'python d:\\make2\\main_step3.py {pid}')
main_service_db.update_task_distributed({"id":task_distributed_id,"status":2,"finished_at":time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())})
#main_service_db.update_task_distributed_detail({"task_distributed_id":task_distributed_id,"finished_at":time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())})
return
def main(pid):
redisLocal = config.redis_local
if pid == '0':
while True:
# 取本地mysql队列任务,完成第二步的建模任务