MCPcopy Create free account
hub / github.com/astercloud/aster / findNextNodes

Method findNextNodes

pkg/workflow/engine.go:737–758  ·  view source on GitHub ↗

findNextNodes 查找下一批节点

(execution *WorkflowExecution, currentNodes []string)

Source from the content-addressed store, hash-verified

735
736// findNextNodes 查找下一批节点
737func (e *Engine) findNextNodes(execution *WorkflowExecution, currentNodes []string) []string {
738 var nextNodes []string
739 completed := make(map[string]bool)
740
741 // 将当前节点标记为已完成
742 for _, nodeID := range currentNodes {
743 completed[nodeID] = true
744 execution.CompletedNodes[nodeID] = true
745 }
746
747 // 查找所有指向已完成节点的边
748 for _, edge := range execution.Definition.Edges {
749 if completed[edge.From] {
750 // 检查所有前置节点是否都已完成
751 if e.canExecuteNode(execution, edge.To, edge.Condition) {
752 nextNodes = append(nextNodes, edge.To)
753 }
754 }
755 }
756
757 return nextNodes
758}
759
760// canExecuteNode 检查节点是否可以执行
761func (e *Engine) canExecuteNode(execution *WorkflowExecution, nodeID string, condition string) bool {

Callers 1

executeNodesMethod · 0.95

Calls 1

canExecuteNodeMethod · 0.95

Tested by

no test coverage detected