playbook

package
v0.0.0-...-b7a57f2 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDone = fmt.Errorf("playbook is done")
View Source
var ErrFailed = fmt.Errorf("playbook failed")
View Source
var ErrWalkDone = fmt.Errorf("walking done")

Functions

This section is empty.

Types

type Option

type Option func(p *Playbook)

func WithCachingEnabled

func WithCachingEnabled(enable bool) Option

func WithLocalStore

func WithLocalStore(s store.Store) Option

func WithMaxParallel

func WithMaxParallel(maxParallel int) Option

func WithPredictedNumOfTasks

func WithPredictedNumOfTasks(tasks int) Option

func WithPullEnabled

func WithPullEnabled(enable bool) Option

func WithPushEnabled

func WithPushEnabled(enable bool) Option

func WithRemoteStore

func WithRemoteStore(s store.Store) Option

type Playbook

type Playbook struct {
	Tasks StatusMap
	// TasksOptimized uses a array instead of an map
	TasksOptimized StatusSlice
	// contains filtered or unexported fields
}

func New

func New(root string, rootID int, opts ...Option) *Playbook

func (*Playbook) Build

func (p *Playbook) Build(ctx context.Context) (err error)

Build the playbook starting at root.

func (*Playbook) DoneChan

func (p *Playbook) DoneChan() chan struct{}

func (*Playbook) ErrorChannel

func (p *Playbook) ErrorChannel() <-chan error

func (*Playbook) ExecutionTime

func (p *Playbook) ExecutionTime() time.Duration

func (*Playbook) List

func (p *Playbook) List() (err error)

func (*Playbook) Next

func (p *Playbook) Next() (_ *Status, err error)

func (*Playbook) String

func (p *Playbook) String() string

func (*Playbook) TaskCanceled

func (p *Playbook) TaskCanceled(taskID int) (err error)

TaskCanceled sets a task to canceled

func (*Playbook) TaskChannel

func (p *Playbook) TaskChannel() <-chan *bobtask.Task

TaskChannel returns the next task

func (*Playbook) TaskCompleted

func (p *Playbook) TaskCompleted(taskID int) (err error)

TaskCompleted sets a task to completed

func (*Playbook) TaskFailed

func (p *Playbook) TaskFailed(taskID int, taskErr error) (err error)

TaskFailed sets a task to failed

func (*Playbook) TaskNeedsRebuild

func (p *Playbook) TaskNeedsRebuild(taskID int) (rebuildInfo RebuildInfo, err error)

TaskNeedsRebuild check if a tasks need a rebuild by looking at its hash value and its child tasks.

func (*Playbook) TaskNoRebuildRequired

func (p *Playbook) TaskNoRebuildRequired(taskID int) (err error)

TaskNoRebuildRequired sets a task's state to indicate that no rebuild is required

func (*Playbook) TaskStatus

func (p *Playbook) TaskStatus(taskname string) (ts *Status, _ error)

TaskStatus returns the current state of a task

type RebuildCause

type RebuildCause string
const (
	InputNotFoundInBuildInfo RebuildCause = "input-not-in-build-info" // aka local cache miss
	TaskForcedRebuild        RebuildCause = "forced"
	DependencyChanged        RebuildCause = "dependency-changed"
	TargetInvalid            RebuildCause = "target-invalid"
	TargetNotInLocalStore    RebuildCause = "target-not-in-localstore"
)

func (*RebuildCause) String

func (rc *RebuildCause) String() string

type RebuildInfo

type RebuildInfo struct {
	// IsRequired tells if the task requires rebuild again
	IsRequired bool
	// Cause tells why the rebuild is required
	Cause RebuildCause
	// VerifyResult is the result of target filesystem verification
	VerifyResult target.VerifyResult
}

RebuildInfo contains information about a task rebuild: if it's required and the cause for it

type State

type State string
const (
	StatePending           State = "PENDING"
	StateCompleted         State = "COMPLETED"
	StateNoRebuildRequired State = "CACHED"
	StateFailed            State = "FAILED"
	StateRunning           State = "RUNNING"
	StateCanceled          State = "CANCELED"
	StateQueued            State = "QUEUED"
)

func (*State) Short

func (s *State) Short() string

func (*State) Summary

func (s *State) Summary() string

Summary state indicators. The nbsp are intended to align on the cli.

type Status

type Status struct {
	*bobtask.Task

	Error error
	// contains filtered or unexported fields
}

Status holds the state of a task inside a playbook.

func NewStatus

func NewStatus(task *bobtask.Task) *Status

func (*Status) End

func (ts *Status) End() time.Time

func (*Status) ExecutionTime

func (ts *Status) ExecutionTime() time.Duration

func (*Status) SetEnd

func (ts *Status) SetEnd(end time.Time)

func (*Status) SetStart

func (ts *Status) SetStart(start time.Time)

func (*Status) SetState

func (ts *Status) SetState(s State, err error)

func (*Status) Start

func (ts *Status) Start() time.Time

func (*Status) State

func (ts *Status) State() State

type StatusMap

type StatusMap map[string]*Status

type StatusSlice

type StatusSlice []*Status

type TaskKey

type TaskKey string

TaskKey is key for context values passed to client for upload/download output formatting

Jump to

Keyboard shortcuts

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