recommender

package
v1.49.20 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: Apache-2.0 Imports: 19 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 ExternalRecommender added in v1.49.16

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

func NewExternalRecommender added in v1.49.16

func NewExternalRecommender(client client.Client, recommendationProcessor RecommendationProcessor) *ExternalRecommender

func (*ExternalRecommender) Name added in v1.49.16

func (e *ExternalRecommender) Name() string

func (*ExternalRecommender) Recommend added in v1.49.16

func (e *ExternalRecommender) Recommend(ctx context.Context, workloadState *workload.State) (*RecResult, error)

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
	UpdateThreshold            float64
	MinVRAMResourcesRatio      float64
	MaxVRAMResourcesRatio      float64
	MinComputeResourcesRatio   float64
	MaxComputeResourcesRatio   float64
}

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 float64

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 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 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