scheduler

package
v0.0.0-...-bc30bd0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 72 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CtxKeyScheduleDataSet = CtxKeyScheduleDataSetType("ScheduleDataSet")
)

Variables

This section is empty.

Functions

func MakeDefaultErrorFunc

func MakeDefaultErrorFunc(client clientset.Interface, schedulerCache godelcache.SchedulerCache) func(*framework.QueuedPodInfo, error)

MakeDefaultErrorFunc construct a function to handle pod scheduler error, logs error only in Godel Scheduler Compared to K8S scheduler, adding pod to unschedulableQ not works for all situation, then we should change this Error handling function

func NewBasePlugins

func NewBasePlugins() framework.PluginCollectionSet

func ParseSwitchTypeForNMNode

func ParseSwitchTypeForNMNode(nmNode *nodev1alpha1.NMNode) framework.SwitchType

func ParseSwitchTypeForNode

func ParseSwitchTypeForNode(node *v1.Node) framework.SwitchType

func ParseSwitchTypeForPod

func ParseSwitchTypeForPod(pod *v1.Pod) framework.SwitchType

Types

type CtxKeyScheduleDataSetType

type CtxKeyScheduleDataSetType string

type Option

type Option func(*schedulerOptions)

Option configures a Scheduler

func WithDefaultProfile

func WithDefaultProfile(profile *config.GodelSchedulerProfile) Option

func WithRenewInterval

func WithRenewInterval(renewInterval int64) Option

WithRenewInterval sets renew interval for Scheduler in seconds, the default value is 30

func WithSubClusterKey

func WithSubClusterKey(key string) Option

func WithSubClusterProfiles

func WithSubClusterProfiles(profiles []config.GodelSchedulerProfile) Option

type ProcessFunc

type ProcessFunc func(ScheduleDataSet)

type ScheduleDataSet

type ScheduleDataSet interface {
	ClusterIndex() int
	SubCluster() string
	Type() framework.SwitchType
	Ctx() context.Context

	Run(context.Context) bool
	Close() bool
	CanBeRecycle() bool

	Snapshot() *cache.Snapshot
	SchedulingQueue() queue.SchedulingQueue
	ScheduleFunc() func(context.Context)
}

func NewScheduleDataSet

func NewScheduleDataSet(
	idx int,
	subCluster string,
	switchType framework.SwitchType,
	snapshot *cache.Snapshot,
	schedulingQueue queue.SchedulingQueue,
	unitScheduler core.UnitScheduler,
	reconciler *reconciler.FailedTaskReconciler,
	debugger *cachedebugger.CacheDebugger,
) ScheduleDataSet

type ScheduleDataSetImpl

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

func (*ScheduleDataSetImpl) CanBeRecycle

func (s *ScheduleDataSetImpl) CanBeRecycle() bool

TODO: revisit this rule.

func (*ScheduleDataSetImpl) Close

func (s *ScheduleDataSetImpl) Close() bool

func (*ScheduleDataSetImpl) ClusterIndex

func (s *ScheduleDataSetImpl) ClusterIndex() int

func (*ScheduleDataSetImpl) Ctx

func (*ScheduleDataSetImpl) Run

func (s *ScheduleDataSetImpl) Run(parentCtx context.Context) bool

func (*ScheduleDataSetImpl) ScheduleFunc

func (s *ScheduleDataSetImpl) ScheduleFunc() func(context.Context)

func (*ScheduleDataSetImpl) SchedulingQueue

func (s *ScheduleDataSetImpl) SchedulingQueue() queue.SchedulingQueue

func (*ScheduleDataSetImpl) Snapshot

func (s *ScheduleDataSetImpl) Snapshot() *cache.Snapshot

func (*ScheduleDataSetImpl) String

func (s *ScheduleDataSetImpl) String() string

func (*ScheduleDataSetImpl) SubCluster

func (s *ScheduleDataSetImpl) SubCluster() string

func (*ScheduleDataSetImpl) Type

type ScheduleSwitch

type ScheduleSwitch interface {
	Run(context.Context)
	Get(framework.SwitchType) ScheduleDataSet
	Register(switchType framework.SwitchType, dataSet ScheduleDataSet)
	Process(framework.SwitchType, ProcessFunc)
}

func NewScheduleSwitch

func NewScheduleSwitch() ScheduleSwitch

type ScheduleSwitchImpl

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

func (*ScheduleSwitchImpl) Get

func (*ScheduleSwitchImpl) Process

func (s *ScheduleSwitchImpl) Process(state framework.SwitchType, f ProcessFunc)

func (*ScheduleSwitchImpl) Register

func (s *ScheduleSwitchImpl) Register(switchType framework.SwitchType, dataSet ScheduleDataSet)

func (*ScheduleSwitchImpl) Run

func (s *ScheduleSwitchImpl) Run(ctx context.Context)

type Scheduler

type Scheduler struct {
	// Name identifies the Godel Scheduler
	Name string
	// SchedulerName here is the higher level scheduler name, which is used to select pods
	// that godel schedulers should be responsible for and filter out irrelevant pods.
	SchedulerName *string

	// Close this to shut down the scheduler.
	StopEverything <-chan struct{}

	ScheduleSwitch ScheduleSwitch
	// contains filtered or unexported fields
}

Scheduler watches for new unscheduled pods. It attempts to find nodes that they fit on and writes bindings back to the api server. Scheduler is the wrapper that watches for all pod and node event, the actual scheduling process is handled by schedule framework.

func New

func New(
	godelSchedulerName string,
	schedulerName *string,
	client clientset.Interface,
	crdClient godelclient.Interface,
	informerFactory informers.SharedInformerFactory,
	crdInformerFactory crdinformers.SharedInformerFactory,
	katalystCrdInformerFactory katalystinformers.SharedInformerFactory,
	stopCh <-chan struct{},
	recorder events.EventRecorder,
	reservationTTL time.Duration,
	opts ...Option) (*Scheduler, error,
)

New returns a Scheduler

func (*Scheduler) Run

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

Run begins watching and scheduling. It waits for cache to be synced, then starts scheduling and blocked until the context is done.

type StatusMaintainer

type StatusMaintainer interface {
	Run(stopCh <-chan struct{})
}

StatusMaintainer manages creating and renewing the status for this Scheduler

func NewSchedulerStatusMaintainer

func NewSchedulerStatusMaintainer(clock clock.Clock, client godelclient.Interface, schedulerName string, renewIntervalSeconds int64) StatusMaintainer

NewSchedulerStatusMaintainer constructs and returns a maintainer

Jump to

Keyboard shortcuts

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