executor

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2016 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DestroyCgroup added in v0.3.0

func DestroyCgroup(groups *cgroupConfig.Cgroup) error

destroyCgroup kills all processes in the cgroup and removes the cgroup configuration from the host.

Types

type ExecCommand added in v0.3.0

type ExecCommand struct {
	Cmd  string
	Args []string
}

ExecCommand holds the user command and args. It's a lightweight replacement of exec.Cmd for serialization purposes.

type Executor

type Executor interface {
	LaunchCmd(command *ExecCommand, ctx *ExecutorContext) (*ProcessState, error)
	Wait() (*ProcessState, error)
	ShutDown() error
	Exit() error
	UpdateLogConfig(logConfig *structs.LogConfig) error
}

Executor is the interface which allows a driver to launch and supervise a process

func NewExecutor

func NewExecutor(logger *log.Logger) Executor

NewExecutor returns an Executor

type ExecutorContext added in v0.3.0

type ExecutorContext struct {
	// TaskEnv holds information about the environment of a Task
	TaskEnv *env.TaskEnvironment

	// AllocDir is the handle to do operations on the alloc dir of
	// the task
	AllocDir *allocdir.AllocDir

	// TaskName is the name of the Task
	TaskName string

	// TaskResources are the resource constraints for the Task
	TaskResources *structs.Resources

	// FSIsolation is a flag for drivers to impose file system
	// isolation on certain platforms
	FSIsolation bool

	// ResourceLimits is a flag for drivers to impose resource
	// contraints on a Task on certain platforms
	ResourceLimits bool

	// UnprivilegedUser is a flag for drivers to make the process
	// run as nobody
	UnprivilegedUser bool

	// LogConfig provides the configuration related to log rotation
	LogConfig *structs.LogConfig
}

ExecutorContext holds context to configure the command user wants to run and isolate it

type ProcessState added in v0.3.0

type ProcessState struct {
	Pid             int
	ExitCode        int
	Signal          int
	IsolationConfig *cstructs.IsolationConfig
	Time            time.Time
}

ProcessState holds information about the state of a user process.

type UniversalExecutor added in v0.3.0

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

UniversalExecutor is an implementation of the Executor which launches and supervises processes. In addition to process supervision it provides resource and file system isolation

func (*UniversalExecutor) Exit added in v0.3.0

func (e *UniversalExecutor) Exit() error

Exit cleans up the alloc directory, destroys cgroups and kills the user process

func (*UniversalExecutor) LaunchCmd added in v0.3.0

func (e *UniversalExecutor) LaunchCmd(command *ExecCommand, ctx *ExecutorContext) (*ProcessState, error)

LaunchCmd launches a process and returns it's state. It also configures an applies isolation on certain platforms.

func (*UniversalExecutor) ShutDown added in v0.3.0

func (e *UniversalExecutor) ShutDown() error

Shutdown sends an interrupt signal to the user process

func (*UniversalExecutor) UpdateLogConfig added in v0.3.0

func (e *UniversalExecutor) UpdateLogConfig(logConfig *structs.LogConfig) error

UpdateLogConfig updates the log configuration

func (*UniversalExecutor) Wait added in v0.3.0

func (e *UniversalExecutor) Wait() (*ProcessState, error)

Wait waits until a process has exited and returns it's exitcode and errors

Jump to

Keyboard shortcuts

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