scheduler

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2016 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package scheduler provides the core interface that Empire uses when interacting with a cluster of machines to run tasks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Env added in v0.10.1

func Env(app *App, process *Process) map[string]string

Env merges the App environment with any environment variables provided in the process.

func Labels added in v0.10.1

func Labels(app *App, process *Process) map[string]string

Labels merges the App labels with any labels provided in the process.

Types

type App

type App struct {
	// The id of the app.
	ID string

	// An identifier that represents the version of this release.
	Release string

	// The name of the app.
	Name string

	// The application environment.
	Env map[string]string

	// The application labels.
	Labels map[string]string

	// Process that belong to this app.
	Processes []*Process
}

type AttachedRunner

type AttachedRunner struct {
	Scheduler
	Runner *runner.Runner
}

AttachedRunner wraps a Manager to run attached processes using docker directly to get access to stdin and stdout.

func (*AttachedRunner) Run

func (m *AttachedRunner) Run(ctx context.Context, app *App, p *Process, in io.Reader, out io.Writer) error

type Exposure

type Exposure struct {
	// External means that this process will be exposed to internet facing
	// traffic, as opposed to being internal. How this is used is
	// implementation specific. For ECS, this means that the attached ELB
	// will be "internet-facing".
	External bool

	// The exposure type (e.g. HTTPExposure, HTTPSExposure, TCPExposure).
	Type ExposureType
}

Exposure controls the exposure settings for a process.

type ExposureType added in v0.10.1

type ExposureType interface {
	Protocol() string
}

Exposure represents a service that a process exposes, like HTTP/HTTPS/TCP or SSL.

type FakeScheduler

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

func NewFakeScheduler

func NewFakeScheduler() *FakeScheduler

func (*FakeScheduler) Instances

func (m *FakeScheduler) Instances(ctx context.Context, appID string) ([]*Instance, error)

func (*FakeScheduler) Remove

func (m *FakeScheduler) Remove(ctx context.Context, appID string) error

func (*FakeScheduler) Run

func (m *FakeScheduler) Run(ctx context.Context, app *App, p *Process, in io.Reader, out io.Writer) error

func (*FakeScheduler) Scale

func (m *FakeScheduler) Scale(ctx context.Context, app string, ptype string, instances uint) error

func (*FakeScheduler) Stop

func (m *FakeScheduler) Stop(ctx context.Context, instanceID string) error

func (*FakeScheduler) Submit

func (m *FakeScheduler) Submit(ctx context.Context, app *App) error

type HTTPExposure added in v0.10.1

type HTTPExposure struct{}

HTTPExposure represents an HTTP exposure.

func (*HTTPExposure) Protocol added in v0.10.1

func (e *HTTPExposure) Protocol() string

type HTTPSExposure added in v0.10.1

type HTTPSExposure struct {
	// The certificate to attach to the process.
	Cert string
}

HTTPSExposure represents an HTTPS exposure

func (*HTTPSExposure) Protocol added in v0.10.1

func (e *HTTPSExposure) Protocol() string

type Instance

type Instance struct {
	Process *Process

	// The instance ID.
	ID string

	// The State that this Instance is in.
	State string

	// The time that this instance was last updated.
	UpdatedAt time.Time
}

Instance represents an Instance of a Process.

type Process

type Process struct {
	// The type of process.
	Type string

	// The Image to run.
	Image image.Image

	// The Command to run.
	Command []string

	// Environment variables to set.
	Env map[string]string

	// Labels to set on the container.
	Labels map[string]string

	// Exposure is the level of exposure for this process.
	Exposure *Exposure

	// Instances is the desired instances of this service to run.
	Instances uint

	// The amount of RAM to allocate to this process in bytes.
	MemoryLimit uint

	// The amount of CPU to allocate to this process, out of 1024. Maps to
	// the --cpu-shares flag for docker.
	CPUShares uint

	// ulimit -u
	Nproc uint
}

type Runner

type Runner interface {
	// Run runs a process.
	Run(ctx context.Context, app *App, process *Process, in io.Reader, out io.Writer) error
}

type Scaler

type Scaler interface {
	// Scale scales an app process.
	Scale(ctx context.Context, app string, process string, instances uint) error
}

type Scheduler

type Scheduler interface {
	Scaler
	Runner

	// Submit submits an app, creating it or updating it as necessary.
	Submit(context.Context, *App) error

	// Remove removes the App.
	Remove(ctx context.Context, app string) error

	// Instance lists the instances of a Process for an app.
	Instances(ctx context.Context, app string) ([]*Instance, error)

	// Stop stops an instance. The scheduler will automatically start a new
	// instance.
	Stop(ctx context.Context, instanceID string) error
}

Scheduler is an interface for interfacing with Services.

Directories

Path Synopsis
Package cloudformation implements the Scheduler interface for ECS by using CloudFormation to provision and update resources.
Package cloudformation implements the Scheduler interface for ECS by using CloudFormation to provision and update resources.
Package docker implements the Scheduler interface backed by the Docker API.
Package docker implements the Scheduler interface backed by the Docker API.
ecs
Pacakge ecs provides an implementation of the Scheduler interface that uses Amazon EC2 Container Service.
Pacakge ecs provides an implementation of the Scheduler interface that uses Amazon EC2 Container Service.
lb
package lb provides an abstraction around creating load balancers.
package lb provides an abstraction around creating load balancers.
Package kubernetes implements the Scheduler interface backed by Kubernetes.
Package kubernetes implements the Scheduler interface backed by Kubernetes.

Jump to

Keyboard shortcuts

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