recommender

package
v1.46.3 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxResourceAmount is the maximum allowed value of resource amount.
	MaxResourceAmount = ResourceAmount(1e14)
)

Variables

This section is empty.

Functions

func GetRecommendation

func GetRecommendation(ctx context.Context, workload *workload.State, recommenders []Interface) (*tfv1.Resources, error)

func QuantityFromAmount

func QuantityFromAmount(amount ResourceAmount, format resource.Format) resource.Quantity

Types

type CronRecommender

type CronRecommender struct {
	// contains filtered or unexported fields
}

func NewCronRecommender

func NewCronRecommender(recommendationProcessor RecommendationProcessor) *CronRecommender

func (*CronRecommender) Name

func (c *CronRecommender) Name() string

func (*CronRecommender) Recommend

func (c *CronRecommender) Recommend(ctx context.Context, w *workload.State) (*RecResult, error)

type EstimatedResources

type EstimatedResources struct {
	LowerBoundTflops resource.Quantity
	TargetTflops     resource.Quantity
	UpperBoundTflops resource.Quantity
	LowerBoundVram   resource.Quantity
	TargetVram       resource.Quantity
	UpperBoundVram   resource.Quantity
}

type Interface

type Interface interface {
	Name() string
	Recommend(ctx context.Context, workload *workload.State) (*RecResult, error)
}

Interface defines the contract for resource recommendation strategies used by the autoscaler.

type PercentileConfig

type PercentileConfig struct {
	TargetTflopsPercentile     float64
	LowerBoundTflopsPercentile float64
	UpperBoundTflopsPercentile float64
	TargetVramPercentile       float64
	LowerBoundVramPercentile   float64
	UpperBoundVramPercentile   float64
	RequestMarginFraction      float64
	ConfidenceInterval         time.Duration
}

type PercentileRecommender

type PercentileRecommender struct {
	ResourcesEstimator
	// contains filtered or unexported fields
}

func NewPercentileRecommender

func NewPercentileRecommender(recommendationProcessor RecommendationProcessor) *PercentileRecommender

func (*PercentileRecommender) Name

func (p *PercentileRecommender) Name() string

func (*PercentileRecommender) Recommend

func (p *PercentileRecommender) Recommend(ctx context.Context, workload *workload.State) (*RecResult, error)

type RecResult

type RecResult struct {
	Resources        tfv1.Resources
	HasApplied       bool
	ScaleDownLocking bool
}

type RecommendationProcessor

type RecommendationProcessor interface {
	Apply(ctx context.Context, workload *workload.State, recommendation *tfv1.Resources) (tfv1.Resources, string, error)
}

func NewRecommendationProcessor

func NewRecommendationProcessor(workloadHandler workload.Handler) RecommendationProcessor

type ResourceAmount

type ResourceAmount int64

func ResourceAmountMax

func ResourceAmountMax(amount1, amount2 ResourceAmount) ResourceAmount

ResourceAmountMax returns the larger of two resource amounts.

type ResourcesEstimator

type ResourcesEstimator interface {
	GetResourcesEstimation(*workload.State) *EstimatedResources
}

type TflopsEstimator

type TflopsEstimator interface {
	GetTflopsEstimation(w *metrics.WorkerUsageAggregator) ResourceAmount
}

func NewPercentileTflopsEstimator

func NewPercentileTflopsEstimator(percentile float64) TflopsEstimator

NewPercentileTflopsEstimator returns a new percentileTflopsEstimator that uses provided percentile.

func WithTflopsConfidenceMultiplier

func WithTflopsConfidenceMultiplier(multiplier, exponent float64, baseEstimator TflopsEstimator, confidenceInterval time.Duration) TflopsEstimator

WithTflopsConfidenceMultiplier returns a TflopsEstimator that scales the

func WithTflopsMargin

func WithTflopsMargin(marginFraction float64, baseEstimator TflopsEstimator) TflopsEstimator

WithTflopsMargin returns a tflopsEstimator that adds a margin to the base estimator.

type VramEstimator

type VramEstimator interface {
	GetVramEstimation(w *metrics.WorkerUsageAggregator) ResourceAmount
}

func NewPercentileVramEstimator

func NewPercentileVramEstimator(percentile float64) VramEstimator

NewPercentileVramEstimator returns a new percentileVramEstimator that uses provided percentile.

func WithVramConfidenceMultiplier

func WithVramConfidenceMultiplier(multiplier, exponent float64, baseEstimator VramEstimator, confidenceInterval time.Duration) VramEstimator

WithVramConfidenceMultiplier returns a VramEstimator that scales the

func WithVramMargin

func WithVramMargin(marginFraction float64, baseEstimator VramEstimator) VramEstimator

WithvramMargin returns a vramEstimator that adds a margin to the base estimator.

Jump to

Keyboard shortcuts

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