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

Method markExecutionFailed

pkg/workflow/engine.go:884–916  ·  view source on GitHub ↗

markExecutionFailed 标记执行失败

(execution *WorkflowExecution, err error)

Source from the content-addressed store, hash-verified

882
883// markExecutionFailed 标记执行失败
884func (e *Engine) markExecutionFailed(execution *WorkflowExecution, err error) {
885 execution.mu.Lock()
886 defer execution.mu.Unlock()
887
888 execution.Status = StatusFailed
889 execution.Context.Status = StatusFailed
890 execution.EndTime = time.Now()
891
892 // 记录错误
893 execution.Errors = append(execution.Errors, WorkflowError{
894 NodeID: "",
895 NodeName: "",
896 Error: err.Error(),
897 Timestamp: time.Now(),
898 Retryable: false,
899 })
900
901 // 更新指标
902 e.metrics.FailedExecutions++
903
904 // 发布失败事件
905 if e.eventBus != nil {
906 _ = e.eventBus.Publish(execution.Context.Context, &WorkflowEvent{
907 Type: "workflow.failed",
908 ExecutionID: execution.ID,
909 NodeID: "",
910 Timestamp: time.Now(),
911 Data: map[string]any{
912 "error": err.Error(),
913 },
914 })
915 }
916}
917
918// cancelExecution 取消执行
919func (e *Engine) cancelExecution(executionID string) {

Callers 2

executeWorkflowMethod · 0.95
executeNodeMethod · 0.95

Calls 2

PublishMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected