程序优化
This commit is contained in:
1 parent
e83deda268
commit
e1a7647fcb
16 files changed
+634
-91
No files matched your search
@@ -43,9 +43,10 @@ def get_task_distributed():
|
||||
return 'no_data'
|
||||
else:
|
||||
#优先处理step1 和 step3
|
||||
resultData = main_service_db.get_task_distributed_step1()
|
||||
#R11 R12的主机如果已经有在处理step2了,则不能再处理step2,只能处理step1 step3
|
||||
resultData = need_run_step_no_step2()
|
||||
if resultData == "no":
|
||||
#resultData = need_run_step_no_step2()
|
||||
if resultData is None:
|
||||
#return "no"
|
||||
#R11 R12的主机 可以执行step1 2 3 的任务
|
||||
#如果R11 R12的主机目前没有正在执行step2,则优先处理step2,
|
||||
@@ -62,8 +63,9 @@ def get_task_distributed():
|
||||
return resultData
|
||||
#没有任何可执行的
|
||||
return "no"
|
||||
|
||||
resultData["hostname"] = hostname
|
||||
|
||||
resultData = {"hostname":hostname,"run_step":"step1","task_distributed_id":resultData["id"],"task_key":resultData["task_key"]}
|
||||
#resultData["hostname"] = hostname
|
||||
flagRes = update_main_and_add_detail(resultData)
|
||||
if flagRes == "error":
|
||||
print(f'出现错误,有可能是多个进程获取同一个任务了')
|
||||
@@ -213,8 +215,8 @@ def need_run_step_no_step1():
|
||||
xstep = need_run_stepx(row["id"])
|
||||
#print("查询非step1的任务列表",xstep,row["id"])
|
||||
if xstep == "step2":
|
||||
if common.task_need_high_model_or_photo3(row["task_key"]) and hostname != "R11" and hostname != "R12":
|
||||
continue
|
||||
# if common.task_need_high_model_or_photo3(row["task_key"]) and hostname != "R11" and hostname != "R12":
|
||||
# continue
|
||||
#没有正在执行的step1,则返回该任务
|
||||
return {"hostname":hostname,"run_step":xstep,"task_distributed_id":row["id"],"task_key":row["task_key"]}
|
||||
return "no"
|
||||
|
||||
Reference in new issue
Block a user