canExecuteNode 检查节点是否可以执行
(execution *WorkflowExecution, nodeID string, condition string)
| 759 | |
| 760 | // canExecuteNode 检查节点是否可以执行 |
| 761 | func (e *Engine) canExecuteNode(execution *WorkflowExecution, nodeID string, condition string) bool { |
| 762 | // 检查节点是否已完成 |
| 763 | if execution.CompletedNodes[nodeID] { |
| 764 | return false |
| 765 | } |
| 766 | |
| 767 | // 检查节点是否失败 |
| 768 | if _, failed := execution.FailedNodes[nodeID]; failed { |
| 769 | return false |
| 770 | } |
| 771 | |
| 772 | // 检查边条件 |
| 773 | if condition != "" { |
| 774 | evaluator := NewExpressionEvaluator(execution.Context.Variables) |
| 775 | result, err := evaluator.EvaluateBool(condition) |
| 776 | if err != nil { |
| 777 | return false |
| 778 | } |
| 779 | return result |
| 780 | } |
| 781 | |
| 782 | return true |
| 783 | } |
| 784 | |
| 785 | // prepareInputMessage 准备输入消息 |
| 786 | func (e *Engine) prepareInputMessage(execution *WorkflowExecution, node *NodeDef) (string, error) { |
no test coverage detected