任务分布式运行

This commit is contained in:
dongchangxi committed 2023-10-09 15:07:46 +08:00
1 parent 677a836569
commit d09e0c8c17
14 files changed
+462 -53

No files matched your search

+10 -5
View File
@@ -1,10 +1,12 @@
import os, sys, time, shutil, subprocess, shlex
import platform
if platform.system() == 'Windows':
sys.path.append('e:\\libs\\')
#sys.path.append('e:\\libs\\')
sys.path.append('libs')
sys.path.append('logic')
else:
sys.path.append('/data/deploy/make3d/make2/libs/')
import config, libs, libs_db
import config, libs, libs_db,logic_main_service
def load_model(pid):
cmd = f'{config.rcbin} {config.r1["init"]} -load "{os.path.join(config.workdir, pid, f"{pid}.rcproj")}"'
@@ -60,7 +62,7 @@ def make3d(pid):
cmd = shlex.split(cmd)
res = subprocess.run(cmd)
def step2(pid):
def step2(pid,task_distributed_id=""):
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} 开始建模任务step2')
if os.path.exists(os.path.join(config.sharedir, pid)) and not os.path.exists(os.path.join(config.workdir, pid)):
shutil.move(os.path.join(config.sharedir, pid), config.workdir)
@@ -72,8 +74,11 @@ def step2(pid):
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} 建模任务step2完成,共费时{libs.diff_time(start_time)},任务已提交到step3')
# 更新本地任务状态,加入step3任务队列
os.system(f'python d:\\make2\\main_step3.py {pid}')
if task_distributed_id == "":
os.system(f'python d:\\make2\\main_step3.py {pid}')
else:
logic_main_service.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):
if pid == '0':