|
@@ -1,6 +1,8 @@
|
|
|
import json
|
|
import json
|
|
|
from typing import Optional
|
|
from typing import Optional
|
|
|
|
|
+
|
|
|
from app.core.config import GlobalConfigSettings
|
|
from app.core.config import GlobalConfigSettings
|
|
|
|
|
+from app.core.config.settings import TaskChineseNameConfig
|
|
|
|
|
|
|
|
|
|
|
|
|
class TaskConst:
|
|
class TaskConst:
|
|
@@ -15,7 +17,7 @@ class TaskConst:
|
|
|
|
|
|
|
|
|
|
|
|
|
class TaskManagerUtils(TaskConst):
|
|
class TaskManagerUtils(TaskConst):
|
|
|
- def __init__(self, config: GlobalConfigSettings):
|
|
|
|
|
|
|
+ def __init__(self, config: TaskChineseNameConfig):
|
|
|
self.config = config
|
|
self.config = config
|
|
|
|
|
|
|
|
def get_task_chinese_name(self, data):
|
|
def get_task_chinese_name(self, data):
|
|
@@ -23,7 +25,7 @@ class TaskManagerUtils(TaskConst):
|
|
|
通过输入任务详情信息获取任务名称
|
|
通过输入任务详情信息获取任务名称
|
|
|
"""
|
|
"""
|
|
|
task_name = data["task_name"]
|
|
task_name = data["task_name"]
|
|
|
- task_name_chinese = self.config.task_chinese_name.get(task_name, task_name)
|
|
|
|
|
|
|
+ task_name_chinese = self.config.name_map.get(task_name, task_name)
|
|
|
|
|
|
|
|
# account_method
|
|
# account_method
|
|
|
if task_name == "crawler_gzh_articles":
|
|
if task_name == "crawler_gzh_articles":
|
|
@@ -86,7 +88,7 @@ class TaskManagerUtils(TaskConst):
|
|
|
|
|
|
|
|
class TaskManager(TaskManagerUtils):
|
|
class TaskManager(TaskManagerUtils):
|
|
|
def __init__(self, pool, data, config: GlobalConfigSettings):
|
|
def __init__(self, pool, data, config: GlobalConfigSettings):
|
|
|
- super().__init__(config)
|
|
|
|
|
|
|
+ super().__init__(config.task_chinese_name)
|
|
|
self.pool = pool
|
|
self.pool = pool
|
|
|
self.data = data
|
|
self.data = data
|
|
|
|
|
|