task

package
v3.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 14 Imported by: 30

Documentation

Index

Constants

View Source
const (
	DefaultTimeout = 120
	DefaultCon     = 10

	DefaultTaskName = "DefaultTask"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	GetDesc() string
	Init(runtime connector.Runtime, moduleCache *cache.Cache, pipelineCache *cache.Cache)
	Execute() *ending.TaskResult
	ExecuteRollback()
}

type LocalTask

type LocalTask struct {
	Name     string
	Desc     string
	Prepare  prepare.Prepare
	Action   action.Action
	Rollback rollback.Rollback
	Retry    int
	Delay    time.Duration
	Timeout  time.Duration

	PipelineCache *cache.Cache
	ModuleCache   *cache.Cache
	Runtime       connector.Runtime

	IgnoreError bool
	TaskResult  *ending.TaskResult
	// contains filtered or unexported fields
}

func (*LocalTask) Default

func (l *LocalTask) Default()

func (*LocalTask) Execute

func (l *LocalTask) Execute() *ending.TaskResult

func (*LocalTask) ExecuteRollback

func (l *LocalTask) ExecuteRollback()

func (*LocalTask) ExecuteWithRetry

func (l *LocalTask) ExecuteWithRetry(runtime connector.Runtime, host connector.Host) error

func (*LocalTask) GetDesc

func (l *LocalTask) GetDesc() string

func (*LocalTask) Init

func (l *LocalTask) Init(runtime connector.Runtime, moduleCache *cache.Cache, pipelineCache *cache.Cache)

func (*LocalTask) Run

func (l *LocalTask) Run(runtime connector.Runtime, host connector.Host, resCh chan error)

func (*LocalTask) RunWithTimeout

func (l *LocalTask) RunWithTimeout(runtime connector.Runtime, host connector.Host)

func (*LocalTask) When

func (l *LocalTask) When(runtime connector.Runtime) (bool, error)

func (*LocalTask) WhenWithRetry

func (l *LocalTask) WhenWithRetry(runtime connector.Runtime, host connector.Host) (bool, error)

type RemoteTask

type RemoteTask struct {
	Name        string
	Desc        string
	Hosts       []connector.Host
	Prepare     prepare.Prepare
	Action      action.Action
	Rollback    rollback.Rollback
	Parallel    bool
	Retry       int
	Delay       time.Duration
	Timeout     time.Duration
	Concurrency float64

	PipelineCache *cache.Cache
	ModuleCache   *cache.Cache
	Runtime       connector.Runtime
	IgnoreError   bool
	TaskResult    *ending.TaskResult
}

func (*RemoteTask) ConfigureSelfRuntime

func (t *RemoteTask) ConfigureSelfRuntime(runtime connector.Runtime, host connector.Host, index int) error

func (*RemoteTask) Default

func (t *RemoteTask) Default()

func (*RemoteTask) Execute

func (t *RemoteTask) Execute() *ending.TaskResult

func (*RemoteTask) ExecuteRollback

func (t *RemoteTask) ExecuteRollback()

func (*RemoteTask) ExecuteWithRetry

func (t *RemoteTask) ExecuteWithRetry(runtime connector.Runtime) error

func (*RemoteTask) GetDesc

func (t *RemoteTask) GetDesc() string

func (*RemoteTask) Init

func (t *RemoteTask) Init(runtime connector.Runtime, moduleCache *cache.Cache, pipelineCache *cache.Cache)

func (*RemoteTask) RollbackWithTimeout

func (t *RemoteTask) RollbackWithTimeout(ctx context.Context, runtime connector.Runtime, host connector.Host, index int,
	result *ending.ActionResult, wg *sync.WaitGroup, pool chan struct{})

func (*RemoteTask) Run

func (t *RemoteTask) Run(runtime connector.Runtime, host connector.Host, index int, resCh chan error)

func (*RemoteTask) RunRollback

func (t *RemoteTask) RunRollback(runtime connector.Runtime, host connector.Host, index int, result *ending.ActionResult, resCh chan error)

func (*RemoteTask) RunWithTimeout

func (t *RemoteTask) RunWithTimeout(ctx context.Context, runtime connector.Runtime, host connector.Host, index int,
	wg *sync.WaitGroup, pool chan struct{})

func (*RemoteTask) When

func (t *RemoteTask) When(runtime connector.Runtime) (bool, error)

func (*RemoteTask) WhenWithRetry

func (t *RemoteTask) WhenWithRetry(runtime connector.Runtime) (bool, error)

Jump to

Keyboard shortcuts

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