Commit 8dd00094 authored by 高雅喆's avatar 高雅喆

update

parent 5f59177f
......@@ -307,6 +307,7 @@ if __name__ == '__main__':
help="天数差归一化的区间")
parser.add_argument("-d", "--decay_days", type=int, dest="decay_days", default=180, help="分数衰减的天数")
parser.add_argument("-a", "--action_type", dest="action_type", nargs='+', help="计算匹配度的行为")
parser.add_argument("-s", "--save_tidb", type=int, dest="save_tidb", default=1, help="统计结果是否存tidb")
args = parser.parse_args()
order_date = args.order_date
order_date_tomorrow = str(datetime.datetime.strptime(order_date, '%Y-%m-%d') + datetime.timedelta(days=1))
......@@ -319,6 +320,7 @@ if __name__ == '__main__':
normalization_size = args.normalization_size
decay_days = args.decay_days
action_type = args.action_type
save_tidb = args.save_tidb
LOG_DIR = "/home/gmuser/gyz/log/"
my_today = str(datetime.date.today())
......@@ -435,12 +437,13 @@ if __name__ == '__main__':
log1.info("="*66)
# 统计数据进tidb
tplt = "insert into user_portrait_tags_evalution values(null,'{0}','{1}','{2}',{3},{4},{5},{6},{7})"
stat_date = order_date.replace("-", "")
insert_sql = tplt.format(stat_date, "英赫版" if version == 1 else "翔宇版", action_type_detail,
result["device_count"], result["coincide_count"], result["coincide_rate"],
result["not_coincide_have_portrait_count"],
result["not_coincide_no_portrait_count"])
write_data_by_mysql('172.16.40.158', 4000, 'root', '3SYz54LS9#^9sBvC', 'jerry_test', insert_sql)
if save_tidb:
tplt = "insert into user_portrait_tags_evalution values(null,'{0}','{1}','{2}',{3},{4},{5},{6},{7})"
stat_date = order_date.replace("-", "")
insert_sql = tplt.format(stat_date, "英赫版" if version == 1 else "翔宇版", action_type_detail,
result["device_count"], result["coincide_count"], result["coincide_rate"],
result["not_coincide_have_portrait_count"],
result["not_coincide_no_portrait_count"])
write_data_by_mysql('172.16.40.158', 4000, 'root', '3SYz54LS9#^9sBvC', 'jerry_test', insert_sql)
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