소스 검색

feat:添加脚本

zhaohaipeng 2 주 전
부모
커밋
f225903eed
2개의 변경된 파일45개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      script/aigc_crawler_plan_clear_filters.py
  2. 44 0
      script/apollo_main.py

+ 1 - 1
script/aigc_crawler_plan_clear_filters.py

@@ -30,7 +30,7 @@ def _main():
         update_data['accountFilters'] = []
         update_data['contentFilters'] = []
         update_data['frequencyType'] = 2
-        print(aigc_client.crawler_plan_save(update_data))
+        # print(aigc_client.crawler_plan_save(update_data))
 
 
 if __name__ == '__main__':

+ 44 - 0
script/apollo_main.py

@@ -0,0 +1,44 @@
+import json
+
+from client.ApolloClient import ApolloClient
+
+client = ApolloClient("http://apolloconfig-internal.piaoquantv.com")
+
+
+def main():
+    config_str = client.get_value(
+        app_id="crawler-scheduler",
+        cluster="default",
+        namespace="application",
+        key="hot.video.keywords.provide.task.config"
+    )
+    new_config_json = {}
+
+    config_json = json.loads(config_str)
+    account_filters = config_json['accountFilterMap']
+    content_filters = config_json['contentFilterMap']
+    pre_filter_threshold = config_json['preFilterThreshold']
+    prompt_id = config_json['promptId']
+    model_value_config = config_json['modelValueConfig']
+    for merge_cate2 in config_json['mergeCate2PatternPlanIdMap']:
+        type_json = config_json['mergeCate2PatternPlanIdMap'][merge_cate2]
+        if merge_cate2 not in new_config_json:
+            new_config_json[merge_cate2] = {}
+
+        for produce_type in type_json:
+            produce_plan_ids = type_json[produce_type]
+
+            new_config_json[merge_cate2][produce_type] = {
+                "accountFilters": account_filters,
+                "contentFilters": content_filters,
+                "preFilterThreshold": pre_filter_threshold,
+                "promptId": prompt_id,
+                "modelValueConfig": model_value_config,
+                "producePlanIds": produce_plan_ids
+            }
+
+    print(json.dumps(new_config_json, indent=4, ensure_ascii=False))
+
+
+if __name__ == '__main__':
+    main()