resource

package
v0.0.0-...-b359386 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTempDiskSize int64 = 100 * units.MiB

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

func Parse

func Parse(limits []string) (Resources, error)

func ParseCSV

func ParseCSV(limits string) (Resources, error)

func (Resources) SetLimit

func (r Resources) SetLimit(typ Type, size int64)

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"

	// TypeTempDisk specifies the available disk space in bytes of the
	// temporary root disk of the container.
	TypeTempDisk = "temp_disk"

	// 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