Browse Source

多样性

zhangbo 1 year ago
parent
commit
fec4220911

+ 24 - 1
alg_recsys_recall_shield_videos.py

@@ -5,6 +5,7 @@ from log import Log
 from utils import execute_sql_from_odps
 from db_helper import RedisHelper
 import datetime
+import json
 config_, _ = set_config()
 log_ = Log()
 redis_helper = RedisHelper()
@@ -41,8 +42,9 @@ def get_special_area_limit_videos():
 
 def main():
     log_.info("开始执行:" + datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
-    get_special_area_limit_videos()
 
+    # -----------------风险过滤需求------------------------------------------------
+    get_special_area_limit_videos()
     expire_time = 3600*24 * 30
 
     key = "RISK_SHIELD_FILTER_RULE_V1_JSON"
@@ -66,6 +68,27 @@ def main():
     print('key:', key, type(key))
     print('value_get:', value_get, type(value_get))
 
+
+
+    # -----------------多样性需求的过滤------------------------------------------------
+    expire_time = 3600 * 24 * 30
+
+    key = "TAGS_FILTER_FLAG_BOOL"
+    value = "True"
+    redis_helper.set_data_to_redis(key, value, expire_time)
+    value_get = redis_helper.get_data_from_redis(key_name=key)
+    print('key:', key, type(key))
+    print('value_get:', value_get, type(value_get))
+
+    key = "TAGS_FILTER_RULE_V1_JSON"
+    with open('alg_recsys_recall_tags_videos.json', 'r') as f:
+        json_read = json.load(f)
+        value = json.dump(json_read)
+    redis_helper.set_data_to_redis(key, value, expire_time)
+    value_get = redis_helper.get_data_from_redis(key_name=key)
+    print('key:', key, type(key))
+    print('value_get:', value_get, type(value_get))
+
     log_.info("完成执行:" + datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
 
 if __name__ == '__main__':

+ 18 - 0
alg_recsys_recall_tags_videos.json

@@ -0,0 +1,18 @@
+{
+  "早上好": {
+    "start": 0,
+    "end": 9
+  },
+  "中午好": {
+    "start": 11,
+    "end": 13
+  },
+  "冬至": {
+    "start": 0,
+    "end": 9
+  },
+  "祝福": {
+    "start": 0,
+    "end": 23
+  }
+}

+ 1 - 0
alg_recsys_recall_tags_videos.py

@@ -129,5 +129,6 @@ if __name__ == '__main__':
 
 
 
+
 # cd /root/zhangbo/rov-offline
 # python alg_recsys_recall_shield_videos.py

+ 1 - 1
config.py

@@ -2805,7 +2805,7 @@ def set_config():
     # 获取环境变量 ROV_OFFLINE_ENV
     env = os.environ.get('ROV_OFFLINE_ENV')
     # print("ROV_OFFLINE_ENV:{}".format(str(env)))
-    env = 'dev'
+    # env = 'dev'
     if env is None:
         # log_.error('ENV ERROR: is None!')
         return