Documentation
¶
Index ¶
- func RunSpageTemporalWorkerAndWorkflow(opts RunSpageTemporalWorkerAndWorkflowOptions)
- func SpageTemporalWorkflow(ctx workflow.Context, graphInput *pkg.Graph, inventoryInput *pkg.Inventory, ...) error
- type LocalTaskRunner
- type RunSpageTemporalWorkerAndWorkflowOptions
- type SpageActivityInput
- type SpageActivityResult
- type TemporalGraphExecutor
- type TemporalTaskRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunSpageTemporalWorkerAndWorkflow ¶
func RunSpageTemporalWorkerAndWorkflow(opts RunSpageTemporalWorkerAndWorkflowOptions)
RunSpageTemporalWorkerAndWorkflow sets up and runs a Temporal worker for Spage tasks, and can optionally trigger a workflow execution.
Types ¶
type LocalTaskRunner ¶
type LocalTaskRunner struct{}
LocalTaskRunner implements the TaskRunner interface for local execution. It directly calls the task's ExecuteModule method.
func (*LocalTaskRunner) ExecuteTask ¶
func (r *LocalTaskRunner) ExecuteTask(ctx context.Context, task pkg.Task, closure *pkg.Closure, cfg *config.Config) pkg.TaskResult
RunTask executes a task locally. It directly calls task.ExecuteModule and returns its result. The TaskResult from ExecuteModule is expected to be populated by handleResult (called within ExecuteModule).
func (*LocalTaskRunner) RevertTask ¶
type RunSpageTemporalWorkerAndWorkflowOptions ¶
type RunSpageTemporalWorkerAndWorkflowOptions struct {
Graph *pkg.Graph
InventoryPath string
LoadedConfig *config.Config // Changed from ConfigPath to break import cycle with cmd
WorkflowIDPrefix string
}
RunSpageTemporalWorkerAndWorkflowOptions defines options for RunSpageTemporalWorkerAndWorkflow.
type SpageActivityInput ¶
type SpageActivityInput struct {
TaskDefinition pkg.Task
TargetHost pkg.Host
LoopItem interface{} // nil if not a loop task or for the main item
CurrentHostFacts map[string]interface{}
SpageCoreConfig *config.Config // Pass necessary config parts
}
SpageActivityInput defines the input for our generic Spage task activity.
type SpageActivityResult ¶
type SpageActivityResult struct {
HostName string
TaskName string
Output string
Changed bool
Error string // Store error message if any
Skipped bool
Ignored bool
RegisteredVars map[string]interface{}
HostFactsSnapshot map[string]interface{}
}
SpageActivityResult defines the output from our generic Spage task activity.
func ExecuteSpageTaskActivity ¶
func ExecuteSpageTaskActivity(ctx context.Context, input SpageActivityInput) (*SpageActivityResult, error)
ExecuteSpageTaskActivity is the generic activity that runs a Spage task.
func RevertSpageTaskActivity ¶
func RevertSpageTaskActivity(ctx context.Context, input SpageActivityInput) (*SpageActivityResult, error)
RevertSpageTaskActivity is the generic activity that runs a Spage task's revert action.
type TemporalGraphExecutor ¶
type TemporalGraphExecutor struct {
Runner TemporalTaskRunner
}
func NewTemporalGraphExecutor ¶
func NewTemporalGraphExecutor(runner TemporalTaskRunner) *TemporalGraphExecutor
type TemporalTaskRunner ¶
TemporalTaskRunner implements the TaskRunner interface for Temporal activity execution. It requires access to the workflow.Context to execute activities. Note: This runner is conceptual for showing how Temporal fits the TaskRunner pattern. The SpageTemporalWorkflow will still manage its own execution loop due to differences in fact/state management compared to LocalGraphExecutor's assumptions.
func NewTemporalTaskRunner ¶
func NewTemporalTaskRunner(workflowCtx workflow.Context) *TemporalTaskRunner
NewTemporalTaskRunner creates a new TemporalTaskRunner.
func (*TemporalTaskRunner) ExecuteTask ¶
func (r *TemporalTaskRunner) ExecuteTask(execCtx workflow.Context, task pkg.Task, closure *pkg.Closure, cfg *config.Config) pkg.TaskResult
RunTask for Temporal dispatches the task as a Temporal activity. It converts the SpageActivityResult from the activity into a TaskResult. The original SpageActivityResult is stored in TaskResult.ExecutionSpecificOutput.