dongchangxi 1 month ago
parent
commit
b65765e670
  1. 6
      script/factory_sliceing/download_print_out.py
  2. 6
      script/factory_sliceing/type_setting_order.py

6
script/factory_sliceing/download_print_out.py

@ -198,15 +198,15 @@ def read_pids_from_json(pid_file): @@ -198,15 +198,15 @@ def read_pids_from_json(pid_file):
# 检查JSON文件是否存在
if not os.path.exists(json_path):
print(f"错误: JSON文件不存在 - {json_path}")
return []
return [], {}
# 读取JSON文件
try:
with open(json_path, 'r') as f:
with open(json_path, 'r', encoding='utf-8') as f:
data = json.load(f)
except Exception as e:
print(f"读取JSON文件失败: {e}")
return []
return [], {}
list_model_info = []
# 处理每个模型

6
script/factory_sliceing/type_setting_order.py

@ -82,10 +82,10 @@ def step1(versionId): @@ -82,10 +82,10 @@ def step1(versionId):
if not ossClient().object_exists(jsonFilePath):
return False
#下载文件到项目所在目录
dirNow = currentDir + '/batchPrint/' + versionId + '/json'
dirNow = os.path.join(currentDir, 'batchPrint', versionId, 'json')
if not os.path.exists(dirNow):
os.makedirs(dirNow)
localFilePath = dirNow + '/' + versionId + '.json'
localFilePath = os.path.join(dirNow, f'{versionId}.json')
ossClient().get_object_to_file(jsonFilePath, localFilePath)
return True
@ -141,7 +141,7 @@ def main(work_dir=None): @@ -141,7 +141,7 @@ def main(work_dir=None):
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} JSON文件下载数据失败,等待10秒')
time.sleep(10)
continue
jsonFilePath = currentDir + '/batchPrint/' + versionId + '/json/' + versionId + '.json'
jsonFilePath = os.path.join(currentDir, 'batchPrint', versionId, 'json', f'{versionId}.json')
step2(jsonFilePath, versionId)
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 数据处理完成,等待10秒')
requestApiToUpdateSliceStatus(versionId)

Loading…
Cancel
Save