executeWorkflow 执行工作流
(execution *WorkflowExecution)
| 470 | |
| 471 | // executeWorkflow 执行工作流 |
| 472 | func (e *Engine) executeWorkflow(execution *WorkflowExecution) { |
| 473 | defer close(execution.done) |
| 474 | |
| 475 | // 设置运行状态 |
| 476 | execution.mu.Lock() |
| 477 | execution.Status = StatusRunning |
| 478 | execution.Context.Status = StatusRunning |
| 479 | execution.mu.Unlock() |
| 480 | |
| 481 | // 查找开始节点 |
| 482 | startNodes := e.findStartNodes(execution.Definition) |
| 483 | if len(startNodes) == 0 { |
| 484 | e.markExecutionFailed(execution, errors.New("no start node found")) |
| 485 | return |
| 486 | } |
| 487 | |
| 488 | // 开始执行 |
| 489 | e.executeNodes(execution, startNodes) |
| 490 | } |
| 491 | |
| 492 | // executeNodes 执行节点 |
| 493 | func (e *Engine) executeNodes(execution *WorkflowExecution, nodeIDs []string) { |
no test coverage detected