Commit d3c016f3 authored by 张彦钊's avatar 张彦钊

add test

parent 5a935845
......@@ -291,12 +291,7 @@ def multi_proecess_update(device_id, city_id, data_set_cid,total_video_id):
if __name__ == "__main__":
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_device_city_list = []
......
......@@ -39,23 +39,57 @@ def get_local_device():
df.to_csv('/Users/mac/utils/test_device_city_id.csv', index=None)
print(1)
if __name__=="__main__":
LOCAL_HOST = 'rdsmaqevmuzj6jy.mysql.rds.aliyuncs.com'
db = pymysql.connect(host=LOCAL_HOST, port=3306, user='work', passwd='workwork', db='doris_test')
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'
def save_queue():
id = 334
device_id = '00CA20EB-2719-4518-85CC-60E765AC526F'
city_id = 'beijing'
cursor = db.cursor()
id_str = str(diary_id[0])
for i in range(1, len(diary_id)):
id_str = id_str + "," + str(diary_id[i])
queue_name_list = ["native_queue", "nearby_queue", "nation_queue", "megacity_queue"]
for i in queue_name_list:
sql = "select {} from device_diary_queue " \
"where device_id = '{}' and city_id = '{}';".format(i, device_id, city_id)
db = pymysql.connect(host='rm-m5e842126ng59jrv6.mysql.rds.aliyuncs.com', port=3306, user='doris',
passwd='o5gbA27hXHHm',
db='doris_prod')
cursor = db.cursor()
cursor.execute(sql)
result = cursor.fetchall()
df = pd.DataFrame(list(result))
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'],
sql = "insert into device_diary_queue values ('{}','{}','{}','{}','{}','{}',89)".format \
(device_id, city_id,id_str,id_str,id_str,id_str)
cursor.execute(sql)
db.commit()
db.close()
print("成功写入diary_id")
......
......@@ -10,6 +10,16 @@ from multiprocessing import Pool
import os
import signal
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():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment