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
877ac1ae
Commit
877ac1ae
authored
Sep 02, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test
parent
88c29c33
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
18 deletions
+27
-18
diaryUpdateOnlineOffline.py
diaryUpdateOnlineOffline.py
+6
-1
testCases.py
local/testCases.py
+21
-17
No files found.
diaryUpdateOnlineOffline.py
View file @
877ac1ae
...
@@ -291,7 +291,12 @@ def multi_proecess_update(device_id, city_id, data_set_cid,total_video_id):
...
@@ -291,7 +291,12 @@ def multi_proecess_update(device_id, city_id, data_set_cid,total_video_id):
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
warnings
.
filterwarnings
(
"ignore"
)
warnings
.
filterwarnings
(
"ignore"
)
flag
=
True
path
=
DIRECTORY_PATH
# 下面这个ip是本地电脑ip
if
socket
.
gethostbyname
(
socket
.
gethostname
())
==
'172.30.8.160'
:
flag
=
False
path
=
LOCAL_DIRCTORY
# 增加缓存日记视频列表
# 增加缓存日记视频列表
cache_video_id
=
[]
cache_video_id
=
[]
cache_device_city_list
=
[]
cache_device_city_list
=
[]
...
...
local/testCases.py
View file @
877ac1ae
...
@@ -59,26 +59,30 @@ def save_queue():
...
@@ -59,26 +59,30 @@ def save_queue():
df
.
to_csv
(
"/data/models/{}.csv"
.
format
(
i
),
index
=
None
)
df
.
to_csv
(
"/data/models/{}.csv"
.
format
(
i
),
index
=
None
)
print
(
"end"
)
print
(
"end"
)
# def insert():
def
insert
(
id
,
device_id
,
city_id
):
# queue_name_list = ["native_queue", "nearby_queue", "nation_queue", "megacity_queue"]
queue_name_list
=
[
"native_queue"
,
"nearby_queue"
,
"nation_queue"
,
"megacity_queue"
]
# a = {}
a
=
{}
# for i in queue_name_list:
for
i
in
queue_name_list
:
# a[i] = pd.read_csv("/data/models/native_queue.csv")["0"].values.tolist()[0]
a
[
i
]
=
pd
.
read_csv
(
"/data/models/native_queue.csv"
)[
"0"
]
.
values
.
tolist
()[
0
]
#
# columns = ["native_queue", "nearby_queue", "nation_queue", "megacity_queue","id","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',
passwd
=
'o5gbA27hXHHm'
,
# db='doris_prod')
db
=
'doris_prod'
)
# sql = "update device_diary_queue set {}='{}' where device_id = '{}' and city_id = '{}'".format \
sql
=
"INSERT INTO device_diary_queue (native_queue, nearby_queue, nation_queue, "
\
# (i, a[i], device_id, city_id)
"megacity_queue,id,device_id,city_id) VALUES ('{}','{}','{}','{}','{}','{}','{}');"
.
format
\
# cursor = db.cursor()
(
a
[
"native_queue"
],
a
[
"nearby_queue"
],
a
[
"nation_queue"
],
a
[
"megacity_queue"
],
id
,
device_id
,
city_id
)
# cursor.execute(sql)
cursor
=
db
.
cursor
()
# db.commit()
cursor
.
execute
(
sql
)
# db.close()
db
.
commit
()
# print("end")
db
.
close
()
print
(
"end"
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
save_queue
()
id
=
334
device_id
=
'00CA20EB-2719-4518-85CC-60E765AC526F'
city_id
=
'beijing'
insert
(
id
,
device_id
,
city_id
)
...
...
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