liqian 2 years ago
parent
commit
54fe02cadf
2 changed files with 31 additions and 31 deletions
  1. 30 30
      recommend.py
  2. 1 1
      video_rank.py

+ 30 - 30
recommend.py

@@ -300,36 +300,36 @@ def video_recommend(request_id, mid, uid, size, top_K, flow_pool_P, app_type, al
     result['rankResult'] = rank_result
     result['rankTime'] = (time.time() - start_rank) * 1000
 
-    if not rank_result:
-        # 兜底策略
-        # log_.info('====== bottom strategy')
-        start_bottom = time.time()
-        rank_result = bottom_strategy2(
-            size=size, app_type=app_type, mid=mid, uid=uid, ab_code=ab_code, client_info=client_info, params=params
-        )
-
-        # if ab_code == config_.AB_CODE['region_rank_by_h'].get('abtest_130'):
-        #     rank_result = bottom_strategy2(
-        #         size=size, app_type=app_type, mid=mid, uid=uid, ab_code=ab_code, client_info=client_info, params=params
-        #     )
-        # else:
-        #     rank_result = bottom_strategy(
-        #         request_id=request_id, size=size, app_type=app_type, ab_code=ab_code, params=params
-        #     )
-
-        # log_.info({
-        #     'logTimestamp': int(time.time() * 1000),
-        #     'request_id': request_id,
-        #     'mid': mid,
-        #     'uid': uid,
-        #     'operation': 'bottom',
-        #     'bottom_result': rank_result,
-        #     'executeTime': (time.time() - start_bottom) * 1000
-        # })
-        result['bottomResult'] = rank_result
-        result['bottomTime'] = (time.time() - start_bottom) * 1000
-
-    result['rankResult'] = rank_result
+    # if not rank_result:
+    #     # 兜底策略
+    #     # log_.info('====== bottom strategy')
+    #     start_bottom = time.time()
+    #     rank_result = bottom_strategy2(
+    #         size=size, app_type=app_type, mid=mid, uid=uid, ab_code=ab_code, client_info=client_info, params=params
+    #     )
+    #
+    #     # if ab_code == config_.AB_CODE['region_rank_by_h'].get('abtest_130'):
+    #     #     rank_result = bottom_strategy2(
+    #     #         size=size, app_type=app_type, mid=mid, uid=uid, ab_code=ab_code, client_info=client_info, params=params
+    #     #     )
+    #     # else:
+    #     #     rank_result = bottom_strategy(
+    #     #         request_id=request_id, size=size, app_type=app_type, ab_code=ab_code, params=params
+    #     #     )
+    #
+    #     # log_.info({
+    #     #     'logTimestamp': int(time.time() * 1000),
+    #     #     'request_id': request_id,
+    #     #     'mid': mid,
+    #     #     'uid': uid,
+    #     #     'operation': 'bottom',
+    #     #     'bottom_result': rank_result,
+    #     #     'executeTime': (time.time() - start_bottom) * 1000
+    #     # })
+    #     result['bottomResult'] = rank_result
+    #     result['bottomTime'] = (time.time() - start_bottom) * 1000
+    #
+    # result['rankResult'] = rank_result
 
     return result
     # return rank_result, last_rov_recall_key

+ 1 - 1
video_rank.py

@@ -21,7 +21,7 @@ def video_rank(data, size, top_K, flow_pool_P):
     :return: rank_result
     """
     if not data['rov_pool_recall'] and not data['flow_pool_recall']:
-        return None
+        return []
     # 将各路召回的视频按照score从大到小排序
     # 最惊奇相关推荐相似视频
     # relevant_recall = [item for item in data['rov_pool_recall']