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

Method start

task.py:1754–1772  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1752 write_log("执行任务:{}".format(task['name']))
1753
1754 def start(self):
1755 tip_file = '/dev/shm/.start_task.pl'
1756 start_file = '/dev/shm/bt_task_now.pl'
1757 n = 0
1758 # 每60秒主动执行一次,当存在开始文件时,被动执行一次
1759 while True:
1760 try:
1761 time.sleep(1)
1762 write_file(tip_file, str(int(time.time())))
1763 n += 1
1764 if not os.path.exists(start_file) and n < 60:
1765 continue
1766 if os.path.exists(start_file):
1767 os.remove(tip_file)
1768 n = 0
1769 self.do_once()
1770 except:
1771 err = traceback.format_exc()
1772 write_log("bt_task任务执行失败:", err,_level='ERROR', color='red')
1773
1774
1775class _TaskListService:

Callers

nothing calls this directly

Calls 6

do_onceMethod · 0.95
timeMethod · 0.80
write_fileFunction · 0.70
write_logFunction · 0.70
existsMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected