同步更改数据
This commit is contained in:
1 parent
ecb58b2f59
commit
33ba8bb357
21 files changed
+2019472
-63
No files matched your search
@@ -0,0 +1,52 @@
|
||||
import platform,sys,redis,time,requests,json,atexit
|
||||
sys.path.append('../libs/')
|
||||
|
||||
import config,libs,libs_db_temp,common
|
||||
import oss2,os
|
||||
|
||||
|
||||
# 将本地文件上传到oss 中,并且清除 oss 上的文件
|
||||
|
||||
#文件存储lua路径
|
||||
typeV = "print"
|
||||
filePath = f"G://obj_fix/{typeV}"
|
||||
ossPrefix = f"objs/{typeV}"
|
||||
def readTask():
|
||||
startTimeTask = time.time()
|
||||
#读取数据库的任务
|
||||
# pid = libs_db_temp.get_task_by_status(100) #2 表示该文件已经处理好了
|
||||
# pid = str(pid)
|
||||
pid = "4417"
|
||||
if int(pid) == 0:
|
||||
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())}: 无任务,延时10s')
|
||||
time.sleep(10)
|
||||
return
|
||||
#检测文件是否存在
|
||||
if not os.path.exists(f"{filePath}/{pid}/{pid}.obj"):
|
||||
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())}: {pid} Error: {filePath}/{pid}/{pid}.obj does not exist.')
|
||||
return False
|
||||
|
||||
if not os.path.exists(f"{filePath}/{pid}/{pid}Tex1.jpg"):
|
||||
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())}: {pid} Error: {filePath}/{pid}/{pid}.obj does not exist.')
|
||||
return False
|
||||
|
||||
if not os.path.exists(f"{filePath}/{pid}/{pid}.mtl"):
|
||||
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())}: {pid} Error: {filePath}/{pid}/{pid}.obj does not exist.')
|
||||
return False
|
||||
|
||||
if not os.path.exists(f"{filePath}/{pid}/{pid}_preview.png"):
|
||||
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())}: {pid} Error: {filePath}/{pid}/{pid}.obj does not exist.')
|
||||
return False
|
||||
|
||||
#清空oss上的文件
|
||||
libs.clear_oss_by_pid(f'{ossPrefix}/{pid}')
|
||||
#上传文件到oss
|
||||
libs.upload_obj_to_oss(filePath,typeV,pid)
|
||||
return
|
||||
|
||||
#程序主入口
|
||||
if __name__ == '__main__':
|
||||
#atexit.register(common.notify,"处理数据校准任务已经停止")
|
||||
readTask()
|
||||
# while True:
|
||||
# pid = readTask()
|
||||
Reference in new issue
Block a user