Exec for the Flow initiates the orchestration. Should not be called directly by user.
(ctx *PfContext, prepResult any)
| 593 | |
| 594 | // Exec for the Flow initiates the orchestration. Should not be called directly by user. |
| 595 | func (f *Flow) Exec(ctx *PfContext, prepResult any) (any, error) { |
| 596 | // This is called internally by InternalRun after Flow's Prep. |
| 597 | // The 'prepResult' here is the result of Flow.Prep, not a node's prep. |
| 598 | // The 'execResult' of a Flow is the final action string from orchestration. |
| 599 | // We need the context here for orchestrate, assume prepResult is the context for simplicity |
| 600 | // although Flow's Prep doesn't *have* to return the context. Let's pass ctx directly. |
| 601 | // This requires changing the call site in InternalRun. |
| 602 | sharedCtx, _ := prepResult.(map[string]any) |
| 603 | finalAction, err := f.orchestrate(ctx, sharedCtx) // Run orchestration with the context |
| 604 | if err != nil { |
| 605 | return "", err // Return error, action is irrelevant if orchestration failed |
| 606 | } |
| 607 | return finalAction, nil // Return the final action as the result |
| 608 | } |
| 609 | |
| 610 | // Post for the Flow runs after orchestration completes. Default returns the final action. |
| 611 | func (f *Flow) Post(ctx *PfContext, prepResult any, execResult any) (string, error) { |
no test coverage detected