liqian 3 years ago
parent
commit
0e5e2d615e
1 changed files with 7 additions and 5 deletions
  1. 7 5
      video_recall.py

+ 7 - 5
video_recall.py

@@ -136,18 +136,20 @@ class PoolRecall(object):
                 #check_result, error_flag = self.check_video_counts(video_ids=filtered_result, flow_pool_mapping=video_mapping)
 
                 for item in check_result:
-                    if item[0] not in flow_pool_recall_videos:
+                    video_id = int(item[0])
+                    flow_pool = item[1]
+                    if video_id not in flow_pool_recall_videos:
                         # 取其中一个 flow_pool 作为召回结果
                         # 添加视频源参数 pushFrom, abCode
                         flow_pool_recall_result.append(
-                            {'videoId': int(item[0]), 'flowPool': item[1],
-                             'rovScore': video_score[item[0]], 'pushFrom': 'flow_pool', 'abCode': self.ab_code}
+                            {'videoId': video_id, 'flowPool': flow_pool,
+                             'rovScore': video_score[video_id], 'pushFrom': 'flow_pool', 'abCode': self.ab_code}
                         )
                         # flow_pool_recall_result.append(
                         #     {'videoId': item[0], 'flowPool': item[1], 'distributeCount': item[2],
                         #      'rovScore': video_score[item[0]], 'pushFrom': 'flow_pool', 'abCode': self.ab_code}
                         # )
-                        flow_pool_recall_videos.append(item[0])
+                        flow_pool_recall_videos.append(video_id)
                 et_check = time.time()
                 log_.info('check result: result = {}, execute time = {}ms'.format(
                     check_result, (et_check - st_check) * 1000))
@@ -187,7 +189,7 @@ class PoolRecall(object):
                     value = '{}-{}'.format(video_id, flow_pool)
                     self.redis_helper.remove_value_from_zset(key_name=flow_pool_key, value=value)
         # 本次视频都有本地记录
-        if len(video_ids) == 0:
+        if len(videos) == 0:
             error_flag = False
             return check_result, error_flag