docker

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const NanoCPUCoefficient = 1000000000

Variables

View Source
var (
	ActiveExecutions = lo.Must(telemetry.NewGauge(
		dockerExecutorMeter,
		"docker_active_executions",
		"Number of active docker executions",
	))
)

Functions

This section is empty.

Types

type Executor

type Executor struct {
	// used to allow multiple docker executors to run against the same docker server
	ID string
	// contains filtered or unexported fields
}

func NewExecutor

func NewExecutor(
	id string,
	dockerCacheCfg types.Docker,
) (*Executor, error)

func (*Executor) Cancel added in v1.0.4

func (e *Executor) Cancel(ctx context.Context, executionID string) error

Cancel tries to cancel a specific execution by its executionID. It returns an error if the execution is not found.

func (*Executor) FindRunningContainer added in v1.1.0

func (e *Executor) FindRunningContainer(ctx context.Context, executionID string) (string, error)

FindRunningContainer, not part of the Executor interface, is a utility function that helps locate a container durin a restart check.

func (*Executor) GetLogStream added in v1.2.2

func (e *Executor) GetLogStream(ctx context.Context, request executor.LogStreamRequest) (io.ReadCloser, error)

GetLogStream provides a stream of output logs for a specific execution. Parameters 'withHistory' and 'follow' control whether to include past logs and whether to keep the stream open for new logs, respectively. It returns an error if the execution is not found.

func (*Executor) IsInstalled

func (e *Executor) IsInstalled(ctx context.Context) (bool, error)

IsInstalled checks if docker itself is installed.

func (*Executor) Run added in v0.3.24

Run initiates and waits for the completion of an execution in one call. This method serves as a higher-level convenience function that internally calls Start and Wait methods. It returns the result of the execution or an error if either starting or waiting fails, or if the context is canceled.

func (*Executor) ShouldBid added in v1.0.4

func (*Executor) ShouldBidBasedOnUsage added in v1.0.4

func (e *Executor) ShouldBidBasedOnUsage(
	ctx context.Context,
	request bidstrategy.BidStrategyRequest,
	usage models.Resources,
) (bidstrategy.BidStrategyResponse, error)

func (*Executor) Shutdown added in v1.0.4

func (e *Executor) Shutdown(ctx context.Context) error

func (*Executor) Start added in v1.0.4

func (e *Executor) Start(ctx context.Context, request *executor.RunCommandRequest) error

Start initiates an execution based on the provided RunCommandRequest.

func (*Executor) Wait added in v1.0.4

func (e *Executor) Wait(ctx context.Context, executionID string) (<-chan *models.RunCommandResult, <-chan error)

Wait initiates a wait for the completion of a specific execution using its executionID. The function returns two channels: one for the result and another for any potential error. If the executionID is not found, an error is immediately sent to the error channel. Otherwise, an internal goroutine (doWait) is spawned to handle the asynchronous waiting. Callers should use the two returned channels to wait for the result of the execution or an error. This can be due to issues either beginning the wait or in getting the response. This approach allows the caller to synchronize Wait with calls to Start, waiting for the execution to complete.

Directories

Path Synopsis
bidstrategy

Jump to

Keyboard shortcuts

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