Commit 491fa8ee authored by 高雅喆's avatar 高雅喆

增加画像更新的统计日志

parent dfd16540
......@@ -187,7 +187,23 @@ if __name__ == '__main__':
cmd_coincide_n = int(sys.argv[2])
result = get_2_tags_coincide_rate(all_device_order_tags2, all_device_portrait_result, cmd_portrait_top_n,
cmd_coincide_n)
print("统计日期:", my_yesterday)
# 统计画像更新的耗时和更新的设备数
sql = "select count(*) from user_service_portrait_tags where stat_date='{my_today}'".format(my_today=my_today)
portrait_device_count = get_data_by_mysql('172.16.40.158', 4000, 'root', '3SYz54LS9#^9sBvC', 'jerry_test', sql)
with open("/home/gmuser/gyz/log/dist_portrait.log", 'r') as f:
lines = f.readlines()
start_datetime_str = lines[0][:19]
end_datetime_str = lines[-1][:19]
start_datetime = datetime.datetime.strptime(start_datetime_str, '%Y-%m-%d %H:%M:%S')
end_datetime = datetime.datetime.strptime(end_datetime_str, '%Y-%m-%d %H:%M:%S')
time_consuming = (end_datetime - start_datetime).seconds / 60
print("画像更新统计日期:", my_today)
print("画像更新耗时:{time_consuming}分钟".format(time_consuming=time_consuming))
print("画像更新的设备数:", portrait_device_count[0]["count(*)"])
print("-"*66)
print("画像匹配度统计日期:", my_yesterday)
print("画像的前n个tag:", cmd_portrait_top_n)
print("重合个数:", cmd_coincide_n)
print("下单人数:", result["device_count"])
......@@ -195,5 +211,6 @@ if __name__ == '__main__':
print("匹配度:", result["coincide_rate"])
print("比对不上的有画像的人数:", result["not_coincide_have_portrait_count"])
print("比对不上的无画像的人数:", result["not_coincide_no_portrait_count"])
print("="*100)
except Exception as e:
print(e)
\ No newline at end of file
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