提交 81150e15576974dfe3fdf2ba062d551677a77e85

作者 nheweijun
1 个父辈 afdd3afd

2022.04.15 修复任务线程比创建任务更快BUG

@@ -53,7 +53,7 @@ class Api(ApiTemplate): @@ -53,7 +53,7 @@ class Api(ApiTemplate):
53 download_process = multiprocessing.Process(target=self.download, args=(task_guid,self.para)) 53 download_process = multiprocessing.Process(target=self.download, args=(task_guid,self.para))
54 download_process.start() 54 download_process.start()
55 55
56 - task.task_pid = download_process.pid 56 + Task.query.filter_by(guid=task_guid).update({"task_pid": download_process.pid})
57 db.session.commit() 57 db.session.commit()
58 58
59 res["data"] = "下载任务已提交!" 59 res["data"] = "下载任务已提交!"
@@ -100,7 +100,8 @@ class Api(ApiTemplate): @@ -100,7 +100,8 @@ class Api(ApiTemplate):
100 100
101 entry_thread = multiprocessing.Process(target=self.entry,args=(self.para.get("task_guid"),)) 101 entry_thread = multiprocessing.Process(target=self.entry,args=(self.para.get("task_guid"),))
102 entry_thread.start() 102 entry_thread.start()
103 - task.task_pid=entry_thread.pid 103 +
  104 + Task.query.filter_by(guid=task_guid).update({"task_pid": entry_thread.pid})
104 db.session.commit() 105 db.session.commit()
105 106
106 res["result"] = True 107 res["result"] = True
@@ -52,7 +52,8 @@ class Api(ApiTemplate): @@ -52,7 +52,8 @@ class Api(ApiTemplate):
52 52
53 refresh_process = multiprocessing.Process(target=self.table_refresh,args=(database,task_guid,self.para.get("creator"))) 53 refresh_process = multiprocessing.Process(target=self.table_refresh,args=(database,task_guid,self.para.get("creator")))
54 refresh_process.start() 54 refresh_process.start()
55 - task.task_pid = refresh_process.pid 55 +
  56 + Task.query.filter_by(guid=task_guid).update({"task_pid":refresh_process.pid})
56 db.session.commit() 57 db.session.commit()
57 58
58 res["msg"] = "数据库更新已提交!" 59 res["msg"] = "数据库更新已提交!"
@@ -92,7 +92,7 @@ class Api(ApiTemplate): @@ -92,7 +92,7 @@ class Api(ApiTemplate):
92 vacuate_process = multiprocessing.Process(target=self.task,args=(table,task_guid)) 92 vacuate_process = multiprocessing.Process(target=self.task,args=(table,task_guid))
93 vacuate_process.start() 93 vacuate_process.start()
94 94
95 - task.task_pid = vacuate_process.pid 95 + Task.query.filter_by(guid=task_guid).update({"task_pid": vacuate_process.pid})
96 db.session.commit() 96 db.session.commit()
97 97
98 res["msg"] = "矢量金字塔构建已提交!" 98 res["msg"] = "矢量金字塔构建已提交!"
@@ -97,7 +97,8 @@ class Api(ApiTemplate): @@ -97,7 +97,8 @@ class Api(ApiTemplate):
97 97
98 vacuate_process = multiprocessing.Process(target=self.task,args=(table,task_guid,grids)) 98 vacuate_process = multiprocessing.Process(target=self.task,args=(table,task_guid,grids))
99 vacuate_process.start() 99 vacuate_process.start()
100 - task.task_pid = vacuate_process.pid 100 +
  101 + Task.query.filter_by(guid=task_guid).update({"task_pid": vacuate_process.pid})
101 db.session.commit() 102 db.session.commit()
102 103
103 res["msg"] = "矢量金字塔构建已提交!" 104 res["msg"] = "矢量金字塔构建已提交!"
@@ -34,6 +34,6 @@ def compile(des): @@ -34,6 +34,6 @@ def compile(des):
34 shutil.copy(pyc_file,des_pyc_file) 34 shutil.copy(pyc_file,des_pyc_file)
35 35
36 if __name__ == '__main__': 36 if __name__ == '__main__':
37 - des="H:\DMapManagerPublish" 37 + des="H:\DMapManager"
38 compile(des) 38 compile(des)
39 39
注册登录 后发表评论