任务分布式运行
This commit is contained in:
1 parent
677a836569
commit
d09e0c8c17
14 files changed
+462
-53
No files matched your search
+11
-3
@@ -2,10 +2,12 @@ import os, sys, time, bpy, math, requests, bmesh, json, shutil
|
||||
from PIL import Image
|
||||
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 bmesh_copy_from_object(obj, transform=True, triangulate=True, apply_modifiers=False):
|
||||
"""Returns a transformed, triangulated copy of the mesh"""
|
||||
@@ -183,7 +185,7 @@ def export_and_update_glbs(pid):
|
||||
|
||||
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} glb文件导出并上传完成,共费时{libs.diff_time(start_time)}')
|
||||
|
||||
def step3(pid):
|
||||
def step3(pid,task_distributed_id=""):
|
||||
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} pid: {pid} 开始模型后道处理')
|
||||
start_time = time.time()
|
||||
# 方向、大小、位置等基础校正
|
||||
@@ -207,6 +209,12 @@ def step3(pid):
|
||||
print('上传完成更新建模成功状态:', res.text)
|
||||
shutil.rmtree(os.path.join(config.workdir, pid), ignore_errors=True)
|
||||
libs_db.finish_task({"task_type": "make", "task_key": pid})
|
||||
if task_distributed_id:
|
||||
#更新子表的finished_at
|
||||
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())})
|
||||
#更新主表的status 和 finished_at
|
||||
logic_main_service.update_task_distributed({"id":task_distributed_id,"status":2,"finished_at":time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())})
|
||||
return
|
||||
|
||||
def main(pid):
|
||||
if pid == '0':
|
||||
|
||||
Reference in new issue
Block a user