executor

package
v0.3.28 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FailResult

func FailResult(err error) (*model.RunCommandResult, error)

func WriteJobResults

func WriteJobResults(resultsDir string, stdout, stderr io.Reader, exitcode int, err error) (*model.RunCommandResult, error)

WriteJobResults produces files and a model.RunCommandResult in the standard format, including truncating the contents of both where necessary to fit within system-defined limits.

It will consume only the bytes from the passed io.Readers that it needs to correctly form job outputs. Once the command returns, the readers can close.

Types

type Executor

type Executor interface {
	model.Providable

	// used to filter and select jobs
	//    tells us if the storage resource is "close" i.e. cheap to access
	HasStorageLocally(context.Context, model.StorageSpec) (bool, error)

	// A BidStrategy that should return a positive response if the executor
	// could run the job or a negative response otherwise.
	GetBidStrategy(context.Context) (bidstrategy.BidStrategy, error)

	//    tells us how much storage the given volume would consume
	//    which we then use to calculate if there is capacity
	//    alongside cpu & memory usage
	GetVolumeSize(context.Context, model.StorageSpec) (uint64, error)

	// GetOutputStream retrieves a muxed stream from the executor
	GetOutputStream(ctx context.Context, executionID string, withHistory bool, follow bool) (io.ReadCloser, error)

	// run the given job - it's expected that we have already prepared the job
	// this will return a local filesystem path to the jobs results
	Run(
		ctx context.Context,
		executionID string,
		job model.Job,
		resultsDir string,
	) (*model.RunCommandResult, error)
}

Executor represents an execution provider, which can execute jobs on some kind of backend, such as a docker daemon.

type ExecutorProvider

type ExecutorProvider interface {
	model.Provider[model.Engine, Executor]
}

Returns a executor for the given engine type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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