Documentation ¶
Index ¶
- Constants
- Variables
- type Executor
- func (e *Executor) Cancel(ctx context.Context, executionID string) error
- func (e *Executor) FindRunningContainer(ctx context.Context, executionID string) (string, error)
- func (e *Executor) GetLogStream(ctx context.Context, request executor.LogStreamRequest) (io.ReadCloser, error)
- func (e *Executor) IsInstalled(ctx context.Context) (bool, error)
- func (e *Executor) Run(ctx context.Context, request *executor.RunCommandRequest) (*models.RunCommandResult, error)
- func (e *Executor) ShouldBid(ctx context.Context, request bidstrategy.BidStrategyRequest) (bidstrategy.BidStrategyResponse, error)
- func (e *Executor) ShouldBidBasedOnUsage(ctx context.Context, request bidstrategy.BidStrategyRequest, ...) (bidstrategy.BidStrategyResponse, error)
- func (e *Executor) Shutdown(ctx context.Context) error
- func (e *Executor) Start(ctx context.Context, request *executor.RunCommandRequest) error
- func (e *Executor) Wait(ctx context.Context, executionID string) (<-chan *models.RunCommandResult, <-chan error)
Constants ¶
const NanoCPUCoefficient = 1000000000
Variables ¶
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.DockerCacheConfig, ) (*Executor, error)
func (*Executor) Cancel ¶ added in v1.0.4
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
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 ¶
IsInstalled checks if docker itself is installed.
func (*Executor) Run ¶ added in v0.3.24
func (e *Executor) Run( ctx context.Context, request *executor.RunCommandRequest, ) (*models.RunCommandResult, error)
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 (e *Executor) ShouldBid( ctx context.Context, request bidstrategy.BidStrategyRequest, ) (bidstrategy.BidStrategyResponse, error)
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) Start ¶ added in v1.0.4
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.