Commit 7c19f8a6 authored by 张彦钊's avatar 张彦钊

modify delete py file

parent 154779c6
import os import os
import time import time
from config import * from config import *
...@@ -8,7 +6,9 @@ from config import * ...@@ -8,7 +6,9 @@ from config import *
# 定期删除特定文件夹内特征的文件 # 定期删除特定文件夹内特征的文件
def remove_files(fileDir): def remove_files(fileDir):
for eachFile in os.listdir(fileDir): for eachFile in os.listdir(fileDir):
if (os.path.isfile(fileDir + "/" + eachFile)) and ("DiaryTop3000.csv" in eachFile): condition_a = os.path.isfile(fileDir + "/" + eachFile)
condition_b = ("DiaryTop3000.csv" in eachFile) or ("output.txt" in eachFile) or ("feed" in eachFile)
if condition_a and condition_b:
ft = os.stat(fileDir + "/" + eachFile) ft = os.stat(fileDir + "/" + eachFile)
ltime = int(ft.st_mtime) ltime = int(ft.st_mtime)
# 删除5分钟前的文件 # 删除5分钟前的文件
......
...@@ -52,7 +52,7 @@ def predict(user_profile): ...@@ -52,7 +52,7 @@ def predict(user_profile):
param = {"log": "/data2/models/result"} param = {"log": "/data2/models/result"}
ffm_model.predict(param,DIRECTORY_PATH + "model.out", ffm_model.predict(param,DIRECTORY_PATH + "model.out",
DIRECTORY_PATH + "result/{0}_output.txt".format(user_profile['device_id'])) DIRECTORY_PATH + "result/{0}_output.txt".format(user_profile['device_id']))
print("预测结束") print("该用户预测结束")
predict_save_to_local(user_profile, instance) predict_save_to_local(user_profile, instance)
#TODO 没有提供生产环境的redis地址,所以这个函数先不运行 #TODO 没有提供生产环境的redis地址,所以这个函数先不运行
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment