Documentation ¶
Index ¶
- func FilterMesosResources(rs []*mesos.Resource, filter func(*mesos.Resource) bool) (matched []*mesos.Resource, unmatched []*mesos.Resource)
- func FilterRevocableMesosResources(rs []*mesos.Resource) (revocable []*mesos.Resource, nonRevocable []*mesos.Resource)
- func FromOfferToMesosResources(offer *mesos.Offer) []*mesos.Resource
- func FromOffersMapToMesosResources(offerMap map[string]*mesos.Offer) []*mesos.Resource
- func HasResourceType(agentRes, reqRes Resources, resourceType string) bool
- func ToPelotonResources(rs Resources) *peloton.Resources
- type AtomicResources
- type Resources
- func FromMesosResource(resource *mesos.Resource) (r Resources)
- func FromMesosResources(resources []*mesos.Resource) (r Resources)
- func FromOffer(offer *mesos.Offer) Resources
- func FromOfferMap(offerMap map[string]*mesos.Offer) (r Resources)
- func FromOffers(offers []*mesos.Offer) (r Resources)
- func FromPelotonResources(rp *peloton.Resources) (r Resources)
- func FromPodSpec(podspec *pbpod.PodSpec) (r Resources)
- func FromResourceConfig(rc *task.ResourceConfig) (r Resources)
- func FromResourceSpec(rc *pbpod.ResourceSpec) (r Resources)
- func Minimum(r1, r2 Resources) (m Resources)
- func (r Resources) Add(other Resources) Resources
- func (r Resources) Compare(other Resources, cmpLess bool) bool
- func (r Resources) Contains(other Resources) bool
- func (r Resources) Empty() bool
- func (r Resources) GetCPU() float64
- func (r Resources) GetDisk() float64
- func (r Resources) GetGPU() float64
- func (r Resources) GetMem() float64
- func (r Resources) HasGPU() bool
- func (r Resources) NonEmptyFields() []string
- func (r Resources) String() string
- func (r Resources) Subtract(other Resources) Resources
- func (r Resources) TrySubtract(other Resources) (Resources, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterMesosResources ¶
func FilterMesosResources(rs []*mesos.Resource, filter func(*mesos.Resource) bool) ( matched []*mesos.Resource, unmatched []*mesos.Resource)
FilterMesosResources separates Mesos resources slice into matched and unmatched ones.
func FilterRevocableMesosResources ¶
func FilterRevocableMesosResources(rs []*mesos.Resource) ( revocable []*mesos.Resource, nonRevocable []*mesos.Resource)
FilterRevocableMesosResources separates revocable resources and non-revocable resources
func FromOfferToMesosResources ¶
FromOfferToMesosResources returns list of resources from a single offer
func FromOffersMapToMesosResources ¶
FromOffersMapToMesosResources returns list of resources from a offerMap
func HasResourceType ¶
HasResourceType validates requested resource type is present agent resource type.
func ToPelotonResources ¶
ToPelotonResources creates a new instance of `peloton.Resources` from `Resources`
Types ¶
type AtomicResources ¶
AtomicResources is a wrapper around `Resources` provide thread safety.
func (*AtomicResources) Get ¶
func (a *AtomicResources) Get() Resources
Get returns a copy of current value.
type Resources ¶
Resources is a non-thread safe helper struct holding recognized resources.
func FromMesosResource ¶
FromMesosResource returns the scalar Resources from a single Mesos resource object.
func FromMesosResources ¶
FromMesosResources returns the scalar Resources from a list of Mesos resource objects.
func FromOfferMap ¶
FromOfferMap returns the scalar Resources from given id to offer map.
func FromOffers ¶
FromOffers returns the scalar Resources from given offers
func FromPelotonResources ¶
FromResourceSpec creates a new instance of `Resources` from `peloton.Resources`
func FromPodSpec ¶
FromPodSpec creates a new instance of `Resources` from a `PodSpec`
func FromResourceConfig ¶
func FromResourceConfig(rc *task.ResourceConfig) (r Resources)
FromResourceConfig creates a new instance of `Resources` from a `ResourceConfig`.
func FromResourceSpec ¶
func FromResourceSpec(rc *pbpod.ResourceSpec) (r Resources)
FromResourceSpec creates a new instance of `Resources` from a `ResourceSpec`
func (Resources) Compare ¶
Compare method compares current Resources with the other one, return true if current Resources is strictly larger than or equal to / less than the other one (based on boolean cmpLess), false if not. Fields in the other one are ignore if they are 0.
func (Resources) Contains ¶
Contains determines whether current Resources is large enough to contain the other one.
func (Resources) NonEmptyFields ¶
NonEmptyFields returns corresponding Mesos resource names for fields which are not empty.