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

Method markExecutionCompleted

pkg/workflow/engine.go:858–881  ·  view source on GitHub ↗

markExecutionCompleted 标记执行完成

(execution *WorkflowExecution)

Source from the content-addressed store, hash-verified

856
857// markExecutionCompleted 标记执行完成
858func (e *Engine) markExecutionCompleted(execution *WorkflowExecution) {
859 execution.mu.Lock()
860 defer execution.mu.Unlock()
861
862 execution.Status = StatusCompleted
863 execution.Context.Status = StatusCompleted
864 execution.EndTime = time.Now()
865
866 // 更新指标
867 e.metrics.CompletedExecutions++
868
869 // 发布完成事件
870 if e.eventBus != nil {
871 _ = e.eventBus.Publish(execution.Context.Context, &WorkflowEvent{
872 Type: "workflow.completed",
873 ExecutionID: execution.ID,
874 NodeID: "",
875 Timestamp: time.Now(),
876 Data: map[string]any{
877 "duration": execution.EndTime.Sub(execution.StartTime),
878 },
879 })
880 }
881}
882
883// markExecutionFailed 标记执行失败
884func (e *Engine) markExecutionFailed(execution *WorkflowExecution, err error) {

Callers 1

executeNodesMethod · 0.95

Calls 1

PublishMethod · 0.80

Tested by

no test coverage detected