|
@@ -367,15 +367,24 @@ def video_homepage_recommend(mid, uid, size, app_type, algo_type, client_info, a
|
|
|
|
|
|
else:
|
|
|
|
|
|
- if ab_exp_info is None:
|
|
|
+ if not ab_exp_info:
|
|
|
size = size
|
|
|
top_K = config_.K
|
|
|
flow_pool_P = config_.P
|
|
|
else:
|
|
|
- exp_item_id_list = [item.get('expItemId') for item in ab_exp_info]
|
|
|
- if config_.EXP_ITEM_ID['rec_size'] in exp_item_id_list:
|
|
|
- config_value = ab_exp_info[exp_item_id_list.index(config_.EXP_ITEM_ID['rec_size'])].get('configValue',
|
|
|
- None)
|
|
|
+ ab_exp_code_list = []
|
|
|
+ config_value_dict = {}
|
|
|
+ for _, item in ab_exp_info.items():
|
|
|
+ if not item:
|
|
|
+ continue
|
|
|
+ for ab_item in item:
|
|
|
+ ab_exp_code = ab_item.get('abExpCode', None)
|
|
|
+ if not ab_exp_code:
|
|
|
+ continue
|
|
|
+ ab_exp_code_list.append(ab_exp_code)
|
|
|
+ config_value_dict[ab_exp_code] = ab_item.get('configValue', None)
|
|
|
+ if config_.AB_EXP_CODE['rec_size'] in ab_exp_code_list:
|
|
|
+ config_value = config_value_dict.get(config_.AB_EXP_CODE['rec_size'], None)
|
|
|
if config_value:
|
|
|
config_value = eval(str(config_value))
|
|
|
else:
|
|
@@ -415,15 +424,25 @@ def video_relevant_recommend(video_id, mid, uid, size, app_type, ab_exp_info):
|
|
|
:param ab_exp_info: ab实验分组参数 [{"expItemId":1, "configValue":{"size":4, "K":3, ...}}, ...]
|
|
|
:return: videos type-list
|
|
|
"""
|
|
|
-
|
|
|
- if ab_exp_info is None:
|
|
|
+ # 解析ab实验参数
|
|
|
+ if not ab_exp_info:
|
|
|
size = size
|
|
|
top_K = config_.K
|
|
|
flow_pool_P = config_.P
|
|
|
else:
|
|
|
- exp_item_id_list = [item.get('expItemId') for item in ab_exp_info]
|
|
|
- if config_.EXP_ITEM_ID['rec_size'] in exp_item_id_list:
|
|
|
- config_value = ab_exp_info[exp_item_id_list.index(config_.EXP_ITEM_ID['rec_size'])].get('configValue', None)
|
|
|
+ ab_exp_code_list = []
|
|
|
+ config_value_dict = {}
|
|
|
+ for _, item in ab_exp_info.items():
|
|
|
+ if not item:
|
|
|
+ continue
|
|
|
+ for ab_item in item:
|
|
|
+ ab_exp_code = ab_item.get('abExpCode', None)
|
|
|
+ if not ab_exp_code:
|
|
|
+ continue
|
|
|
+ ab_exp_code_list.append(ab_exp_code)
|
|
|
+ config_value_dict[ab_exp_code] = ab_item.get('configValue', None)
|
|
|
+ if config_.AB_EXP_CODE['rec_size'] in ab_exp_code_list:
|
|
|
+ config_value = config_value_dict.get(config_.AB_EXP_CODE['rec_size'], None)
|
|
|
if config_value:
|
|
|
config_value = eval(str(config_value))
|
|
|
else:
|