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
dd935b51
Commit
dd935b51
authored
Aug 29, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加日记队列比较功能
parent
ffd4b6c3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
diaryQueueUpdate.py
diaryQueueUpdate.py
+2
-0
utils.py
utils.py
+15
-0
No files found.
diaryQueueUpdate.py
View file @
dd935b51
...
@@ -7,6 +7,7 @@ import pymysql
...
@@ -7,6 +7,7 @@ import pymysql
from
datetime
import
datetime
from
datetime
import
datetime
# utils 包必须要导,否则ffm转化时用到的pickle找不到utils,会报错
# utils 包必须要导,否则ffm转化时用到的pickle找不到utils,会报错
import
utils
import
utils
from
utils
import
queue_compare
import
warnings
import
warnings
from
multiprocessing
import
Pool
from
multiprocessing
import
Pool
from
userProfile
import
get_active_users
from
userProfile
import
get_active_users
...
@@ -218,6 +219,7 @@ def user_update(device_id, city_id, queue_name,data_set_cid,total_video_id):
...
@@ -218,6 +219,7 @@ def user_update(device_id, city_id, queue_name,data_set_cid,total_video_id):
diary_queue
=
pipe_line
(
queue_name
,
queue_arg
,
device_id
,
total_video_id
)
diary_queue
=
pipe_line
(
queue_name
,
queue_arg
,
device_id
,
total_video_id
)
if
diary_queue
:
if
diary_queue
:
update_sql_dairy_queue
(
queue_name
,
diary_queue
,
device_id
,
city_id
)
update_sql_dairy_queue
(
queue_name
,
diary_queue
,
device_id
,
city_id
)
queue_compare
(
queue_list
,
diary_queue
)
# print("更新结束")
# print("更新结束")
else
:
else
:
print
(
"获取的日记列表是空,所以不更新日记队列"
)
print
(
"获取的日记列表是空,所以不更新日记队列"
)
...
...
utils.py
View file @
dd935b51
...
@@ -48,6 +48,21 @@ def con_sql(sql):
...
@@ -48,6 +48,21 @@ def con_sql(sql):
return
df
return
df
def
queue_compare
(
old_list
,
new_list
):
# 去掉前面的"diary|"
old_list
=
list
(
map
(
lambda
x
:
x
[
6
:],
old_list
))
temp
=
list
(
range
(
len
(
old_list
)))
x_dict
=
dict
(
zip
(
old_list
,
temp
))
temp
=
list
(
range
(
len
(
new_list
)))
y_dict
=
dict
(
zip
(
new_list
,
temp
))
i
=
0
for
key
in
x_dict
.
keys
():
if
x_dict
[
key
]
!=
y_dict
[
key
]:
i
+=
1
print
(
"日记队列更新前日记总个数{},位置发生变化个数{},发生变化率{}
%
"
.
format
(
len
(
old_list
),
i
,
round
(
i
/
len
(
old_list
)
*
100
),
2
))
def
move_file
():
def
move_file
():
import
os
import
os
for
eachFile
in
os
.
listdir
(
"/data2/models/train"
):
for
eachFile
in
os
.
listdir
(
"/data2/models/train"
):
...
...
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