executeNodes 执行节点
(execution *WorkflowExecution, nodeIDs []string)
| 491 | |
| 492 | // executeNodes 执行节点 |
| 493 | func (e *Engine) executeNodes(execution *WorkflowExecution, nodeIDs []string) { |
| 494 | execution.mu.Lock() |
| 495 | execution.CurrentNodes = nodeIDs |
| 496 | execution.LastActivity = time.Now() |
| 497 | execution.mu.Unlock() |
| 498 | |
| 499 | for _, nodeID := range nodeIDs { |
| 500 | if !e.executeNode(execution, nodeID) { |
| 501 | return // 节点执行失败 |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | // 查找下一批节点 |
| 506 | nextNodes := e.findNextNodes(execution, nodeIDs) |
| 507 | if len(nextNodes) > 0 { |
| 508 | e.executeNodes(execution, nextNodes) |
| 509 | } else { |
| 510 | // 没有更多节点,工作流完成 |
| 511 | e.markExecutionCompleted(execution) |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | // executeNode 执行单个节点 |
| 516 | func (e *Engine) executeNode(execution *WorkflowExecution, nodeID string) bool { |
no test coverage detected