调整了pipeline执行顺序。现在按domain顺序读取数据源数据,防止前面domain的更新影响后面domain.
将target_project_ids替换为更通用的data_id_filter
This commit is contained in:
@@ -27,17 +27,8 @@ class PreparationApiHandler(BaseApiHandler):
|
||||
self._node_type = "preparation"
|
||||
self._node_class = PreparationSyncNode
|
||||
self._schema = PreparationDetail
|
||||
self._filter_project_id = None
|
||||
self.update_schemas = [PostPreparation]
|
||||
|
||||
def set_filter_project_id(self, project_id: str | List[str]):
|
||||
"""设置要加载的项目ID过滤列表"""
|
||||
self._filter_project_id = project_id
|
||||
|
||||
def set_target_project_ids(self, target_project_ids: List[str]) -> None:
|
||||
"""设置目标项目ID列表"""
|
||||
self.set_filter_project_id(target_project_ids)
|
||||
|
||||
async def load(self) -> List[SyncNode]:
|
||||
"""从 API 加载里程碑数据(需要项目上下文)"""
|
||||
from ..project.api_handler import ProjectApiHandler
|
||||
|
||||
@@ -71,26 +71,11 @@ class ProjectApiHandler(BaseApiHandler):
|
||||
# 类级别缓存:存储 all_info 数据
|
||||
_all_info_cache: Dict[str, Dict[str, Any]] = {}
|
||||
|
||||
def __init__(self, filter_project_id: str | List[str] | None = None):
|
||||
"""
|
||||
初始化 Project Handler
|
||||
|
||||
Args:
|
||||
filter_project_id: 指定只加载的项目ID列表(可选,用于多项目测试)
|
||||
"""
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self._node_type = "project"
|
||||
self._node_class = ProjectSyncNode
|
||||
self._schema = ProjectResponseBase
|
||||
if filter_project_id is None:
|
||||
self._filter_project_id = None
|
||||
elif isinstance(filter_project_id, str):
|
||||
self._filter_project_id = [filter_project_id]
|
||||
else:
|
||||
self._filter_project_id = filter_project_id # 保存过滤条件
|
||||
|
||||
def set_target_project_ids(self, target_project_ids: List[str]) -> None:
|
||||
self._filter_project_id = list(target_project_ids) if target_project_ids else None
|
||||
|
||||
@classmethod
|
||||
async def get_all_info(cls, client, project_id: str) -> Dict[str, Any]:
|
||||
@@ -127,15 +112,12 @@ class ProjectApiHandler(BaseApiHandler):
|
||||
|
||||
nodes = []
|
||||
|
||||
# 确定要加载的项目ID列表:参数 > 构造函数配置
|
||||
target_project_ids = self._filter_project_id or []
|
||||
if isinstance(target_project_ids, str):
|
||||
target_project_ids = [target_project_ids]
|
||||
project_id_filter = self.get_data_id_filter()
|
||||
|
||||
if target_project_ids:
|
||||
if project_id_filter:
|
||||
# 只加载指定项目列表
|
||||
projects : List[ProjectResponseBase]= []
|
||||
for project_id in target_project_ids:
|
||||
for project_id in project_id_filter:
|
||||
project_response = await api_get_project(self.api_client, project_id)
|
||||
projects.append(project_response)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user