Browse Source

Merge branch 'master' into feature/distributed

master
dongchangxi 2 years ago
parent
commit
f7eb6d02e0
  1. 5
      main_step1.py
  2. 4
      main_step2.py

5
main_step1.py

@ -159,6 +159,11 @@ def step1(pid, experience=False, makeloop=True,task_distributed_id=""):
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pid} step1图片预处理完成,共费时{libs.diff_time(start_time)}') print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pid} step1图片预处理完成,共费时{libs.diff_time(start_time)}')
if os.path.exists(os.path.join(config.sharedir, pid)):
shutil.rmtree(os.path.join(config.sharedir, pid), ignore_errors=True)
shutil.copytree(os.path.join(config.workdir, pid), os.path.join(config.sharedir, pid))
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pid} step1任务完成,移动到共享目录')
# TODO: 更新本地step1任务状态,加入step2任务队列 # TODO: 更新本地step1任务状态,加入step2任务队列
if task_distributed_id == "":#不是分布式任务的时候就自动往下个步骤走,是分布式任务的时候就就执行当前任务 if task_distributed_id == "":#不是分布式任务的时候就自动往下个步骤走,是分布式任务的时候就就执行当前任务
if makeloop: if makeloop:

4
main_step2.py

@ -31,7 +31,7 @@ def make3d(pid):
cmd = f'{config.rcbin} {config.r1["init"]} \ cmd = f'{config.rcbin} {config.r1["init"]} \
-addFolder "{os.path.join(config.workdir, pid, "photo1")}" -addFolder "{os.path.join(config.workdir, pid, "photo2")}" {add_photo3} \ -addFolder "{os.path.join(config.workdir, pid, "photo1")}" -addFolder "{os.path.join(config.workdir, pid, "photo2")}" {add_photo3} \
-importControlPointsMeasurements "{os.path.join(config.workdir, pid, f"{pid}.controlPoints.csv")}" \ -importControlPointsMeasurements "{os.path.join(config.workdir, pid, f"{pid}.controlPoints.csv")}" \
-align -save "{os.path.join(config.workdir, pid, f"{pid}.rcproj")}"' -align -save "{os.path.join(config.workdir, pid, f"{pid}_wait.rcproj")}" '
print(cmd) print(cmd)
cmd = shlex.split(cmd) cmd = shlex.split(cmd)
res = subprocess.run(cmd) res = subprocess.run(cmd)
@ -39,6 +39,8 @@ def make3d(pid):
# defind_distance # defind_distance
time.sleep(20)
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} 定义定位点距离完成') print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} 定义定位点距离完成')
cmd = f'{config.rcbin} {config.r1["init"]} -load "{os.path.join(config.workdir, pid, f"{pid}.rcproj")}" -update \ cmd = f'{config.rcbin} {config.r1["init"]} -load "{os.path.join(config.workdir, pid, f"{pid}.rcproj")}" -update \

Loading…
Cancel
Save