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
85ae354e
Commit
85ae354e
authored
Aug 25, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update dairyQueueUpdate file
parent
519e6419
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
17 deletions
+11
-17
diaryQueueUpdate.py
diaryQueueUpdate.py
+11
-17
No files found.
diaryQueueUpdate.py
View file @
85ae354e
...
@@ -170,21 +170,21 @@ def update_sql_dairy_queue(queue_name, diary_id,device_id, city_id):
...
@@ -170,21 +170,21 @@ def update_sql_dairy_queue(queue_name, diary_id,device_id, city_id):
# 更新前获取最新的native_queue
# 更新前获取最新的native_queue
def
get_
native_queue
(
device_id
,
city_id
):
def
get_
megacity_queue
(
device_id
,
city_id
):
db
=
pymysql
.
connect
(
host
=
'rm-m5e842126ng59jrv6.mysql.rds.aliyuncs.com'
,
port
=
3306
,
user
=
'doris'
,
db
=
pymysql
.
connect
(
host
=
'rm-m5e842126ng59jrv6.mysql.rds.aliyuncs.com'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm'
,
db
=
'doris_prod'
)
passwd
=
'o5gbA27hXHHm'
,
db
=
'doris_prod'
)
cursor
=
db
.
cursor
()
cursor
=
db
.
cursor
()
sql
=
"select
native
_queue from device_diary_queue "
\
sql
=
"select
megacity
_queue from device_diary_queue "
\
"where device_id = '{}' and city_id = '{}';"
.
format
(
device_id
,
city_id
)
"where device_id = '{}' and city_id = '{}';"
.
format
(
device_id
,
city_id
)
cursor
.
execute
(
sql
)
cursor
.
execute
(
sql
)
result
=
cursor
.
fetchall
()
result
=
cursor
.
fetchall
()
df
=
pd
.
DataFrame
(
list
(
result
))
df
=
pd
.
DataFrame
(
list
(
result
))
if
not
df
.
empty
:
if
not
df
.
empty
:
native_queue
=
df
.
loc
[
0
,
0
]
.
split
(
","
)
megacity_queue
=
df
.
loc
[
0
,
0
]
.
split
(
","
)
native_queue
=
list
(
map
(
lambda
x
:
"diary|"
+
str
(
x
),
native
_queue
))
megacity_queue
=
list
(
map
(
lambda
x
:
"diary|"
+
str
(
x
),
megacity
_queue
))
db
.
close
()
db
.
close
()
print
(
"成功获取
native
_queue"
)
print
(
"成功获取
megacity
_queue"
)
return
native
_queue
return
megacity
_queue
else
:
else
:
return
False
return
False
...
@@ -226,27 +226,21 @@ def pipe_line(queue_name, queue_arg, device_id):
...
@@ -226,27 +226,21 @@ def pipe_line(queue_name, queue_arg, device_id):
def
user_update
(
device_id
,
city_id
,
data_set_cid
):
def
user_update
(
device_id
,
city_id
,
data_set_cid
):
global
native
_queue_list
global
megacity
_queue_list
#TODO 测试成功后把下面的list还原
#TODO 测试成功后把下面的list还原
queue_name_list
=
[
"native_queue"
,
"nearby_queue"
,
"nation_queue"
,
"megacity_queue"
]
queue_name_list
=
[
"native_queue"
,
"nearby_queue"
,
"nation_queue"
,
"megacity_queue"
]
for
queue_name
in
queue_name_list
:
for
queue_name
in
queue_name_list
:
queue_list
=
get_queue
(
device_id
,
city_id
,
queue_name
)
queue_list
=
get_queue
(
device_id
,
city_id
,
queue_name
)
if
queue_name
==
"
native
_queue"
:
if
queue_name
==
"
megacity
_queue"
:
native
_queue_list
=
queue_list
megacity
_queue_list
=
queue_list
if
queue_list
:
if
queue_list
:
queue_predict
=
list
(
set
(
queue_list
)
&
set
(
data_set_cid
))
queue_predict
=
list
(
set
(
queue_list
)
&
set
(
data_set_cid
))
queue_not_predict
=
list
(
set
(
queue_list
)
-
set
(
data_set_cid
))
queue_not_predict
=
list
(
set
(
queue_list
)
-
set
(
data_set_cid
))
queue_arg
=
[
queue_predict
,
queue_not_predict
,
queue_list
]
queue_arg
=
[
queue_predict
,
queue_not_predict
,
queue_list
]
if
queue_predict
!=
[]:
if
queue_predict
!=
[]:
diary_queue
=
pipe_line
(
queue_name
,
queue_arg
,
device_id
)
diary_queue
=
pipe_line
(
queue_name
,
queue_arg
,
device_id
)
print
(
"diaryqu"
)
print
(
diary_queue
[:
30
])
if
diary_queue
and
(
megacity_queue_list
==
get_megacity_queue
(
device_id
,
city_id
)):
print
(
"native_queue_list"
)
print
(
native_queue_list
[:
30
])
print
(
"get_native_queue"
)
print
(
get_native_queue
(
device_id
,
city_id
)[:
30
])
if
diary_queue
and
(
native_queue_list
==
get_native_queue
(
device_id
,
city_id
)):
update_sql_dairy_queue
(
queue_name
,
diary_queue
,
device_id
,
city_id
)
update_sql_dairy_queue
(
queue_name
,
diary_queue
,
device_id
,
city_id
)
print
(
"更新结束"
)
print
(
"更新结束"
)
else
:
else
:
...
...
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