-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.py
43 lines (35 loc) · 1.2 KB
/
init.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
Name: 系统初始化,删除所有引擎的日志文件和备份的运行结果
Author:XinYi [email protected]
Time:2016.5
'''
import os
import sys
from os.path import join as pjoin
import shutil
def init_log():
'''
删除所有引擎的日志文件
'''
for engine_dir in os.listdir('eggtart'):
if os.path.isdir('eggtart/' + engine_dir):
log_path = pjoin('eggtart', engine_dir, 'log')
if os.path.exists(log_path):
if os.path.exists(pjoin(log_path, 'engine_stderr.log')):
os.remove(pjoin(log_path, 'engine_stderr.log'))
if os.path.exists(pjoin(log_path, 'engine_stdout.log')):
os.remove(pjoin(log_path, 'engine_stdout.log'))
def init_local_result():
'''
删除所有引擎备份的运行结果
'''
for engine_dir in os.listdir('eggtart'):
if os.path.isdir('eggtart/' + engine_dir):
local_result_path = pjoin('eggtart', engine_dir, 'local_result')
if os.path.exists(local_result_path):
shutil.rmtree(local_result_path)
if __name__ == '__main__':
init_log()
init_local_result()