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

Method ExecuteAsync

pkg/workflow/engine.go:221–243  ·  view source on GitHub ↗

ExecuteAsync 异步执行工作流

(ctx context.Context, workflowID string, inputs map[string]any)

Source from the content-addressed store, hash-verified

219
220// ExecuteAsync 异步执行工作流
221func (e *Engine) ExecuteAsync(ctx context.Context, workflowID string, inputs map[string]any) (string, error) {
222 // 加载工作流定义
223 def, err := e.loadWorkflowDefinition(workflowID)
224 if err != nil {
225 return "", fmt.Errorf("failed to load workflow definition: %w", err)
226 }
227
228 // 验证输入
229 if err := e.validateInputs(def, inputs); err != nil {
230 return "", fmt.Errorf("invalid inputs: %w", err)
231 }
232
233 // 创建执行实例
234 execution, err := e.createExecution(def, inputs)
235 if err != nil {
236 return "", fmt.Errorf("failed to create execution: %w", err)
237 }
238
239 // 启动执行
240 go e.executeWorkflow(execution)
241
242 return execution.ID, nil
243}
244
245// GetExecution 获取执行状态
246func (e *Engine) GetExecution(executionID string) (*WorkflowExecution, error) {

Callers

nothing calls this directly

Calls 4

validateInputsMethod · 0.95
createExecutionMethod · 0.95
executeWorkflowMethod · 0.95

Tested by

no test coverage detected