execution

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultScheduler

type DefaultScheduler struct{}

DefaultScheduler schedules jobs from the pipeline DAG.

func (DefaultScheduler) Schedule

func (DefaultScheduler) Schedule(ir *pipeline.IR) ([]pipeline.JobGroup, error)

type EventSink

type EventSink interface {
	JobStarted(event JobEvent)
	JobFinished(event JobEvent, result JobResult)
}

EventSink consumes structured execution events.

type ExecutionError added in v0.10.7

type ExecutionError struct {
	JobName string
	Err     error
}

ExecutionError wraps a failed job execution while preserving the original cause for errors.Is/errors.As.

func (*ExecutionError) Error added in v0.10.7

func (e *ExecutionError) Error() string

func (*ExecutionError) Unwrap added in v0.10.7

func (e *ExecutionError) Unwrap() error

type Executor

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

Executor executes a Plan.

func NewExecutor

func NewExecutor(runner JobRunner, opts ...ExecutorOption) *Executor

NewExecutor constructs an Executor.

func (*Executor) Execute

func (e *Executor) Execute(ctx context.Context, ir *pipeline.IR) (*Result, error)

Execute runs the pipeline IR group-by-group.

type ExecutorOption

type ExecutorOption func(*Executor)

ExecutorOption mutates executor behavior.

func WithEventSink

func WithEventSink(sink EventSink) ExecutorOption

WithEventSink configures an execution event sink.

func WithParallelism

func WithParallelism(parallelism int) ExecutorOption

WithParallelism bounds concurrent jobs inside one execution group.

func WithScheduler

func WithScheduler(s Scheduler) ExecutorOption

WithScheduler overrides the execution scheduler.

type GroupResult

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

GroupResult describes one scheduled execution group.

func NewGroupResult added in v0.10.7

func NewGroupResult(opts GroupResultOptions) (GroupResult, error)

NewGroupResult validates and constructs a group result.

func (GroupResult) JobCount

func (r GroupResult) JobCount() int

func (GroupResult) Name

func (r GroupResult) Name() string

type GroupResultOptions added in v0.10.7

type GroupResultOptions struct {
	Name     string
	JobCount int
}

GroupResultOptions describes one scheduled execution group result.

type JobEvent added in v0.10.7

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

JobEvent is immutable context for an execution event.

func NewJobEvent added in v0.10.7

func NewJobEvent(job pipeline.Job, at time.Time) JobEvent

NewJobEvent constructs event context from an immutable pipeline job value.

func (JobEvent) At added in v0.10.7

func (e JobEvent) At() time.Time

At returns the event timestamp.

func (JobEvent) Kind added in v0.10.7

func (e JobEvent) Kind() pipeline.JobKind

Kind returns the canonical pipeline job kind.

func (JobEvent) ModuleID added in v0.10.7

func (e JobEvent) ModuleID() string

ModuleID returns the TerraCi module ID for module jobs.

func (JobEvent) Name added in v0.10.7

func (e JobEvent) Name() string

Name returns the execution job name.

func (JobEvent) Operation added in v0.10.7

func (e JobEvent) Operation() pipeline.OperationType

Operation returns the operation type being executed.

type JobResult

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

JobResult is the immutable execution outcome for one job.

func NewJobResult added in v0.10.7

func NewJobResult(opts JobResultOptions) (JobResult, error)

NewJobResult validates and constructs a job result.

func (JobResult) Duration added in v0.10.7

func (r JobResult) Duration() time.Duration

func (JobResult) Err

func (r JobResult) Err() error

func (JobResult) Failed added in v0.10.7

func (r JobResult) Failed() bool

func (JobResult) FinishedAt

func (r JobResult) FinishedAt() time.Time

func (JobResult) Name

func (r JobResult) Name() string

func (JobResult) ProducedArtifact added in v0.10.7

func (r JobResult) ProducedArtifact() (pipeline.Artifact, bool)

func (JobResult) ProducedArtifacts added in v0.10.7

func (r JobResult) ProducedArtifacts() []pipeline.Artifact

func (JobResult) StartedAt

func (r JobResult) StartedAt() time.Time

func (JobResult) Status

func (r JobResult) Status() JobStatus

type JobResultOptions added in v0.10.7

type JobResultOptions struct {
	Name              string
	Status            JobStatus
	StartedAt         time.Time
	FinishedAt        time.Time
	ProducedArtifacts []pipeline.Artifact
	Err               error
}

JobResultOptions describes one job execution result.

type JobRunner

type JobRunner interface {
	Run(ctx context.Context, job pipeline.Job) error
}

JobRunner executes one job.

type JobStatus

type JobStatus string

JobStatus is the status of an executed job.

const (
	JobStatusSucceeded JobStatus = "succeeded"
	JobStatusFailed    JobStatus = "failed"
)

type Result

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

Result is the immutable aggregate outcome for a run.

func NewResult added in v0.10.7

func NewResult(opts ResultOptions) (*Result, error)

NewResult constructs an immutable aggregate execution result.

func (*Result) Clone added in v0.10.7

func (r *Result) Clone() *Result

Clone returns a defensive result copy.

func (*Result) Failed

func (r *Result) Failed() (JobResult, bool)

Failed returns the first failed job result, if any.

func (*Result) Groups

func (r *Result) Groups() []GroupResult

Groups returns defensive group result copies.

func (*Result) Jobs

func (r *Result) Jobs() []JobResult

Jobs returns defensive job result copies.

func (*Result) Stats added in v0.10.7

func (r *Result) Stats() Stats

Stats returns aggregate execution counters and total job duration.

type ResultOptions added in v0.10.7

type ResultOptions struct {
	Groups []GroupResult
	Jobs   []JobResult
}

ResultOptions describes an aggregate execution result.

type Scheduler

type Scheduler interface {
	Schedule(ir *pipeline.IR) ([]pipeline.JobGroup, error)
}

Scheduler builds execution groups from a pipeline IR.

Returns an error if the IR is structurally invalid (cycles or duplicate job names) — preventing silent fallback that would run dependent jobs in the wrong order.

type Stats added in v0.10.7

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

Stats is an immutable aggregate execution summary.

func (Stats) Duration added in v0.10.7

func (s Stats) Duration() time.Duration

func (Stats) Failed added in v0.10.7

func (s Stats) Failed() int

func (Stats) Groups added in v0.10.7

func (s Stats) Groups() int

func (Stats) Jobs added in v0.10.7

func (s Stats) Jobs() int

func (Stats) Succeeded added in v0.10.7

func (s Stats) Succeeded() int

type WorkerPool

type WorkerPool interface {
	Run(ctx context.Context, jobs []pipeline.Job, fn func(context.Context, pipeline.Job) error) error
}

WorkerPool runs a group of jobs with bounded concurrency.

type Workspace

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

Workspace centralizes canonical execution-domain paths.

func NewWorkspace

func NewWorkspace(workDir, serviceDir string) Workspace

NewWorkspace constructs a Workspace from absolute work and service directories.

func (Workspace) ModuleDir

func (w Workspace) ModuleDir(rel string) string

ModuleDir returns the absolute module directory for a relative module path.

func (Workspace) PlanFile

func (w Workspace) PlanFile(rel string) string

PlanFile returns the absolute plan.tfplan path for a module.

func (Workspace) PlanJSONFile

func (w Workspace) PlanJSONFile(rel string) string

PlanJSONFile returns the absolute plan.json path for a module.

func (Workspace) PlanTextFile

func (w Workspace) PlanTextFile(rel string) string

PlanTextFile returns the absolute plan.txt path for a module.

func (Workspace) ServiceDir

func (w Workspace) ServiceDir() string

func (Workspace) ServiceFile

func (w Workspace) ServiceFile(name string) string

ServiceFile returns the absolute path to a file under the service directory.

func (Workspace) WorkDir

func (w Workspace) WorkDir() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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