scheduler

package
v0.0.0-...-a134451 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const MaxExtenderPriority = 10

Variables

View Source
var NeverStop <-chan struct{} = make(chan struct{})

NeverStop may be passed to Until to make it never stop.

Functions

func MakeDefaultErrorFunc

func MakeDefaultErrorFunc(client client.Interface, stageLister listerv1.StageLister, stageQueue queue.SchedulingQueue, schedulerCache cache.Cache) func(*framework.QueuedStageInfo, error)

func NewHTTPExtender

func NewHTTPExtender(config *config.Extender) (framework.Extender, error)

Types

type ExtenderArgs

type ExtenderArgs struct {
	// Stage being scheduled
	Stage *meta.Stage
	// List of candidate workers where the stage can be scheduled; to be populated
	// only if Extender.WorkerCacheCapable == false
	Workers *meta.WorkerList
	// List of candidate worker names where the stage can be scheduled; to be
	// populated only if Extender.WorkerCacheCapable == true
	WorkerNames *[]string
}

ExtenderArgs represents the arguments needed by the extender to filter/prioritize workers for a stage.

type ExtenderBindingResult

type ExtenderBindingResult struct {
	// Error message indicating failure
	Error string
}

ExtenderBindingResult represents the result of binding of a stage to a worker from an extender.

type ExtenderFilterResult

type ExtenderFilterResult struct {
	// Filtered set of workers where the stage can be scheduled; to be populated
	// only if Extender.WorkerCacheCapable == false
	Workers *meta.WorkerList
	// Filtered set of workers where the stage can be scheduled; to be populated
	// only if Extender.WorkerCacheCapable == true
	WorkerNames *[]string
	// Filtered out workers where the stage can't be scheduled and the failure messages
	FailedWorkers FailedWorkersMap
	// Filtered out workers where the stage can't be scheduled and preemption would
	// not change anything. The value is the failure message same as FailedWorkers.
	// Workers specified here takes precedence over FailedWorkers.
	FailedAndUnresolvableWorkers FailedWorkersMap
	// Error message indicating failure
	Error string
}

ExtenderFilterResult represents the results of a filter call to an extender

type ExtenderPreemptionArgs

type ExtenderPreemptionArgs struct {
	// Stage being scheduled
	Stage *meta.Stage
	// Victims map generated by scheduler preemption phase
	// Only set WorkerNameToMetaVictims if Extender.WorkerCacheCapable == true. Otherwise, only set WorkerNameToVictims.
	WorkerNameToVictims     map[string]*Victims
	WorkerNameToMetaVictims map[string]interface{}
}

ExtenderPreemptionArgs represents the arguments needed by the extender to preempt stages on workers.

type ExtenderPreemptionResult

type ExtenderPreemptionResult struct {
	WorkerNameToMetaVictims map[string]interface{}
}

ExtenderPreemptionResult represents the result returned by preemption phase of extender.

type FailedWorkersMap

type FailedWorkersMap map[string]string

FailedWorkersMap represents the filtered out workers, with worker names and failure messages

type FrameworkCapturer

type FrameworkCapturer func(config.Profile)

FrameworkCapturer is used for registering a notify function in building framework.

type HTTPExtender

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

HTTPExtender implements the Extender interface.

func (*HTTPExtender) Bind

func (h *HTTPExtender) Bind(binding *meta.Binding) error

func (*HTTPExtender) Filter

func (h *HTTPExtender) Filter(stage *meta.Stage, workers []*meta.Worker) (filteredWorkers []*meta.Worker, failedWorkersMap map[string]string, failedAndUnresolvable map[string]string, err error)

func (*HTTPExtender) IsBinder

func (h *HTTPExtender) IsBinder() bool

func (*HTTPExtender) IsIgnorable

func (h *HTTPExtender) IsIgnorable() bool

func (*HTTPExtender) IsInterested

func (h *HTTPExtender) IsInterested(stage *meta.Stage) bool

func (*HTTPExtender) Name

func (h *HTTPExtender) Name() string

func (*HTTPExtender) Prioritize

func (h *HTTPExtender) Prioritize(stage *meta.Stage, workers []*meta.Worker) (hostPriorities *framework.HostPriorityList, weight int64, err error)

func (*HTTPExtender) ProcessPreemption

func (h *HTTPExtender) ProcessPreemption(_ *meta.Stage, _ map[string]interface{}, _ interface{}) (map[string]interface{}, error)

func (*HTTPExtender) SupportsPreemption

func (h *HTTPExtender) SupportsPreemption() bool

type Option

type Option func(*schedulerOptions)

Option configures a Scheduler

func WithBuildFrameworkCapturer

func WithBuildFrameworkCapturer(fc FrameworkCapturer) Option

func WithConfig

func WithConfig(cfg *rest.Config) Option

func WithExtenders

func WithExtenders(e ...config.Extender) Option

func WithFrameworkOutOfTreeRegistry

func WithFrameworkOutOfTreeRegistry(registry frameworkruntime.Registry) Option

func WithParallelism

func WithParallelism(threads int32) Option

func WithPercentageOfWorkersToScore

func WithPercentageOfWorkersToScore(percentageOfWorkersToScore int32) Option

func WithProfiles

func WithProfiles(p ...config.Profile) Option

func WithStageInitialBackoffSeconds

func WithStageInitialBackoffSeconds(stageInitialBackoffSeconds int64) Option

func WithStageMaxBackoffSeconds

func WithStageMaxBackoffSeconds(stageMaxBackoffSeconds int64) Option

func WithStageMaxInUnschedulableStagesDuration

func WithStageMaxInUnschedulableStagesDuration(duration time.Duration) Option

type ScheduleResult

type ScheduleResult struct {
	// UID of the selected worker.
	SuggestedHost string
	// The number of workers the scheduler evaluated the stage against in the filtering
	// phase and beyond.
	EvaluatedWorkers int
	// The number of workers out of the evaluated ones that fit the stage.
	FeasibleWorkers int
}

ScheduleResult represents the result of scheduling a stage.

type Scheduler

type Scheduler struct {
	Cache cache.Cache

	Extenders []framework.Extender

	NextStage func() *framework.QueuedStageInfo

	Error func(*framework.QueuedStageInfo, error)

	ScheduleStage func(ctx context.Context, fwk framework.Framework, state *framework.CycleState, stage *meta.Stage) (ScheduleResult, error)

	StopEverything <-chan struct{}

	SchedulingQueue queue.SchedulingQueue

	// Profiles are the scheduling profiles.
	Profiles map[string]framework.Framework
	// contains filtered or unexported fields
}

func New

func New(client client.Interface,
	informerFactory informers.SharedInformerFactory,
	recorderFactory profile.RecorderFactory,
	stopCh <-chan struct{},
	opts ...Option) (*Scheduler, error)

New returns a Scheduler

func (*Scheduler) Run

func (sched *Scheduler) Run(ctx context.Context)

type Victims

type Victims struct {
	Stages           []*meta.Stage
	NumPDBViolations int64
}

Victims represents:

stages:  a group of stages expected to be preempted.
numPDBViolations: the count of violations of StageDisruptionBudget

Jump to

Keyboard shortcuts

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