jobexecutor

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MPL-2.0 Imports: 48 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,
	logger logger.Logger,
	jobLogger joblogger.Logger,
	client jobclient.Client,
) *ApplyHandler

NewApplyHandler creates a new ApplyHandler

func (*ApplyHandler) Cleanup added in v0.28.0

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

Cleanup is called after the job has been executed

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, applyErr error)

OnError is called if the job returns an error while executing

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,
	version string,
) *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)
	Cleanup(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,
	logger logger.Logger,
	jobLogger joblogger.Logger,
	client jobclient.Client,
) *PlanHandler

NewPlanHandler creates a new PlanHandler

func (*PlanHandler) Cleanup added in v0.28.0

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

Cleanup is called after the job has been executed

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, planErr error)

OnError is called if the job returns an error while executing

Directories

Path Synopsis
Package jobclient package
Package jobclient package
Package joblogger is used to handle job logs
Package joblogger is used to handle job logs
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