Documentation ¶
Index ¶
- Variables
- type Allocation
- type AllocationType
- type Resources
- func (r *Resources) Add(other *Resources) *Resources
- func (r *Resources) Clone() *Resources
- func (r *Resources) Copy(other *Resources)
- func (r *Resources) Equal(other *Resources) bool
- func (r *Resources) Get(kind string) float64
- func (r *Resources) GetCPU() float64
- func (r *Resources) GetDisk() float64
- func (r *Resources) GetGPU() float64
- func (r *Resources) GetMem() float64
- func (r *Resources) LessThanOrEqual(other *Resources) bool
- func (r *Resources) Set(kind string, value float64)
- func (r *Resources) String() string
- func (r *Resources) Subtract(other *Resources) *Resources
Constants ¶
This section is empty.
Variables ¶
var ZeroResource = &Resources{ CPU: float64(0), GPU: float64(0), DISK: float64(0), MEMORY: float64(0), }
ZeroResource represents the minimum Value of a resource
Functions ¶
This section is empty.
Types ¶
type Allocation ¶
type Allocation struct {
Value map[AllocationType]*Resources
}
Allocation is the container to track allocation across different dimensions
func GetGangAllocation ¶
func GetGangAllocation(gang *resmgrsvc.Gang) *Allocation
GetGangAllocation returns the allocation across different dimensions of all tasks in a gang
func GetTaskAllocation ¶
func GetTaskAllocation(rmTask *resmgr.Task) *Allocation
GetTaskAllocation returns the allocation across different dimensions of a task
func (*Allocation) Add ¶
func (a *Allocation) Add(other *Allocation) *Allocation
Add adds one allocation to another
func (*Allocation) GetByType ¶
func (a *Allocation) GetByType(allocationType AllocationType) *Resources
GetByType returns the allocation by type
func (*Allocation) Subtract ¶
func (a *Allocation) Subtract(other *Allocation) *Allocation
Subtract subtracts one allocation to another
type AllocationType ¶
type AllocationType int
AllocationType represents the different allocation dimensions the resource pool can track for admission control
const ( // NonPreemptibleAllocation tracks allocation for non-preemptible tasks NonPreemptibleAllocation AllocationType = iota + 1 // PreemptibleAllocation tracks allocation for preemptible tasks PreemptibleAllocation // ControllerAllocation tracks allocation for controller tasks ControllerAllocation // TotalAllocation tracks the allocation of all tasks( // including NonPreemptibleAllocation,PreemptibleAllocation and ControllerAllocation) TotalAllocation // SlackAllocation track allocation for tasks launched using slack resources. SlackAllocation // NonSlackAllocation track allocation for non-revocable tasks. NonSlackAllocation )
type Resources ¶
Resources is a non-thread safe helper struct holding recognized resources.
func ConvertToResmgrResource ¶
func ConvertToResmgrResource(resource *task.ResourceConfig) *Resources
ConvertToResmgrResource converts task resource config to scalar.Resources
func GetGangResources ¶
GetGangResources aggregates gang resources to resmgr resources
func (*Resources) Clone ¶
Clone creates the new new object of the resources and copies the values to the new object and return the new object
func (*Resources) Copy ¶
Copy copies the values from the passed resource object to the calling object
func (*Resources) LessThanOrEqual ¶
LessThanOrEqual determines current Resources is less than or equal the other one.