Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSlowDown ¶
func NewSlowDown() slowDown
Types ¶
type AutoScale ¶
type AutoScale struct {
// contains filtered or unexported fields
}
func NewAutoScale ¶
func NewAutoScale( ctx context.Context, workQueues WorkQueues, deployments interfaces.Deployments, config Config, time int64, scaleReporter interfaces.ScaleReporter, ) (*AutoScale, error)
type Config ¶
type Config struct { // Jobs maps a job name to its config. Jobs map[string]JobConfig `yaml:"jobs" json:"jobs"` }
func (*Config) GetScaleOrder ¶
type DeploymentTierConfig ¶
type DeploymentTierConfig struct { DeploymentName string `yaml:"deploymentName" json:"deploymentName"` // MinScale is the minimum number of requested workers. MinScale int32 `yaml:"minScale" json:"minScale"` // MaxScale is the maximum number of requested workers. MaxScale int32 `yaml:"maxScale" json:"maxScale"` // WorkersPerPod is the number of workers a single pod in the deployment provides. The number of // workers is divided by this factor before being requested from the underlying deployment. WorkersPerPod int32 `yaml:"workersPerPod" json:"workersPerPod"` // SpinupTime is the time you expect a pod to take to spin-up SpinupTime int32 `yaml:"spinupTime" json:"spinupTime"` TargetTime int32 `yaml:"targetTime" json:"targetTime"` // ManualSlowdownDuration sets the duration of the window for SlowDown. // If 0, this is set automatically based on TargetTime. ManualSlowdownDuration int32 `yaml:"manualSlowdownDuration" json:"manualSlowdownDuration"` // SlowupDuration sets the duration of the window for reversed SlowDown (slow scaling up). // If 0, slowup isn't used. SlowupDuration int64 `yaml:"slowupDuration" json:"slowupDuration"` // FlakyBaseWorkers, if true, indicates that the number of requested base workers shouldn't be // relied upon. That is, the number of actually ready workers should be used instead. This // shouldn't be used without the use of `SlowupDuration` in tendem, otherwise, when base workers // are requested, they will also be requested FlakyBaseWorkers bool `yaml:"flakyBaseWorkers" json:"flakyBaseWorkers"` }
func (*DeploymentTierConfig) SlowdownDuration ¶
func (config *DeploymentTierConfig) SlowdownDuration(jobRunTime, timeout, qlen int32) int64
SlowdownDuration returns the duration of the window for SlowDown.
If not manually specified, this will be longer than the spinup and target time combined, unless qlen is 0, then its shorter, but still at least the spinup time.
type JobConfig ¶
type JobConfig struct { // WorkQueueName is the name of the work queue to scale for. QueueName string `yaml:"queueName" json:"queueName"` // DeploymentTiers of the workers running this job. DeploymentTiers []DeploymentTierConfig `yaml:"deploymentTiers" json:"deploymentTiers"` // RunTime is the average time taken for a job to complete on a single worker. RunTime int32 `yaml:"runTime" json:"runTime"` // Timeout is the time for a job to timeout in the work queue. Timeout int32 `yaml:"timeout" json:"timeout"` // Children is a map of other job names to the average number of jobs of that type spawned by // one job of this type. Children map[string]float32 `yaml:"children" json:"children"` // WorkersPerPod is the number of workers a single pod in the deployment provides. The number of // workers is divided by this factor before being requested from the underlying deployment. This // can be overriden locally by the field of the same name in DeploymentTierConfig. WorkersPerPod int32 `yaml:"workersPerPod" json:"workersPerPod"` // IgnoreAbandoned causes abandoned jobs to be ignored when calculating scale. IgnoreAbandoned bool `yaml:"ignoreAbandoned" json:"ignoreAbandoned"` }
func (*JobConfig) ToJob ¶
func (config *JobConfig) ToJob( ctx context.Context, workQueues WorkQueues, deployments interfaces.Deployments, time int64, ) (job, error)
type WorkQueue ¶
type WorkQueue interface { // Counts returns the number of items in the queue, along with the number of items currently // being processed. The queueLen doesn't include items being processed. Counts(context.Context) (queueLen, processing int32, err error) }
WorkQueue is a generic work queue.
type WorkQueues ¶
WorkQueues is an interface used to get WorkQueue objects by name.
Click to show internal directories.
Click to hide internal directories.