workloadscheduler

package
v2.7.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: Apache-2.0 Imports: 23 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

func Module added in v2.2.0

func Module() fx.Option

Module provides the fx options for the workload scheduler.

func SanitizeSchedulerProto added in v2.2.0

func SanitizeSchedulerProto(proto *policylangv1.Scheduler) (*policylangv1.Scheduler, error)

SanitizeSchedulerProto sanitizes the scheduler proto.

Types

type Factory

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

Factory is a factory for creating load schedulers.

func (*Factory) GetLatencyObserver added in v2.2.0

func (wsFactory *Factory) GetLatencyObserver(labels map[string]string) prometheus.Observer

GetLatencyObserver returns a latency observer for a given workload.

func (*Factory) GetRequestCounter added in v2.2.0

func (wsFactory *Factory) GetRequestCounter(labels map[string]string) prometheus.Counter

GetRequestCounter returns a request counter for a given workload.

func (*Factory) NewScheduler

func (wsFactory *Factory) NewScheduler(
	clk clockwork.Clock,
	registry status.Registry,
	proto *policylangv1.Scheduler,
	component iface.Component,
	tokenManger scheduler.TokenManager,
	schedulerMetrics *SchedulerMetrics,
) (*Scheduler, error)

NewScheduler returns fx options for the load scheduler fx app.

func (*Factory) NewSchedulerMetrics added in v2.2.0

func (wsFactory *Factory) NewSchedulerMetrics(metricLabels prometheus.Labels) (*SchedulerMetrics, error)

NewSchedulerMetrics creates a new SchedulerMetrics instance.

type Scheduler

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

Scheduler implements load scheduler on the flowcontrol side.

func (*Scheduler) Decide

func (s *Scheduler) Decide(ctx context.Context, labels labels.Labels) iface.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 (s *Scheduler) GetEstimatedTokens(workloadIndex string) (uint64, bool)

GetEstimatedTokens returns estimated tokens for specific workload.

func (*Scheduler) GetLatencyObserver

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

GetLatencyObserver returns histogram for specific workload.

func (*Scheduler) GetRequestCounter

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

GetRequestCounter returns request counter for specific workload.

func (*Scheduler) Info added in v2.2.0

func (s *Scheduler) Info() (time.Time, int)

Info returns information about the scheduler.

func (*Scheduler) Revert

func (s *Scheduler) Revert(ctx context.Context, labels labels.Labels, decision *flowcontrolv1.LimiterDecision)

Revert reverts the decision made by the limiter.

func (*Scheduler) SetEstimatedTokens

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

SetEstimatedTokens sets estimated tokens for specific workload.

type SchedulerMetrics added in v2.2.0

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

SchedulerMetrics is a struct that holds all metrics for Scheduler.

func (*SchedulerMetrics) Delete added in v2.2.0

func (metrics *SchedulerMetrics) Delete() error

Delete removes all metrics from metric vectors.

Jump to

Keyboard shortcuts

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