(self)
| 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): |
no test coverage detected