lifecycle

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContainerSigQuitGracePeriod = 5 * time.Second
	ContainerStatePollInterval  = 1 * time.Second
	ContainerStateRunning       = "running"
	ContainerStatePaused        = "paused"
	ContainerStateStopped       = "stopped"
)

Variables

View Source
var TimeoutError = errors.New("failed to stop job within timeout")

Functions

This section is empty.

Types

type CommandRunner

type CommandRunner interface {
	Run(*exec.Cmd) error
}

func NewCommandRunner

func NewCommandRunner() CommandRunner

type RuncAdapter

type RuncAdapter interface {
	CreateJobPrerequisites(bpmCfg *config.BPMConfig, procCfg *config.ProcessConfig, user specs.User) (*os.File, *os.File, error)
	BuildSpec(bpmCfg *config.BPMConfig, procCfg *config.ProcessConfig, user specs.User) (specs.Spec, error)
}

type RuncClient

type RuncClient interface {
	CreateBundle(bundlePath string, jobSpec specs.Spec, user specs.User) error
	RunContainer(pidFilePath, bundlePath, containerID string, stdout, stderr io.Writer) error
	Exec(containerID, command string, stdin io.Reader, stdout, stderr io.Writer) error
	ContainerState(containerID string) (*specs.State, error)
	ListContainers() ([]client.ContainerState, error)
	SignalContainer(containerID string, signal client.Signal) error
	DeleteContainer(containerID string) error
	DestroyBundle(bundlePath string) error
}

type RuncLifecycle

type RuncLifecycle struct {
	// contains filtered or unexported fields
}

func NewRuncLifecycle

func NewRuncLifecycle(
	runcClient RuncClient,
	runcAdapter RuncAdapter,
	userFinder UserFinder,
	commandRunner CommandRunner,
	clock clock.Clock,
) *RuncLifecycle

func (*RuncLifecycle) GetProcess

func (j *RuncLifecycle) GetProcess(cfg *config.BPMConfig) (*models.Process, error)

GetProcess returns the following: - process, nil if the process is running (and no errors were encountered) - nil,nil if the process is not running and there is no other error - nil,error if there is any other error getting the process beyond it not running

func (*RuncLifecycle) ListProcesses

func (j *RuncLifecycle) ListProcesses() ([]models.Process, error)

func (*RuncLifecycle) OpenShell

func (j *RuncLifecycle) OpenShell(cfg *config.BPMConfig, stdin io.Reader, stdout, stderr io.Writer) error

func (*RuncLifecycle) RemoveProcess

func (j *RuncLifecycle) RemoveProcess(cfg *config.BPMConfig) error

func (*RuncLifecycle) StartProcess

func (j *RuncLifecycle) StartProcess(bpmCfg *config.BPMConfig, procCfg *config.ProcessConfig) error

func (*RuncLifecycle) StopProcess

func (j *RuncLifecycle) StopProcess(logger lager.Logger, cfg *config.BPMConfig, exitTimeout time.Duration) error

type UserFinder

type UserFinder interface {
	Lookup(username string) (specs.User, error)
}

Jump to

Keyboard shortcuts

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