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

Method executeNodes

pkg/workflow/actor_engine.go:344–378  ·  view source on GitHub ↗

executeNodes 执行节点列表

(execution *WorkflowExecution, state *workflowState, nodeIDs []string)

Source from the content-addressed store, hash-verified

342
343// executeNodes 执行节点列表
344func (c *CoordinatorActor) executeNodes(execution *WorkflowExecution, state *workflowState, nodeIDs []string) error {
345 for _, nodeID := range nodeIDs {
346 node := c.findNode(execution.Definition, nodeID)
347 if node == nil {
348 return fmt.Errorf("node not found: %s", nodeID)
349 }
350
351 // 根据节点类型执行
352 switch node.Type {
353 case NodeTypeTask:
354 if err := c.executeTaskNodeWithActor(execution, state, node); err != nil {
355 return err
356 }
357 case NodeTypeParallel:
358 if err := c.executeParallelNodeWithActors(execution, state, node); err != nil {
359 return err
360 }
361 default:
362 // 使用原有引擎处理其他类型
363 if !c.engine.executeNode(execution, nodeID) {
364 return fmt.Errorf("node execution failed: %s", nodeID)
365 }
366 }
367
368 execution.CompletedNodes[nodeID] = true
369 }
370
371 // 查找下一批节点
372 nextNodes := c.findNextNodes(execution, nodeIDs)
373 if len(nextNodes) > 0 {
374 return c.executeNodes(execution, state, nextNodes)
375 }
376
377 return nil
378}
379
380// executeTaskNodeWithActor 使用 Actor 执行任务节点
381func (c *CoordinatorActor) executeTaskNodeWithActor(execution *WorkflowExecution, state *workflowState, node *NodeDef) error {

Callers 1

executeWorkflowAsyncMethod · 0.95

Calls 5

findNodeMethod · 0.95
findNextNodesMethod · 0.95
executeNodeMethod · 0.80

Tested by

no test coverage detected