MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / run_task

Method run_task

mod/project/java/project_update.py:117–150  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

115
116 # 实际执行启动的线程
117 def run_task(self):
118 print("___________开始________________")
119 try:
120 res = self.start_new()
121 self.keep_status[0]["status"] = 1
122 if res:
123 self.keep_status[0]["msg"] = res
124 return
125 else:
126 self.keep_status[0]["msg"] = "新实例已启动,新实例pid:{}".format(self.new_pro.pid)
127 res = self.set_nginx_upstream()
128 self.keep_status[1]["status"] = 1
129 if res:
130 self.stop_new()
131 self.keep_status[1]["msg"] = res
132 return
133 else:
134 self.keep_status[1]["msg"] = "Nginx已配置完成轮询设置,您可以访问新实例了"
135 res = self.wait_time()
136 self.keep_status[2]["status"] = 1
137 if res:
138 self.keep_status[2]["msg"] = res
139 return
140 else:
141 self.keep_status[2]["msg"] = "等待时间结束,新实例已启动成功"
142 res = self.stop_old()
143 self.keep_status[3]["status"] = 1
144 self.keep_status[3]["msg"] = res if res else "停止旧实例成功,项目更新已结束"
145 public.M("sites").where("id=?", (self.old_project_data["id"],)).update(
146 {"project_config": json.dumps(self.new_project_config)}
147 )
148 except:
149 print(traceback.format_exc())
150 pass
151
152 def stop_new(self):
153 new_server_name = "spring_" + self.project_name + self.new_project_config.get("server_name_suffix", "")

Callers

nothing calls this directly

Calls 10

start_newMethod · 0.95
set_nginx_upstreamMethod · 0.95
stop_newMethod · 0.95
wait_timeMethod · 0.95
stop_oldMethod · 0.95
formatMethod · 0.45
updateMethod · 0.45
whereMethod · 0.45
MMethod · 0.45
dumpsMethod · 0.45

Tested by

no test coverage detected