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
95f5fde2
Commit
95f5fde2
authored
Aug 28, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add move_file、kill_process
parent
e5a2d469
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
6 deletions
+17
-6
train.py
train.py
+3
-2
utils.py
utils.py
+14
-4
No files found.
train.py
View file @
95f5fde2
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
()
...
...
utils.py
View file @
95f5fde2
...
@@ -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里
...
...
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