Browse Source

add old video recall

liqian 3 years ago
parent
commit
0e4266ef89
2 changed files with 32 additions and 0 deletions
  1. 3 0
      config.py
  2. 29 0
      old_video_recall.py

+ 3 - 0
config.py

@@ -92,6 +92,9 @@ class BaseConfig(object):
         '19': 'predict_data_19.pickle'
     }
 
+    OLD_VIDEOS_PROJECT = ''
+    OLD_VIDEOS_TABLE = ''
+
     # 小程序离线ROV模型结果存放 redis key前缀,完整格式:com.weiqu.video.recall.hot.item.score.{date}
     RECALL_KEY_NAME_PREFIX = 'com.weiqu.video.recall.hot.item.score.'
     # 小程序小时级更新结果存放 redis key前缀,完整格式:com.weiqu.video.recall.item.score.h.{rule_key}.{date}.{h}

+ 29 - 0
old_video_recall.py

@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+# @ModuleName: old_video_recall
+# @Author: Liqian
+# @Time: 2022/4/25 下午3:33
+# @Software: PyCharm
+import pandas as pd
+from datetime import datetime
+from utils import get_data_from_odps
+from config import set_config
+from log import Log
+
+config_, env = set_config()
+log_ = Log()
+
+
+def get_old_videos():
+    """获取老旧视频"""
+    now_date = datetime.strftime(datetime.today(), '%Y%m%d')
+    log_.info(f"now_date = {now_date}")
+    project = config_.OLD_VIDEOS_PROJECT
+    table = config_.OLD_VIDEOS_TABLE
+    records = get_data_from_odps(project=project, table=table, date=now_date)
+    data = [{'videoid': record['videoid']} for record in records]
+    data_df = pd.DataFrame(data=data)
+    print(data_df)
+
+
+if __name__ == '__main__':
+    get_old_videos()