Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
0cb76a00
Commit
0cb76a00
authored
Aug 13, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add timely delete csv file
parent
5f50a255
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
predictDiary.py
predictDiary.py
+2
-0
utils.py
utils.py
+13
-0
No files found.
predictDiary.py
View file @
0cb76a00
...
...
@@ -109,4 +109,6 @@ if __name__ == "__main__":
end
=
time
.
time
()
time_cost
=
(
end
-
start
)
print
(
"耗时{}秒"
.
format
(
time_cost
))
# 定期删除预测用户对应的ffm文件
remove_files
(
DIRECTORY_PATH
+
"result"
)
utils.py
View file @
0cb76a00
...
...
@@ -3,6 +3,19 @@ import pymysql
import
pandas
as
pd
import
numpy
as
np
import
redis
import
os
import
time
# 定期删除特定文件夹内特征的文件
def
remove_files
(
fileDir
):
for
eachFile
in
os
.
listdir
(
fileDir
):
if
(
os
.
path
.
isfile
(
fileDir
+
"/"
+
eachFile
))
and
(
"DiaryTop3000.csv"
in
eachFile
):
ft
=
os
.
stat
(
fileDir
+
"/"
+
eachFile
)
ltime
=
int
(
ft
.
st_mtime
)
# 删除5分钟前的文件
ntime
=
int
(
time
.
time
())
-
5
*
60
if
ltime
<=
ntime
:
os
.
remove
(
fileDir
+
"/"
+
eachFile
)
# 从Tidb数据库的表里获取数据,并转化成df格式
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment