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

Method canExecuteNode

pkg/workflow/engine.go:761–783  ·  view source on GitHub ↗

canExecuteNode 检查节点是否可以执行

(execution *WorkflowExecution, nodeID string, condition string)

Source from the content-addressed store, hash-verified

759
760// canExecuteNode 检查节点是否可以执行
761func (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 准备输入消息
786func (e *Engine) prepareInputMessage(execution *WorkflowExecution, node *NodeDef) (string, error) {

Callers 1

findNextNodesMethod · 0.95

Calls 2

EvaluateBoolMethod · 0.95
NewExpressionEvaluatorFunction · 0.85

Tested by

no test coverage detected