pref(workflow): skip orphan node check in runtime execution

This commit is contained in:
mengyonghao
2026-01-05 17:30:28 +08:00
parent 35db38c2de
commit 29ccf956ec

View File

@@ -87,7 +87,7 @@ class WorkflowValidator:
return graphs return graphs
@classmethod @classmethod
def validate(cls, workflow_config: Union[dict[str, Any], Any]) -> tuple[bool, list[str]]: def validate(cls, workflow_config: Union[dict[str, Any], Any], publish=False) -> tuple[bool, list[str]]:
"""验证工作流配置 """验证工作流配置
Args: Args:
@@ -159,6 +159,8 @@ class WorkflowValidator:
elif target not in node_id_set: elif target not in node_id_set:
errors.append(f"边 #{i} 的 target 节点不存在: {target}") errors.append(f"边 #{i} 的 target 节点不存在: {target}")
if publish:
# 仅在发布时验证所有节点可达
# 6. 验证所有节点可达(从 start 节点出发) # 6. 验证所有节点可达(从 start 节点出发)
if start_nodes and not errors: # 只有在前面验证通过时才检查可达性 if start_nodes and not errors: # 只有在前面验证通过时才检查可达性
reachable = WorkflowValidator._get_reachable_nodes( reachable = WorkflowValidator._get_reachable_nodes(
@@ -288,7 +290,7 @@ class WorkflowValidator:
(is_valid, errors): 是否有效和错误列表 (is_valid, errors): 是否有效和错误列表
""" """
# 先执行基础验证 # 先执行基础验证
is_valid, errors = WorkflowValidator.validate(workflow_config) is_valid, errors = WorkflowValidator.validate(workflow_config, publish=True)
if not is_valid: if not is_valid:
return False, errors return False, errors