Documentation
¶
Index ¶
- type ScaleDecider
- func (s *ScaleDecider) CalculateInstanceStates()
- func (s *ScaleDecider) CalculateNumInstancesToLaunch() int
- func (s *ScaleDecider) FindInstancesToTerminate() sproto.TerminateDecision
- func (s *ScaleDecider) RecordInstanceStats(slots int) error
- func (s *ScaleDecider) UpdateInstanceSnapshot(instances []*model.Instance) bool
- func (s *ScaleDecider) UpdateInstancesEndStats(instIDs []string) error
- func (s *ScaleDecider) UpdateScalingInfo(info *sproto.ScalingInfo)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ScaleDecider ¶
type ScaleDecider struct {
// contains filtered or unexported fields
}
ScaleDecider makes decisions based on the following assumptions:
- All pending tasks cannot fit into all agents when receiving the snapshots from the scheduler, i.e. we need to launch new agents to fit the pending tasks.
- All tasks, agents, and instances don't have empty identifiers.
- All tasks, agents, and instances are not duplicated.
ScaleDecider ignores the agents that cannot be associated with any instances. ScaleDecider considers the following two cases:
- Instances that can be associated with agents.
- Instances that cannot be associated with agents. There are several possible causes: a. The provider is starting up the instances. b. The instances are already running but agents on them are starting up. c. The agents are disconnected to the master due to misconfiguration or some unknown reason.
func New ¶
func New( resourcePool string, maxIdlePeriod, maxStartingPeriod, maxDisconnectPeriod time.Duration, minInstanceNum int, maxInstanceNum int, db db.DB, ) *ScaleDecider
New creates a new scale decider.
func (*ScaleDecider) CalculateInstanceStates ¶
func (s *ScaleDecider) CalculateInstanceStates()
CalculateInstanceStates calculates the instance states.
func (*ScaleDecider) CalculateNumInstancesToLaunch ¶
func (s *ScaleDecider) CalculateNumInstancesToLaunch() int
CalculateNumInstancesToLaunch calculates the number of instances to launch.
func (*ScaleDecider) FindInstancesToTerminate ¶
func (s *ScaleDecider) FindInstancesToTerminate() sproto.TerminateDecision
FindInstancesToTerminate finds instances to terminate.
func (*ScaleDecider) RecordInstanceStats ¶
func (s *ScaleDecider) RecordInstanceStats(slots int) error
RecordInstanceStats records the instance stats.
func (*ScaleDecider) UpdateInstanceSnapshot ¶
func (s *ScaleDecider) UpdateInstanceSnapshot(instances []*model.Instance) bool
UpdateInstanceSnapshot updates the instance snapshot.
func (*ScaleDecider) UpdateInstancesEndStats ¶
func (s *ScaleDecider) UpdateInstancesEndStats(instIDs []string) error
UpdateInstancesEndStats updates the instance end stats.
func (*ScaleDecider) UpdateScalingInfo ¶
func (s *ScaleDecider) UpdateScalingInfo(info *sproto.ScalingInfo)
UpdateScalingInfo updates the scaling information.
Click to show internal directories.
Click to hide internal directories.