Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrContainerCreate = errors.New("container create error") ErrContainerStart = errors.New("container start error") ErrContainerReady = errors.New("ready wait timeout") ErrContainerBusy = errors.New("container is already in use") ErrContainerDoesNotExist = errors.New("container does not exist") ErrStdoutChannelNotSet = errors.New("stdout channel is not set") )
Functions ¶
This section is empty.
Types ¶
type ConsumedResources ¶
type ContainerManager ¶
type ContainerManager interface {
ImageExist(name string) error
FindContainers(name string) ([]string, error)
ContainerExist(containerID string) bool
WaitForIdle(containerID string, timeout time.Duration) error
CreateAndRunContainer(setup *ContainerSetup) (string, error)
StopContainer(containerID string, force bool)
Execute(containerID string, commands []string, pipe ContainerPipe, limits RuntimeLimits) (int, error) // TODO: return consumed resources!
Stats() map[string]string
}
ContainerManager defines a container manager interface
func New ¶
func New(logger log.MetaLogger) (ContainerManager, error)
New returns an instance of the container manager
type ContainerPipe ¶
type ContainerPipe struct {
StdIn chan []byte
StdOut chan []byte
StdErr chan []byte
Consumed chan ConsumedResources // channel is written by executor after the streaming has stopped or the container is stopped
}
ContainerPipe defines a channel for reading data from container's stdout/stderr and, optionally, write data into container's stdin
type ContainerSetup ¶
type ContainerSetup struct {
Image string
DefaultCmd bool // true for running the container with its own built-in Docker CMD
ReadyString string // set a substring to look for in container logs which signals that the container is ready
ReadyTimeout time.Duration // timeout for looking for ReadyString in container logs. Default is `defaultReadyTimeout`
WorkingDir string // absolute host directory mounted as /home/dummy/
WorkingDirRO bool
CacheVolume []string
CacheVolumeMount []string
Envs map[string]string
Label string // {compiler|runner}-{lang}-{version}
Resources
}
ContainerSetup defines the image and its settings to run the container
Click to show internal directories.
Click to hide internal directories.