liqian 3 years ago
parent
commit
954b7c68f6
2 changed files with 18 additions and 16 deletions
  1. 4 2
      config.py
  2. 14 14
      recommend.py

+ 4 - 2
config.py

@@ -276,7 +276,8 @@ class PreProductionConfig(BaseConfig):
 
     # AB实验配置
     AB_EXP_CODE = {
-        'rec_size': '-1',
+        'rec_size_home': '003',
+        'rec_size_relevant': '004'
     }
 
 
@@ -330,7 +331,8 @@ class ProductionConfig(BaseConfig):
 
     # AB实验配置
     AB_EXP_CODE = {
-        'rec_size': '-1',
+        'rec_size_home': '003',
+        'rec_size_relevant': '004'
     }
 
 

+ 14 - 14
recommend.py

@@ -358,11 +358,11 @@ def video_homepage_recommend(mid, uid, size, app_type, algo_type, client_info, a
                                                            algo_type=algo_type, client_info=client_info,
                                                            expire_time=12 * 3600)
         # ab-test
-        result = ab_test_op(rank_result=rank_result,
-                            ab_code_list=[config_.AB_CODE['position_insert']],
-                            app_type=app_type, mid=mid, uid=uid)
+        # result = ab_test_op(rank_result=rank_result,
+        #                     ab_code_list=[config_.AB_CODE['position_insert']],
+        #                     app_type=app_type, mid=mid, uid=uid)
         # redis数据刷新
-        update_redis_data(result=result, app_type=app_type, mid=mid, last_rov_recall_key=last_rov_recall_key,
+        update_redis_data(result=rank_result, app_type=app_type, mid=mid, last_rov_recall_key=last_rov_recall_key,
                           top_K=top_K, expire_time=12 * 3600)
 
     else:
@@ -403,14 +403,14 @@ def video_homepage_recommend(mid, uid, size, app_type, algo_type, client_info, a
                                                            size=size, top_K=top_K, flow_pool_P=flow_pool_P,
                                                            algo_type=algo_type, client_info=client_info)
         # ab-test
-        result = ab_test_op(rank_result=rank_result,
-                            ab_code_list=[config_.AB_CODE['position_insert']],
-                            app_type=app_type, mid=mid, uid=uid)
+        # result = ab_test_op(rank_result=rank_result,
+        #                     ab_code_list=[config_.AB_CODE['position_insert']],
+        #                     app_type=app_type, mid=mid, uid=uid)
         # redis数据刷新
-        update_redis_data(result=result, app_type=app_type, mid=mid, last_rov_recall_key=last_rov_recall_key,
+        update_redis_data(result=rank_result, app_type=app_type, mid=mid, last_rov_recall_key=last_rov_recall_key,
                           top_K=top_K)
 
-    return result
+    return rank_result
 
 
 def video_relevant_recommend(video_id, mid, uid, size, app_type, ab_exp_info):
@@ -461,14 +461,14 @@ def video_relevant_recommend(video_id, mid, uid, size, app_type, ab_exp_info):
                                                        size=size, top_K=top_K, flow_pool_P=flow_pool_P,
                                                        algo_type='', client_info=None)
     # ab-test
-    result = ab_test_op(rank_result=rank_result,
-                        ab_code_list=[config_.AB_CODE['position_insert'], config_.AB_CODE['relevant_video_op']],
-                        app_type=app_type, mid=mid, uid=uid, head_vid=video_id, size=size)
+    # result = ab_test_op(rank_result=rank_result,
+    #                     ab_code_list=[config_.AB_CODE['position_insert'], config_.AB_CODE['relevant_video_op']],
+    #                     app_type=app_type, mid=mid, uid=uid, head_vid=video_id, size=size)
     # redis数据刷新
-    update_redis_data(result=result, app_type=app_type, mid=mid, last_rov_recall_key=last_rov_recall_key,
+    update_redis_data(result=rank_result, app_type=app_type, mid=mid, last_rov_recall_key=last_rov_recall_key,
                       top_K=top_K)
 
-    return result
+    return rank_result
 
 
 if __name__ == '__main__':