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
d3c016f3
Commit
d3c016f3
authored
Sep 02, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test
parent
5a935845
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
20 deletions
+59
-20
diaryUpdateOnlineOffline.py
diaryUpdateOnlineOffline.py
+1
-6
testCases.py
local/testCases.py
+48
-14
utils.py
utils.py
+10
-0
No files found.
diaryUpdateOnlineOffline.py
View file @
d3c016f3
...
@@ -291,12 +291,7 @@ def multi_proecess_update(device_id, city_id, data_set_cid,total_video_id):
...
@@ -291,12 +291,7 @@ 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 @
d3c016f3
...
@@ -39,23 +39,57 @@ def get_local_device():
...
@@ -39,23 +39,57 @@ def get_local_device():
df
.
to_csv
(
'/Users/mac/utils/test_device_city_id.csv'
,
index
=
None
)
df
.
to_csv
(
'/Users/mac/utils/test_device_city_id.csv'
,
index
=
None
)
print
(
1
)
print
(
1
)
if
__name__
==
"__main__"
:
def
save_queue
():
LOCAL_HOST
=
'rdsmaqevmuzj6jy.mysql.rds.aliyuncs.com'
id
=
334
db
=
pymysql
.
connect
(
host
=
LOCAL_HOST
,
port
=
3306
,
user
=
'work'
,
passwd
=
'workwork'
,
db
=
'doris_test'
)
device_id
=
'00CA20EB-2719-4518-85CC-60E765AC526F'
diary_id
=
[
14207355
,
16197023
,
13006945
,
12363565
,
15296547
,
15082216
,
16198052
,
15228350
,
13006942
,
14229868
,
15303563
,
16211116
,
15225921
,
15250715
,
15271108
,
15479315
,
16197047
,
15544727
,
15336944
,
15486003
,
15517196
,
16211130
,
15547275
,
15572010
]
device_id
=
'99000645287876'
city_id
=
'beijing'
city_id
=
'beijing'
cursor
=
db
.
cursor
()
queue_name_list
=
[
"native_queue"
,
"nearby_queue"
,
"nation_queue"
,
"megacity_queue"
]
id_str
=
str
(
diary_id
[
0
])
for
i
in
queue_name_list
:
for
i
in
range
(
1
,
len
(
diary_id
)):
sql
=
"select {} from device_diary_queue "
\
id_str
=
id_str
+
","
+
str
(
diary_id
[
i
]
)
"where device_id = '{}' and city_id = '{}';"
.
format
(
i
,
device_id
,
city_id
)
sql
=
"insert into device_diary_queue values ('{}','{}','{}','{}','{}','{}',89)"
.
format
\
db
=
pymysql
.
connect
(
host
=
'rm-m5e842126ng59jrv6.mysql.rds.aliyuncs.com'
,
port
=
3306
,
user
=
'doris'
,
(
device_id
,
city_id
,
id_str
,
id_str
,
id_str
,
id_str
)
passwd
=
'o5gbA27hXHHm'
,
db
=
'doris_prod'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
cursor
.
execute
(
sql
)
db
.
commit
()
result
=
cursor
.
fetchall
()
db
.
close
()
df
=
pd
.
DataFrame
(
list
(
result
))
print
(
"成功写入diary_id"
)
print
(
df
.
shape
)
df
.
to_csv
(
"/data2/models/{}.csv"
.
format
(
i
),
index
=
None
)
print
(
"end"
)
# def insert():
# queue_name_list = ["native_queue", "nearby_queue", "nation_queue", "megacity_queue"]
# a = {}
# for i in queue_name_list:
# a[i] = pd.read_csv("/data2/models/native_queue.csv")["0"].values.tolist()[0]
#
# db = pymysql.connect(host='rm-m5e842126ng59jrv6.mysql.rds.aliyuncs.com', port=3306, user='doris',
# passwd='o5gbA27hXHHm',
# db='doris_prod')
# sql = "update device_diary_queue set {}='{}' where device_id = '{}' and city_id = '{}'".format \
# (i, a[i], device_id, city_id)
# cursor = db.cursor()
# cursor.execute(sql)
# db.commit()
# db.close()
# print("end")
if
__name__
==
"__main__"
:
save_queue
()
# native_queue,nearby_queue,nation_queue,megacity_queue,
# a['native_queue'],a['nearby_queue'],a['nation_queue'],a['megacity_queue'],
...
...
utils.py
View file @
d3c016f3
...
@@ -10,6 +10,16 @@ from multiprocessing import Pool
...
@@ -10,6 +10,16 @@ from multiprocessing import Pool
import
os
import
os
import
signal
import
signal
from
config
import
*
from
config
import
*
import
socket
def
judge_online
():
flag
=
True
path
=
DIRECTORY_PATH
# 下面这个ip是本地电脑ip
if
socket
.
gethostbyname
(
socket
.
gethostname
())
==
'172.30.8.160'
:
flag
=
False
path
=
LOCAL_DIRCTORY
return
flag
,
def
get_date
():
def
get_date
():
...
...
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