jobexecutor

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MPL-2.0 Imports: 47 Imported by: 0

Documentation

Overview

Package jobexecutor package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyHandler

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

ApplyHandler handles an apply job

func NewApplyHandler

func NewApplyHandler(
	cancellableCtx context.Context,
	jobCfg *JobConfig,
	workspaceDir string,
	workspace *types.Workspace,
	run *types.Run,
	jobLogger joblogger.Logger,
	client jobclient.Client,
) *ApplyHandler

NewApplyHandler creates a new ApplyHandler

func (*ApplyHandler) Execute

func (a *ApplyHandler) Execute(ctx context.Context) error

Execute will execute the job

func (*ApplyHandler) OnError

func (a *ApplyHandler) OnError(ctx context.Context, _ error) error

OnError is called if the job returns an error while executing

func (*ApplyHandler) OnSuccess

func (a *ApplyHandler) OnSuccess(ctx context.Context) error

OnSuccess is called after the job has been executed successfully

type JobConfig

type JobConfig struct {
	JobID                 string
	APIEndpoint           string
	JobToken              string
	DiscoveryProtocolHost string
}

JobConfig is used to configure the job

type JobExecutor

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

JobExecutor executes a job

func NewJobExecutor

func NewJobExecutor(
	cfg *JobConfig,
	client jobclient.Client,
	logger logger.Logger,
) *JobExecutor

NewJobExecutor creates a new JobExecutor

func (*JobExecutor) Execute

func (j *JobExecutor) Execute(ctx context.Context) error

Execute executes the job associated with the JobExecutor instance

type JobHandler

type JobHandler interface {
	Execute(ctx context.Context) error
	OnError(ctx context.Context, err error) error
	OnSuccess(ctx context.Context) error
}

JobHandler contains the job lifecycle functions

type MemoryMonitor added in v0.4.0

type MemoryMonitor interface {
	Start(ctx context.Context)
	Stop()
}

MemoryMonitor implements all memory monitor functions. The methods should be called in the order shown here. GetMaxMemoryUsage can be called multiple times if desired.

func NewMemoryMonitor added in v0.4.0

func NewMemoryMonitor(jobLogger joblogger.Logger, memoryLimit uint64) (MemoryMonitor, error)

NewMemoryMonitor creates an instance of the memory monitor.

type PlanHandler

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

PlanHandler handles a plan job

func NewPlanHandler

func NewPlanHandler(
	cancellableCtx context.Context,
	jobCfg *JobConfig,
	workspaceDir string,
	workspace *types.Workspace,
	run *types.Run,
	jobLogger joblogger.Logger,
	client jobclient.Client,
) *PlanHandler

NewPlanHandler creates a new PlanHandler

func (*PlanHandler) Execute

func (p *PlanHandler) Execute(ctx context.Context) error

Execute will execute the job

func (*PlanHandler) OnError

func (p *PlanHandler) OnError(ctx context.Context, _ error) error

OnError is called if the job returns an error while executing

func (*PlanHandler) OnSuccess

func (p *PlanHandler) OnSuccess(ctx context.Context) error

OnSuccess is called after the job has been executed successfully

Directories

Path Synopsis
Package jobclient package
Package jobclient package
Package joblogger package
Package joblogger package
Package managedidentity package
Package managedidentity package
awsfederated
Package awsfederated package
Package awsfederated package
azurefederated
Package azurefederated package
Package azurefederated package
tharsisfederated
Package tharsisfederated package
Package tharsisfederated package

Jump to

Keyboard shortcuts

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