runnerpool

package
v0.83.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package runnerpool provides a runner implementation based on a pool pattern for executing multiple units concurrently.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(ctx context.Context, l log.Logger, terragruntOptions *options.TerragruntOptions, opts ...common.Option) (common.StackRunner, error)

Build stack runner using discovery and queueing mechanisms.

func NewRunnerPoolStack

func NewRunnerPoolStack(l log.Logger, terragruntOptions *options.TerragruntOptions, discovered discovery.DiscoveredConfigs, opts ...common.Option) (common.StackRunner, error)

NewRunnerPoolStack creates a new stack from discovered units.

Types

type DAGRunner

type DAGRunner struct {
	// contains filtered or unexported fields
}

DAGRunner orchestrates concurrent execution over a DAG.

func NewDAGRunner

func NewDAGRunner(q *queue.Queue, units []*common.Unit, opts ...DAGRunnerOption) *DAGRunner

NewDAGRunner creates a new DAGRunner with the given options and a pre-built queue.

func (*DAGRunner) Run

func (dr *DAGRunner) Run(ctx context.Context, l log.Logger) []RunResult

Run executes the DAG and returns one result per queue entry (order preserved). The function:

  • never blocks forever – if progress is impossible it bails out;
  • is data-race free (results map is mutex-protected);
  • needs no special-casing for fail-fast.

type DAGRunnerOption

type DAGRunnerOption func(*DAGRunner)

DAGRunnerOption is a function that modifies a DAGRunner.

func WithMaxConcurrency

func WithMaxConcurrency(maxConc int) DAGRunnerOption

WithMaxConcurrency sets the concurrency for the DAGRunner.

func WithRunner

func WithRunner(runner UnitExecutor) DAGRunnerOption

WithRunner sets the UnitExecutor for the DAGRunner.

type RunResult

type RunResult struct {
	Err      error
	ExitCode int
}

RunResult Define struct for results

type Runner

type Runner struct {
	Stack *common.Stack
	// contains filtered or unexported fields
}

Runner implements the Stack interface for runner pool execution.

func (*Runner) GetStack

func (r *Runner) GetStack() *common.Stack

GetStack returns the stack associated with the runner.

func (*Runner) JSONUnitDeployOrder

func (r *Runner) JSONUnitDeployOrder(terraformCommand string) (string, error)

JSONUnitDeployOrder returns the order of units to be processed for a given Terraform command in JSON format.

func (*Runner) ListStackDependentUnits

func (r *Runner) ListStackDependentUnits() map[string][]string

ListStackDependentUnits returns a map of units and their dependent units in the stack.

func (*Runner) LogUnitDeployOrder

func (r *Runner) LogUnitDeployOrder(l log.Logger, terraformCommand string) error

LogUnitDeployOrder logs the order of units to be processed for a given Terraform command.

func (*Runner) Run

Run executes the stack according to TerragruntOptions and returns the first error (or a joined error) once execution is finished.

func (*Runner) SetParseOptions

func (r *Runner) SetParseOptions(parserOptions []hclparse.Option)

SetParseOptions sets the ParseOptions for the stack.

func (*Runner) SetReport

func (r *Runner) SetReport(report *report.Report)

SetReport sets the report for the stack.

func (*Runner) SetTerragruntConfig

func (r *Runner) SetTerragruntConfig(config *config.TerragruntConfig)

SetTerragruntConfig sets the config for the stack.

func (*Runner) WithOptions

func (r *Runner) WithOptions(opts ...common.Option) *Runner

WithOptions updates the stack with the provided options.

type UnitExecutor

type UnitExecutor func(ctx context.Context, u *common.Unit) (int, error)

UnitExecutor defines a function type that executes a Unit within a given context and returns an exit code and error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL