utilities

package
v0.0.0-...-26f96f3 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPerHostResourceAvailability

func GetPerHostResourceAvailability() map[string]*ResourceCount

Retrieve resource availability for each host in the cluster.

func RecordTotalResourceAvailability

func RecordTotalResourceAvailability(offers []*mesos.Offer)

Determine the total available resources from the first round of mesos resource offers.

func ResourceAvailabilityUpdate

func ResourceAvailabilityUpdate(scenario string, taskID mesos.TaskID, slaveID mesos.SlaveID) error

Updating cluster resource availability based on the given scenario.

Types

type Pair

type Pair struct {
	Key   string
	Value float64
}

Utility struct that helps in sorting map[string]float64 by value.

type PairList

type PairList []Pair

A slice of pairs that implements the sort.Interface to sort by value.

func GetPairList

func GetPairList(m map[string]float64) PairList

Convert map[string]float64 to PairList.

func (PairList) Len

func (plist PairList) Len() int

Get the length of the pairlist.

func (PairList) Less

func (plist PairList) Less(i, j int) bool

Compare two elements in pairlist.

func (PairList) Swap

func (plist PairList) Swap(i, j int)

Swap pairs in the PairList.

type ResourceCount

type ResourceCount struct {
	// Total resources available.
	TotalCPU   float64
	TotalRAM   float64
	TotalWatts float64

	// Resources currently unused.
	UnusedCPU   float64
	UnusedRAM   float64
	UnusedWatts float64
}

Maintain information regarding the usage of the cluster resources. This information is maintained for each node in the cluster.

func GetClusterwideResourceAvailability

func GetClusterwideResourceAvailability() ResourceCount

Retrieve clusterwide resource availability.

func (*ResourceCount) DecrUnusedResources

func (rc *ResourceCount) DecrUnusedResources(tr def.TaskResources)

Decrement unused resources.

func (*ResourceCount) IncrUnusedResources

func (rc *ResourceCount) IncrUnusedResources(tr def.TaskResources)

Increment unused resources.

type TrackResourceUsage

type TrackResourceUsage struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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