worker

package
v0.7.0-dev.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildContainerLogChannel

func BuildContainerLogChannel(ctx context.Context, client *client.Client, containerID string) (<-chan string, error)

BuildContainerLogChannel accepts a pointer to a Docker client.Client and a container ID and returns a string channel that provides all events from the container's standard output and error streams.

func BuildContainerLogChannels

func BuildContainerLogChannels(ctx context.Context, client *client.Client, containerID string) (stdout, stderr <-chan string, err error)

BuildContainerLogChannels accepts a pointer to a Docker client.Client and a container ID and returns tww string channels, one that provides all events emitted by the container's standard output stream, and a second for standard error.

Types

type Worker

type Worker struct {
	CommandParameters []string
	DockerClient      *client.Client
	DockerHost        string
	EntryPoint        string
	ExitStatus        chan int64
	ExecutionTimeout  time.Duration
	ImageName         string
}

Worker represents a container executor. It has a lifetime of a single command execution.

func NewWorker

func NewWorker(image string, tag string, entryPoint string, commandParams ...string) (*Worker, error)

NewWorker will build and returns a new Worker for a single command execution.

func (*Worker) Start

func (w *Worker) Start(ctx context.Context) (<-chan string, error)

Start triggers a worker to run a container according to its settings. It returns a string channel that emits the container's combined stdout and stderr streams.

func (*Worker) Stopped

func (w *Worker) Stopped() <-chan int64

Stopped returns a channel that blocks until this worker's container has stopped. The value emitted is the exit status code of the underlying process.

Jump to

Keyboard shortcuts

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