Commit 95f5fde2 authored by 张彦钊's avatar 张彦钊

add move_file、kill_process

parent e5a2d469
from processData import * from processData import *
from diaryTraining import * from diaryTraining import *
from diaryCandidateSet import multi_get_eachCityDiaryTop3000
from utils import get_date
...@@ -18,6 +16,9 @@ if __name__ == "__main__": ...@@ -18,6 +16,9 @@ if __name__ == "__main__":
train() train()
end_train = time.time() end_train = time.time()
print("训练模型耗时{}分".format((end_train-start_train)/60)) print("训练模型耗时{}分".format((end_train-start_train)/60))
move_file()
kill_process()
......
...@@ -9,6 +9,7 @@ from sklearn import metrics ...@@ -9,6 +9,7 @@ from sklearn import metrics
from sklearn.metrics import auc from sklearn.metrics import auc
from multiprocessing import Pool from multiprocessing import Pool
import os import os
import signal
def get_date(): def get_date():
...@@ -48,10 +49,19 @@ def con_sql(sql): ...@@ -48,10 +49,19 @@ def con_sql(sql):
def move_file(): def move_file():
for eachFile in os.listdir("/data2/"): import os
if "xlearn" in eachFile: for eachFile in os.listdir("/data2/models/train"):
os.remove("/tmp" + "/" + eachFile) os.rename("/data2/models/train" + "/" + eachFile,"/data2/models/" + eachFile)
print("成功将文件剪切到对应路径")
def kill_process():
out = os.popen("ps aux | grep diaryQueueUpdate.py").read()
for line in out.splitlines():
if 'python diaryQueueUpdate.py' in line:
pid = int(line.split()[1])
os.kill(pid, signal.SIGKILL)
print("已杀死python diaryQueueUpdate.py 进程")
# 把数据写到redis里 # 把数据写到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