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

Method cancelExecution

pkg/workflow/engine.go:919–949  ·  view source on GitHub ↗

cancelExecution 取消执行

(executionID string)

Source from the content-addressed store, hash-verified

917
918// cancelExecution 取消执行
919func (e *Engine) cancelExecution(executionID string) {
920 e.executionsMu.RLock()
921 execution, exists := e.executions[executionID]
922 e.executionsMu.RUnlock()
923
924 if !exists {
925 return
926 }
927
928 execution.mu.Lock()
929 defer execution.mu.Unlock()
930
931 if execution.Status != StatusRunning && execution.Status != StatusPaused {
932 return
933 }
934
935 execution.cancelFunc()
936 execution.Status = StatusCancelled
937 execution.Context.Status = StatusCancelled
938 execution.EndTime = time.Now()
939
940 // 发布取消事件
941 if e.eventBus != nil {
942 _ = e.eventBus.Publish(execution.Context.Context, &WorkflowEvent{
943 Type: "workflow.cancelled",
944 ExecutionID: executionID,
945 NodeID: "",
946 Timestamp: time.Now(),
947 })
948 }
949}
950
951// continueExecution 继续执行
952func (e *Engine) continueExecution(execution *WorkflowExecution) {

Callers 2

ExecuteMethod · 0.95
CancelExecutionMethod · 0.95

Calls 1

PublishMethod · 0.80

Tested by

no test coverage detected