分布式任务调整
This commit is contained in:
1 parent
fe9c6e6267
commit
57831c7167
11 files changed
+224
-96
No files matched your search
+14
-12
@@ -5,8 +5,8 @@ if platform.system() == 'Windows':
|
||||
sys.path.append('e:\\libs\\')
|
||||
else:
|
||||
sys.path.append('/data/deploy/make3d/make2/libs/')
|
||||
import config, libs
|
||||
|
||||
import config, libs,libs_db
|
||||
redisLocal = config.redis_local
|
||||
def find_and_maximize_window(window_title):
|
||||
windows = []
|
||||
win32gui.EnumWindows(lambda hwnd, windows: windows.append(hwnd), windows)
|
||||
@@ -14,10 +14,13 @@ def find_and_maximize_window(window_title):
|
||||
for hwnd in windows:
|
||||
if win32gui.IsWindowVisible(hwnd):
|
||||
if window_title in win32gui.GetWindowText(hwnd):
|
||||
print(f'found {window_title} hwnd:{hwnd}')
|
||||
# win32gui.ShowWindow(hwnd, win32con.SW_MAXIMIZE)
|
||||
win32gui.SetForegroundWindow(hwnd)
|
||||
pid = win32gui.GetWindowText(hwnd).split('wait')[0].split(' ')[0].split('-')[0].split('*')[0].split('_')[0]
|
||||
#判断是否已经存在了,已经存在就不在处理了
|
||||
if redisLocal.lpos('model:auto_distance',pid+"_0") != None or redisLocal.lpos('model:auto_distance',pid+"_1") != None: #pid+"_0" in result or pid+"_1" in result:
|
||||
return '0', 0, 0, 0, 0
|
||||
win32gui.SetForegroundWindow(hwnd)
|
||||
win32gui.ShowWindow(hwnd, win32con.SW_MAXIMIZE)
|
||||
print(f'found {window_title} hwnd:{hwnd}')
|
||||
left, top, right, bottom = win32gui.GetWindowRect(hwnd)
|
||||
return pid, left, top, right, bottom
|
||||
return '0', 0, 0, 0, 0
|
||||
@@ -119,9 +122,12 @@ def defind_distance(pid, left, top, right, bottom):
|
||||
# ag.click()
|
||||
|
||||
get_defineDistances(pid, left, top, right, bottom)
|
||||
|
||||
time.sleep(2)
|
||||
ag.hotkey('ctrl', 's') # save project
|
||||
print("点击保存按钮")
|
||||
time.sleep(6)
|
||||
ag.hotkey('alt', 'f4') # close project
|
||||
print("点击关闭按钮")
|
||||
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} {pid} 定义定位点距离完成')
|
||||
|
||||
#更新 r.lpush('model:auto_distance', pid+"_0")
|
||||
@@ -130,9 +136,10 @@ def defind_distance(pid, left, top, right, bottom):
|
||||
redisLocal.lpush('model:auto_distance', pid+"_1")
|
||||
#去掉pid+"_0"的队列
|
||||
redisLocal.lrem('model:auto_distance', 0, pid+"_0")
|
||||
time.sleep(5)
|
||||
|
||||
def main():
|
||||
redisLocal = config.redis_local
|
||||
|
||||
while True:
|
||||
time.sleep(1)
|
||||
title = "wait"
|
||||
@@ -140,11 +147,6 @@ def main():
|
||||
if pid == '0':
|
||||
pass
|
||||
else:
|
||||
|
||||
#判断是否已经存在了,已经存在就不在处理了
|
||||
if redisLocal.sismember('model:auto_distance', pid+"_0") or redisLocal.sismember('model:auto_distance', pid+"_1"):
|
||||
continue
|
||||
|
||||
redisLocal.lpush('model:auto_distance', pid+"_0")
|
||||
|
||||
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 找到{pid}的定位点距离定义窗口,开始定位点距离定义...')
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ def main(pid, lock=False):
|
||||
{libs.get_defineDistances(psid)} -update -align -align {config.r2["setRegion"]} \
|
||||
{exportxmp} \
|
||||
-exportReconstructionRegion "{os.path.join(config.workdir, pid, f"{pid}.rcbox")}" \
|
||||
-save "{os.path.join(config.workdir, pid, f"{pid}.rcproj")}" -quit'
|
||||
-save "{os.path.join(config.workdir, pid, f"{pid}.rcproj")}"'
|
||||
print(cmd)
|
||||
cmd = shlex.split(cmd)
|
||||
res = subprocess.run(cmd)
|
||||
|
||||
Reference in new issue
Block a user