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

Method start_task

class/panelTask.py:288–310  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

286
287 # 开始检测任务
288 def start_task(self):
289 noe = False
290 n = 0
291 tip_file = '/dev/shm/.start_task.pl'
292 while True:
293 try:
294 time.sleep(1)
295 public.writeFile(tip_file, str(int(time.time())))
296 n += 1
297 if not os.path.exists(self.__task_tips) and noe and n < 60:
298 continue
299 if os.path.exists(self.__task_tips):
300 os.remove(self.__task_tips)
301 n = 0
302 public.M(self.__table).where(
303 'status=?', ('-1',)).setField('status', 0)
304 task_list = self.get_task_list(0)
305 for task_info in task_list:
306 self.execute_task(
307 task_info['id'], task_info['type'], task_info['shell'], task_info['other'])
308 noe = True
309 except:
310 print(public.get_error_info())
311
312 # 前端通过任务ID取某一个任务的日志
313 def get_task_log_by_id(self, get):

Callers 1

panelTask.pyFile · 0.45

Calls 9

get_task_listMethod · 0.95
execute_taskMethod · 0.95
writeFileMethod · 0.80
timeMethod · 0.80
existsMethod · 0.45
removeMethod · 0.45
setFieldMethod · 0.45
whereMethod · 0.45
MMethod · 0.45

Tested by

no test coverage detected