Documentation
¶
Index ¶
- type AggregatedResult
- func (ar *AggregatedResult) Add(result *ExecutionResult)
- func (ar *AggregatedResult) FailureRate() float64
- func (ar *AggregatedResult) Finalize()
- func (ar *AggregatedResult) GetFailedInstances() []*ExecutionResult
- func (ar *AggregatedResult) String() string
- func (ar *AggregatedResult) SuccessRate() float64
- type ExecutionResult
- type ExecutionStatus
- type ExecutorConfig
- type ParallelExecutor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregatedResult ¶
type AggregatedResult struct {
Total int // Total instances processed
Success int // Successful installations
Failed int // Failed installations
Skipped int // Skipped installations
Canceled int // Canceled installations
Results []*ExecutionResult // Individual results
TotalTime time.Duration // Total execution time
StartTime time.Time // When it started
EndTime time.Time // When it finished
}
AggregatedResult aggregates results from multiple executions. Useful for final reports.
func NewAggregatedResult ¶
func NewAggregatedResult() *AggregatedResult
NewAggregatedResult creates empty aggregated result
func (*AggregatedResult) Add ¶
func (ar *AggregatedResult) Add(result *ExecutionResult)
Add adds individual result to aggregate
func (*AggregatedResult) FailureRate ¶
func (ar *AggregatedResult) FailureRate() float64
FailureRate returns failure rate in percentage
func (*AggregatedResult) Finalize ¶
func (ar *AggregatedResult) Finalize()
Finalize finalizes aggregation and calculates total time
func (*AggregatedResult) GetFailedInstances ¶
func (ar *AggregatedResult) GetFailedInstances() []*ExecutionResult
GetFailedInstances returns list of instances that failed
func (*AggregatedResult) String ¶
func (ar *AggregatedResult) String() string
String returns readable representation of aggregated result
func (*AggregatedResult) SuccessRate ¶
func (ar *AggregatedResult) SuccessRate() float64
SuccessRate returns success rate in percentage
type ExecutionResult ¶
type ExecutionResult struct {
Instance *cloud.Instance // Instance processed
Status ExecutionStatus // Final execution status
InstallResult *installer.InstallResult // Detailed installation result
ValidationErr error // Validation error (if any)
InstallationErr error // Installation error (if any)
TaggingErr error // Tagging error (if any)
StartTime time.Time // When it started
EndTime time.Time // When it finished
Duration time.Duration // Total time
Metadata map[string]string // Installation metadata (OS, certname, etc)
}
ExecutionResult represents installation result on an instance. Extends installer.InstallResult with execution information.
func (*ExecutionResult) Failed ¶
func (er *ExecutionResult) Failed() bool
Failed returns true if execution failed
func (*ExecutionResult) GetError ¶
func (er *ExecutionResult) GetError() error
GetError returns the first error found (if any). Order: ValidationErr > InstallationErr > TaggingErr
func (*ExecutionResult) String ¶
func (er *ExecutionResult) String() string
String returns readable representation of the result
func (*ExecutionResult) Success ¶
func (er *ExecutionResult) Success() bool
Success returns true if execution was successful
type ExecutionStatus ¶
type ExecutionStatus int
ExecutionStatus represents the state of an execution. Go doesn't have native enums, we use typed constants + iota.
const ( // StatusPending execution not yet started StatusPending ExecutionStatus = iota // StatusRunning execution in progress StatusRunning // StatusSuccess execution completed successfully StatusSuccess // StatusFailed execution failed StatusFailed // StatusCancelled execution canceled (Ctrl+C or timeout) StatusCancelled // StatusSkipped execution skipped (e.g., already has puppet=true tag) StatusSkipped )
func (ExecutionStatus) String ¶
func (s ExecutionStatus) String() string
String returns readable representation of the status. Implements Stringer interface.
type ExecutorConfig ¶
type ExecutorConfig struct {
Provider cloud.CloudProvider // Cloud provider (AWS, Azure, GCP)
Installer installer.PackageInstaller // Package installer (Puppet, Docker, etc)
MaxConcurrency int // Max simultaneous installations (default: 10)
SkipValidation bool // Skip prerequisite validations
SkipTagging bool // Skip tagging after installation
DryRun bool // Simulate without executing
}
ExecutorConfig contains configuration for the parallel executor.
type ParallelExecutor ¶
type ParallelExecutor struct {
// contains filtered or unexported fields
}
ParallelExecutor executes package installations across multiple instances concurrently. Uses goroutines with semaphore pattern to limit concurrency and avoid overwhelming cloud APIs or network resources.
func NewParallelExecutor ¶
func NewParallelExecutor(config ExecutorConfig) *ParallelExecutor
NewParallelExecutor creates a new parallel executor with given configuration.
func (*ParallelExecutor) Execute ¶
func (pe *ParallelExecutor) Execute(ctx context.Context, instances []*cloud.Instance) (*AggregatedResult, error)
Execute processes multiple instances in parallel. Returns aggregated results with success/failure counts.
Workflow: 1. Create semaphore channel to limit concurrency 2. Launch goroutine for each instance 3. Each goroutine: validate -> install -> verify -> tag 4. Collect all results 5. Return aggregated result