Explorar o código

add update_common_words_task.sh & add config

liqian %!s(int64=2) %!d(string=hai) anos
pai
achega
747f2f4ccc
Modificáronse 3 ficheiros con 18 adicións e 5 borrados
  1. 7 4
      config.py
  2. 5 1
      update_common_words.py
  3. 6 0
      update_common_words_task.sh

+ 7 - 4
config.py

@@ -14,15 +14,18 @@ class BaseConfig(object):
             'spreadsheet_token': 'shtcnU8JgPeMq5wAuKejptwtLof',
             'sheet_id': 'wnB24K'
         },
-        '微信指数搜索常用词样本-站内标题分词': {
+        '微信指数自动化搜索-站内标题分词结果': {
             'spreadsheet_token': 'shtcnHxCj6dZBYMuK1Q3tIJVlqg',
             'sheet_id': 'nCudsM'
         },
-        '微信指数搜索常用词样本-人工标注站内高频关键词': {
+        '微信指数自动化搜索-人工标注站内高频关键词': {
             'spreadsheet_token': 'shtcnHxCj6dZBYMuK1Q3tIJVlqg',
             'sheet_id': 'n9Jo4j'
-        }
-
+        },
+        '微信指数自动化搜索-每日关键词': {
+            'spreadsheet_token': 'shtcnHxCj6dZBYMuK1Q3tIJVlqg',
+            'sheet_id': 'b74YMQ'
+        },
     }
     # mysql数据表
     MYSQL_TABLES = {

+ 5 - 1
update_common_words.py

@@ -1,3 +1,5 @@
+import sys
+
 from utils.feishu import FeiShuHelper
 from db_helper import MysqlHelper
 from config import set_config
@@ -43,4 +45,6 @@ def add_words2mysql(sheet_name, source):
 
 
 if __name__ == '__main__':
-    add_words2mysql(sheet_name='微信指数搜索常用词样本-人工标注站内高频关键词', source=1)
+    # add_words2mysql(sheet_name='微信指数搜索常用词样本-人工标注站内高频关键词', source=1)
+    sheet_name, source = sys.argv[1], sys.argv[2]
+    add_words2mysql(sheet_name, source)

+ 6 - 0
update_common_words_task.sh

@@ -0,0 +1,6 @@
+source /etc/profile
+echo $HOT_WORDS_ENV
+if [[ $HOT_WORDS_ENV == 'test' ]]; then
+    cd /data2/hot-words && /root/anaconda3/bin/python /data2/hot-words/update_common_words.py '微信指数自动化搜索-每日关键词' 1
+elif [[ $HOT_WORDS_ENV == 'pro' ]]; then
+    cd /data/hot-words && /root/anaconda3/bin/python /data2/hot-words/update_common_words.py '微信指数自动化搜索-每日关键词' 1