task

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTaskRunner

func NewTaskRunner(task Task, writer filewriter.FileWriter, opts ...TaskRunnerOpt) *taskRunner

func UnmarshalTaskCheckpoint added in v0.11.0

func UnmarshalTaskCheckpoint(taskCheckpoint TaskCheckpoint, config TaskCheckpoint) error
UnmarshalTaskCheckpoint marshals the received task checkpoint (type interface{}) then unmarshalls it into the desired type

specified in the Restore() method. When reading from a yaml file, there isn't a direct way in Go to do a type conversion from interface{} to the desired type. We use interface{} because the TaskCheckpoint type will vary depending on what's needed for a specific task. The known workaround for this is to marshal & unmarshal it into the checkpoint type.

Types

type CheckpointInfo added in v0.9.2

type CheckpointInfo struct {
	CompletedTasks map[string]*CompletedTask `json:"completedTasks"`
}

type CommandContext

type CommandContext struct {
	Bootstrapper       interfaces.Bootstrapper
	Provider           providers.Provider
	ClusterManager     interfaces.ClusterManager
	GitOpsManager      interfaces.GitOpsManager
	Validations        interfaces.Validator
	Writer             filewriter.FileWriter
	EksdInstaller      interfaces.EksdInstaller
	PackageInstaller   interfaces.PackageInstaller
	EksdUpgrader       interfaces.EksdUpgrader
	CAPIManager        interfaces.CAPIManager
	ClusterSpec        *cluster.Spec
	CurrentClusterSpec *cluster.Spec
	UpgradeChangeDiff  *types.ChangeDiff
	BootstrapCluster   *types.Cluster
	ManagementCluster  *types.Cluster
	WorkloadCluster    *types.Cluster
	Profiler           *Profiler
	OriginalError      error
}

Command context maintains the mutable and shared entities.

func (*CommandContext) SetError

func (c *CommandContext) SetError(err error)

type CompletedTask added in v0.9.2

type CompletedTask struct {
	Checkpoint TaskCheckpoint `json:"checkpoint"`
}

type Profiler

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

func (*Profiler) MarkDone

func (pp *Profiler) MarkDone(taskName string, msg string)

this can be used to profile sub tasks.

func (*Profiler) MarkDoneTask

func (pp *Profiler) MarkDoneTask(taskName string)

needs to be called after setStart.

func (*Profiler) Metrics

func (pp *Profiler) Metrics() map[string]map[string]time.Duration

get Metrics.

func (*Profiler) SetStart

func (pp *Profiler) SetStart(taskName string, msg string)

this can be used to profile sub tasks.

func (*Profiler) SetStartTask

func (pp *Profiler) SetStartTask(taskName string)

profiler for a Task.

type Task

type Task interface {
	Run(ctx context.Context, commandContext *CommandContext) Task
	Name() string
	Checkpoint() *CompletedTask
	Restore(ctx context.Context, commandContext *CommandContext, completedTask *CompletedTask) (Task, error)
}

Task is a logical unit of work - meant to be implemented by each Task.

type TaskCheckpoint added in v0.9.2

type TaskCheckpoint interface{}

type TaskRunnerOpt added in v0.11.0

type TaskRunnerOpt func(*taskRunner)

func WithCheckpointFile added in v0.11.0

func WithCheckpointFile() TaskRunnerOpt

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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