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

update

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