workloadscheduler

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

MetricLabelKeys is an array of Label Keys for WFQ and Token Bucket Metrics.

Functions

This section is empty.

Types

type Factory

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

Factory is a factory for creating load schedulers.

func NewFactory

func NewFactory(
	lifecycle fx.Lifecycle,
	statusRegistry status.Registry,
	prometheusRegistry *prometheus.Registry,
) (*Factory, error)

NewFactory sets up the load scheduler module in the main fx app.

func (*Factory) NewScheduler

func (wsFactory *Factory) NewScheduler(
	registry status.Registry,
	proto *policylangv1.Scheduler,
	component iface.Component,
	tokenManger scheduler.TokenManager,
	clock clockwork.Clock,
	metricLabels prometheus.Labels,
) (*Scheduler, error)

NewScheduler returns fx options for the load scheduler fx app.

type Scheduler

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

Scheduler implements load scheduler on the flowcontrol side.

func (*Scheduler) Close

func (ws *Scheduler) Close() error

Close closes the scheduler.

func (*Scheduler) Decide

func (ws *Scheduler) Decide(ctx context.Context,
	labels map[string]string,
) *flowcontrolv1.LimiterDecision

Decide processes a single flow by load scheduler in a blocking manner.

Context is used to ensure that requests are not scheduled for longer than its deadline allows.

func (*Scheduler) GetEstimatedTokens

func (ws *Scheduler) GetEstimatedTokens(workloadIndex string) (uint64, bool)

GetEstimatedTokens returns estimated tokens for specific workload.

func (*Scheduler) GetLatencyObserver

func (ws *Scheduler) GetLatencyObserver(labels map[string]string) prometheus.Observer

GetLatencyObserver returns histogram for specific workload.

func (*Scheduler) GetRequestCounter

func (ws *Scheduler) GetRequestCounter(labels map[string]string) prometheus.Counter

GetRequestCounter returns request counter for specific workload.

func (*Scheduler) Revert

func (ws *Scheduler) Revert(labels map[string]string, decision *flowcontrolv1.LimiterDecision)

Revert reverts the decision made by the limiter.

func (*Scheduler) SetEstimatedTokens

func (ws *Scheduler) SetEstimatedTokens(tokensByWorkloadIndex map[string]uint64)

SetEstimatedTokens sets estimated tokens for specific workload.

Jump to

Keyboard shortcuts

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