|  | @@ -624,29 +624,22 @@ def video_old_recommend(request_id, mid, uid, size, top_K, flow_pool_P, app_type
 | 
											
												
													
														|  |                  'flow_pool_recall': recall_result_list[2]
 |  |                  'flow_pool_recall': recall_result_list[2]
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |      # 3. 特征回流
 |  |      # 3. 特征回流
 | 
											
												
													
														|  | -    rec_recall_list = []
 |  | 
 | 
											
												
													
														|  | -    vidKeys = []
 |  | 
 | 
											
												
													
														|  | -    hour_vidKeys = []
 |  | 
 | 
											
												
													
														|  | -    pre_str = "v_ctr:"
 |  | 
 | 
											
												
													
														|  | -    pre_hour_str = "v_hour_ctr:"
 |  | 
 | 
											
												
													
														|  | -    rec_recall_item_list = []
 |  | 
 | 
											
												
													
														|  | -    for recall_item in data['rov_pool_recall']:
 |  | 
 | 
											
												
													
														|  | -        if len(recall_item) <= 0:
 |  | 
 | 
											
												
													
														|  | -            continue
 |  | 
 | 
											
												
													
														|  | -        vid = recall_item.get("videoId", 0)
 |  | 
 | 
											
												
													
														|  | -        rec_recall_list.append(vid)
 |  | 
 | 
											
												
													
														|  | -        vidKeys.append(pre_str + str(vid))
 |  | 
 | 
											
												
													
														|  | -        hour_vidKeys.append(pre_hour_str + str(vid))
 |  | 
 | 
											
												
													
														|  | -        rec_recall_item_list.append(recall_item)
 |  | 
 | 
											
												
													
														|  | -    redisObj = RedisHelper()
 |  | 
 | 
											
												
													
														|  | -    video_static_info = redisObj.get_batch_key(vidKeys)
 |  | 
 | 
											
												
													
														|  | -    video_hour_static_info = redisObj.get_batch_key(hour_vidKeys)
 |  | 
 | 
											
												
													
														|  | -    vid_day_fea_list = []
 |  | 
 | 
											
												
													
														|  | -    vid_hour_fea_list = []
 |  | 
 | 
											
												
													
														|  | -    if video_static_info:
 |  | 
 | 
											
												
													
														|  | -        vid_day_fea_list = video_static_info
 |  | 
 | 
											
												
													
														|  | -    if video_hour_static_info:
 |  | 
 | 
											
												
													
														|  | -        vid_hour_fea_list = video_hour_static_info
 |  | 
 | 
											
												
													
														|  | 
 |  | +    #
 | 
											
												
													
														|  | 
 |  | +    # for recall_item in data['rov_pool_recall']:
 | 
											
												
													
														|  | 
 |  | +    #     if len(recall_item) <= 0:
 | 
											
												
													
														|  | 
 |  | +    #         continue
 | 
											
												
													
														|  | 
 |  | +    #     vid = recall_item.get("videoId", 0)
 | 
											
												
													
														|  | 
 |  | +    #     rec_recall_list.append(vid)
 | 
											
												
													
														|  | 
 |  | +    #     rec_recall_item_list.append(recall_item)
 | 
											
												
													
														|  | 
 |  | +    # redisObj = RedisHelper()
 | 
											
												
													
														|  | 
 |  | +    # video_static_info = redisObj.get_batch_key(vidKeys)
 | 
											
												
													
														|  | 
 |  | +    # video_hour_static_info = redisObj.get_batch_key(hour_vidKeys)
 | 
											
												
													
														|  | 
 |  | +    # vid_day_fea_list = []
 | 
											
												
													
														|  | 
 |  | +    # vid_hour_fea_list = []
 | 
											
												
													
														|  | 
 |  | +    # if video_static_info:
 | 
											
												
													
														|  | 
 |  | +    #     vid_day_fea_list = video_static_info
 | 
											
												
													
														|  | 
 |  | +    # if video_hour_static_info:
 | 
											
												
													
														|  | 
 |  | +    #     vid_hour_fea_list = video_hour_static_info
 | 
											
												
													
														|  |      if env_dict:
 |  |      if env_dict:
 | 
											
												
													
														|  |          province_code = client_info.get('provinceCode', -1)
 |  |          province_code = client_info.get('provinceCode', -1)
 | 
											
												
													
														|  |          if province_code and province_code == "":
 |  |          if province_code and province_code == "":
 | 
											
										
											
												
													
														|  | @@ -657,21 +650,39 @@ def video_old_recommend(request_id, mid, uid, size, top_K, flow_pool_P, app_type
 | 
											
												
													
														|  |          env_dict['mid'] = mid
 |  |          env_dict['mid'] = mid
 | 
											
												
													
														|  |          env_dict['province_code'] = province_code
 |  |          env_dict['province_code'] = province_code
 | 
											
												
													
														|  |          env_dict['city_code'] = city_code
 |  |          env_dict['city_code'] = city_code
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -        env_dict['recall_list'] = rec_recall_list
 |  | 
 | 
											
												
													
														|  | -        env_dict['vid_day_fea_list'] = vid_day_fea_list
 |  | 
 | 
											
												
													
														|  | -        env_dict['vid_hour_fea_list'] = vid_hour_fea_list
 |  | 
 | 
											
												
													
														|  |          env_json = env_dict
 |  |          env_json = env_dict
 | 
											
												
													
														|  |      #4.
 |  |      #4.
 | 
											
												
													
														|  | -    rank_result, flow_num  = video_new_rank2(data=data, size=size, top_K=top_K, flow_pool_P=float(flow_pool_P), ab_code=ab_code, mid=mid, exp_config=exp_config, env_dict=env_dict, rec_recall_item_list=rec_recall_item_list)
 |  | 
 | 
											
												
													
														|  | -    #print(rank_result)
 |  | 
 | 
											
												
													
														|  | 
 |  | +    rank_result, flow_num  = video_new_rank2(data=data, size=size, top_K=top_K, flow_pool_P=float(flow_pool_P), ab_code=ab_code, mid=mid, exp_config=exp_config, env_dict=env_dict)
 | 
											
												
													
														|  | 
 |  | +    print(rank_result)
 | 
											
												
													
														|  |      if rank_result:
 |  |      if rank_result:
 | 
											
												
													
														|  |          result['rank_num'] = len(rank_result)
 |  |          result['rank_num'] = len(rank_result)
 | 
											
												
													
														|  | 
 |  | +        day_vidKeys = []
 | 
											
												
													
														|  | 
 |  | +        hour_vidKeys = []
 | 
											
												
													
														|  | 
 |  | +        rec_recall_list = []
 | 
											
												
													
														|  | 
 |  | +        pre_str = "v_ctr:"
 | 
											
												
													
														|  | 
 |  | +        pre_hour_str = "v_hour_ctr:"
 | 
											
												
													
														|  | 
 |  | +        if env_dict and len(rank_result)>0:
 | 
											
												
													
														|  | 
 |  | +            for rec_item in rank_result:
 | 
											
												
													
														|  | 
 |  | +                vid = rec_item
 | 
											
												
													
														|  | 
 |  | +                rec_recall_list.append(vid)
 | 
											
												
													
														|  | 
 |  | +                day_vidKeys.append(pre_str+str(vid))
 | 
											
												
													
														|  | 
 |  | +                hour_vidKeys.append(pre_hour_str+str(vid))
 | 
											
												
													
														|  | 
 |  | +            redisObj = RedisHelper()
 | 
											
												
													
														|  | 
 |  | +            video_static_info = redisObj.get_batch_key(day_vidKeys)
 | 
											
												
													
														|  | 
 |  | +            video_hour_static_info = redisObj.get_batch_key(hour_vidKeys)
 | 
											
												
													
														|  | 
 |  | +            vid_day_fea_list = []
 | 
											
												
													
														|  | 
 |  | +            vid_hour_fea_list = []
 | 
											
												
													
														|  | 
 |  | +            if video_static_info:
 | 
											
												
													
														|  | 
 |  | +                 vid_day_fea_list = video_static_info
 | 
											
												
													
														|  | 
 |  | +            if video_hour_static_info:
 | 
											
												
													
														|  | 
 |  | +                 vid_hour_fea_list = video_hour_static_info
 | 
											
												
													
														|  | 
 |  | +            env_dict['recall_list'] = rec_recall_list
 | 
											
												
													
														|  | 
 |  | +            env_dict['vid_day_fea_list'] = vid_day_fea_list
 | 
											
												
													
														|  | 
 |  | +            env_dict['vid_hour_fea_list'] = vid_hour_fea_list
 | 
											
												
													
														|  | 
 |  | +            env_json = env_dict
 | 
											
												
													
														|  |      result['rankResult'] = rank_result
 |  |      result['rankResult'] = rank_result
 | 
											
												
													
														|  |      result['flow_num'] = flow_num
 |  |      result['flow_num'] = flow_num
 | 
											
												
													
														|  |      result['rankTime'] = (time.time() - start_rank) * 1000
 |  |      result['rankTime'] = (time.time() - start_rank) * 1000
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |      return result, env_json
 |  |      return result, env_json
 | 
											
												
													
														|  |      # return rank_result, last_rov_recall_key
 |  |      # return rank_result, last_rov_recall_key
 | 
											
												
													
														|  |  
 |  |  
 |