resource

package
v0.0.0-...-1d4c075 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2016 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatLimit

func FormatLimit(typ Type, limit int64) string

func ParseLimit

func ParseLimit(typ Type, s string) (int64, error)

func SetDefaults

func SetDefaults(r *Resources)

Types

type Resources

type Resources map[Type]Spec

func Defaults

func Defaults() Resources

type Spec

type Spec struct {
	// Request, if set, is the amount of resource a job expects to consume,
	// so the job should only be placed on a host with at least this amount
	// of resource available, and once scheduled this amount of resource
	// should then be unavailable on the given host.
	Request *int64 `json:"request"`

	// Limit, if set, is an upper limit on the amount of resource a job can
	// consume, the outcome of hitting this limit being implementation
	// defined (e.g. a system error, throttling, catchable / uncatchable
	// signals etc.)
	Limit *int64 `json:"limit"`
}

type Type

type Type string
const (
	// TypeMemory specifies the available memory in bytes inside a container.
	TypeMemory Type = "memory"

	// TypeCPU specifies the amount of milliCPU requested. A milliCPU is
	// conceptually 1/1000 of a CPU core (eg 500m is half of a CPU core). In
	// practice, a 1000 milliCPU limit is equivalent to 1024 CPU shares.
	TypeCPU Type = "cpu"

	// TypeMaxFD specifies a value one greater than the maximum file
	// descriptor number that can be opened inside a container.
	TypeMaxFD Type = "max_fd"

	// TypeMaxProcs specifies the maximum number of processes which can
	// be started inside a container.
	TypeMaxProcs Type = "max_procs"
)

func ToType

func ToType(s string) (Type, bool)

Jump to

Keyboard shortcuts

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