Commit 09df0ed2 authored by 高雅喆's avatar 高雅喆

增加订单日期的参数,参数日志打印

parent 059559f1
......@@ -183,6 +183,8 @@ def get_2_tags_coincide_rate(device_order_tags, device_portrait_result, portrait
if __name__ == '__main__':
try:
parser = argparse.ArgumentParser(description='画像匹配度的统计')
my_yesterday = str(datetime.date.today() - datetime.timedelta(days=1))
parser.add_argument("-o", "--order_date", type=str, dest="order_date", default=my_yesterday, help="统计的下单日期")
parser.add_argument("-log1", "--log1_file", type=str, dest="portrait_stat_log_path",
default="portrait_stat.log", help="画像统计的日志地址")
parser.add_argument("-log2", "--log2_file", type=str, dest="debug_portrait_stat_log_path",
......@@ -195,6 +197,8 @@ if __name__ == '__main__':
help="天数差归一化的区间")
parser.add_argument("-d", "--decay_days", type=int, dest="decay_days", default=180, help="分数衰减的天数")
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))
portrait_stat_log_path = args.portrait_stat_log_path
debug_portrait_stat_log_path = args.debug_portrait_stat_log_path
cmd_portrait_top_n = args.portrait_top_n
......@@ -206,7 +210,6 @@ if __name__ == '__main__':
LOG_DIR = "/home/gmuser/gyz/log/"
my_today = str(datetime.date.today())
my_yesterday = str(datetime.date.today() - datetime.timedelta(days=1))
setup_logger("log1", LOG_DIR + portrait_stat_log_path)
setup_logger("log2", LOG_DIR + debug_portrait_stat_log_path)
......@@ -248,15 +251,15 @@ if __name__ == '__main__':
LEFT JOIN api_servicetag e ON d.service_id = e.service_id
LEFT JOIN api_tag f ON e.tag_id = f.id
WHERE d.status=1
AND d.pay_time>'{my_yesterday}'
AND d.pay_time<'{today}'
AND d.pay_time>'{order_date}'
AND d.pay_time<'{order_date_tomorrow}'
AND f.tag_type+0 <'4'+0) tmp2
GROUP BY user_id) a
LEFT JOIN statistic_device_user b ON a.user_id = b.user_id) tmp
GROUP BY tmp.user_id) tmp1
LEFT JOIN statistic_device c ON tmp1.device_id_id = c.id
WHERE c.device_id IS NOT NULL
""".format(my_yesterday=my_yesterday, today=my_today)
""".format(order_date=order_date, order_date_tomorrow=order_date_tomorrow)
mysql_results = get_data_by_mysql('172.16.30.141', 3306, 'work', 'BJQaT9VzDcuPBqkd', 'zhengxing',
sql_order_device_info_yesterday)
device_ids_lst = [(i["device_id"], int(i["pay_time"])) for i in mysql_results]
......@@ -331,11 +334,12 @@ if __name__ == '__main__':
time_consuming = (end_datetime - start_datetime).seconds / 60
log1.info({"画像信息统计日期": my_today})
log1.info({"参数信息": args})
log1.info({"版本": "英赫版" if version == 1 else "翔宇版"})
log1.info({"画像更新耗时(分钟)": time_consuming})
log1.info({"画像更新的设备数": portrait_device_count[0]["count(*)"]})
log1.info("")
log1.info({"统计画像匹配度所用数据的日期": my_yesterday})
log1.info({"统计画像匹配度所用数据的日期": order_date})
log1.info({"统计画像的选取前n个tag": cmd_portrait_top_n})
log1.info({"重合个数": cmd_coincide_n})
log1.info({"下单人数": result["device_count"]})
......
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