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

Method executeWorkflowAsync

pkg/workflow/actor_engine.go:315–341  ·  view source on GitHub ↗

executeWorkflowAsync 异步执行工作流

(execution *WorkflowExecution, state *workflowState)

Source from the content-addressed store, hash-verified

313
314// executeWorkflowAsync 异步执行工作流
315func (c *CoordinatorActor) executeWorkflowAsync(execution *WorkflowExecution, state *workflowState) {
316 execution.mu.Lock()
317 execution.Status = StatusRunning
318 execution.mu.Unlock()
319
320 // 查找开始节点
321 startNodes := c.findStartNodes(execution.Definition)
322 if len(startNodes) == 0 {
323 state.errorCh <- errors.New("no start node found")
324 return
325 }
326
327 // 执行节点
328 if err := c.executeNodes(execution, state, startNodes); err != nil {
329 state.errorCh <- err
330 return
331 }
332
333 // 构建结果
334 result := execution.buildResult()
335 state.resultCh <- result
336
337 // 清理
338 c.mu.Lock()
339 delete(c.runningWorkflows, execution.ID)
340 c.mu.Unlock()
341}
342
343// executeNodes 执行节点列表
344func (c *CoordinatorActor) executeNodes(execution *WorkflowExecution, state *workflowState, nodeIDs []string) error {

Callers 1

handleExecuteWorkflowMethod · 0.95

Calls 4

findStartNodesMethod · 0.95
executeNodesMethod · 0.95
deleteFunction · 0.85
buildResultMethod · 0.80

Tested by

no test coverage detected