Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Resize ¶
func Resize(duts []*inventory.DeviceUnderTest, targetPool string, targetSize int, sparePool string) ([]*fleet.PoolChange, error)
Resize returns the inventory changes required to resize the targetPool to be of targetSize, using sparePool to borrow / return DUTs.
Types ¶
type Balancer ¶
type Balancer struct { Target map[string]fleet.Health Spare map[string]fleet.Health // contains filtered or unexported fields }
Balancer encapsulates the pool balancing algorithm.
Use EnsureTargetHealthy() to execute the pool balancing algorithm on an initialized Balancer.
func NewBalancer ¶
func NewBalancer(duts []*inventory.DeviceUnderTest, target, spare string) (*Balancer, error)
NewBalancer returns an initialized Balancer.
func (*Balancer) EnsureTargetHealthy ¶
func (pb *Balancer) EnsureTargetHealthy(maxUnhealthyDUTs int) ([]*fleet.PoolChange, []fleet.EnsurePoolHealthyResponse_Failure)
EnsureTargetHealthy balances the pools so that target pool has healthy DUTs.
This function returns the recommended changes and also any failures encountered. This function also applies the recommended changes to the Balancer state.
func (*Balancer) FillInHealth ¶
FillInHealth fills in the health info for each DUT.
func (*Balancer) SpareHealthyCount ¶
SpareHealthyCount counts the number of healthy DUTs in the spare pool.
func (*Balancer) TargetHealthyCount ¶
TargetHealthyCount counts the number of healthy DUTs in the target pool.