framework

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2021 License: Apache-2.0 Imports: 26 Imported by: 17

Documentation

Index

Constants

View Source
const (
	// Evict op
	Evict = iota
	// Pipeline op
	Pipeline
	// Allocate op
	Allocate
)

Variables

This section is empty.

Functions

func CleanupPluginBuilders

func CleanupPluginBuilders()

CleanupPluginBuilders cleans up all the plugin

func CloseSession

func CloseSession(ssn *Session)

CloseSession close the session

func LoadCustomPlugins added in v1.1.1

func LoadCustomPlugins(pluginsDir string) error

LoadCustomPlugins loads custom implement plugins

func RegisterAction

func RegisterAction(act Action)

RegisterAction register action

func RegisterPluginBuilder

func RegisterPluginBuilder(name string, pc PluginBuilder)

RegisterPluginBuilder register the plugin

func TimeJitterAfter

func TimeJitterAfter(new, old time.Time, duration, maxJitter time.Duration) bool

TimeJitterAfter means: new after old + duration + jitter

Types

type Action

type Action interface {
	// The unique name of Action.
	Name() string

	// Initialize initializes the allocator plugins.
	Initialize()

	// Execute allocates the cluster's resources into each queue.
	Execute(ssn *Session)

	// UnIntialize un-initializes the allocator plugins.
	UnInitialize()
}

Action is the interface of scheduler action.

func GetAction

func GetAction(name string) (Action, bool)

GetAction get the action by name

type Arguments

type Arguments map[string]string

Arguments map

func GetArgOfActionFromConf

func GetArgOfActionFromConf(configurations []conf.Configuration, actionName string) Arguments

GetArgOfActionFromConf return argument of action reading from configuration of schedule

func (Arguments) GetBool

func (a Arguments) GetBool(ptr *bool, key string)

GetBool get the bool value from string

func (Arguments) GetFloat64

func (a Arguments) GetFloat64(ptr *float64, key string)

GetFloat64 get the float64 value from string

func (Arguments) GetInt

func (a Arguments) GetInt(ptr *int, key string)

GetInt get the integer value from string

type Event

type Event struct {
	Task *api.TaskInfo
}

Event structure

type EventHandler

type EventHandler struct {
	AllocateFunc   func(event *Event)
	DeallocateFunc func(event *Event)
}

EventHandler structure

type Operation added in v1.0.0

type Operation int8

Operation type

type Plugin

type Plugin interface {
	// The unique name of Plugin.
	Name() string

	OnSessionOpen(ssn *Session)
	OnSessionClose(ssn *Session)
}

Plugin is the interface of scheduler plugin

type PluginBuilder

type PluginBuilder = func(Arguments) Plugin

PluginBuilder plugin management

func GetPluginBuilder

func GetPluginBuilder(name string) (PluginBuilder, bool)

GetPluginBuilder get the pluginbuilder by name

type Session

type Session struct {
	UID types.UID

	TotalResource *api.Resource

	Jobs           map[api.JobID]*api.JobInfo
	Nodes          map[string]*api.NodeInfo
	RevocableNodes map[string]*api.NodeInfo
	Queues         map[api.QueueID]*api.QueueInfo
	NamespaceInfo  map[api.NamespaceName]*api.NamespaceInfo

	Tiers          []conf.Tier
	Configurations []conf.Configuration
	NodeList       []*api.NodeInfo
	// contains filtered or unexported fields
}

Session information for the current session

func OpenSession

func OpenSession(cache cache.Cache, tiers []conf.Tier, configurations []conf.Configuration) *Session

OpenSession start the session

func (*Session) AddBatchNodeOrderFn

func (ssn *Session) AddBatchNodeOrderFn(name string, pf api.BatchNodeOrderFn)

AddBatchNodeOrderFn add Batch Node order function

func (*Session) AddBestNodeFn added in v0.4.1

func (ssn *Session) AddBestNodeFn(name string, pf api.BestNodeFn)

AddBestNodeFn add BestNode function

func (*Session) AddClusterOrderFn added in v1.4.0

func (ssn *Session) AddClusterOrderFn(name string, qf api.CompareFn)

AddClusterOrderFn add queue order function

func (*Session) AddEventHandler

func (ssn *Session) AddEventHandler(eh *EventHandler)

AddEventHandler add event handlers

func (*Session) AddJobEnqueueableFn

func (ssn *Session) AddJobEnqueueableFn(name string, fn api.VoteFn)

AddJobEnqueueableFn add jobenqueueable function

func (*Session) AddJobEnqueuedFn added in v1.4.0

func (ssn *Session) AddJobEnqueuedFn(name string, fn api.JobEnqueuedFn)

AddJobEnqueuedFn add jobEnqueued function

func (*Session) AddJobOrderFn

func (ssn *Session) AddJobOrderFn(name string, cf api.CompareFn)

AddJobOrderFn add job order function

func (*Session) AddJobPipelinedFn

func (ssn *Session) AddJobPipelinedFn(name string, vf api.VoteFn)

AddJobPipelinedFn add pipelined function

func (*Session) AddJobReadyFn

func (ssn *Session) AddJobReadyFn(name string, vf api.ValidateFn)

AddJobReadyFn add JobReady function

func (*Session) AddJobStarvingFns added in v1.2.0

func (ssn *Session) AddJobStarvingFns(name string, fn api.ValidateFn)

AddJobStarvingFns add jobStarvingFns function

func (*Session) AddJobValidFn

func (ssn *Session) AddJobValidFn(name string, fn api.ValidateExFn)

AddJobValidFn add jobvalid function

func (*Session) AddNamespaceOrderFn

func (ssn *Session) AddNamespaceOrderFn(name string, cf api.CompareFn)

AddNamespaceOrderFn add namespace order function

func (*Session) AddNodeMapFn

func (ssn *Session) AddNodeMapFn(name string, pf api.NodeMapFn)

AddNodeMapFn add Node map function

func (*Session) AddNodeOrderFn

func (ssn *Session) AddNodeOrderFn(name string, pf api.NodeOrderFn)

AddNodeOrderFn add Node order function

func (*Session) AddNodeReduceFn

func (ssn *Session) AddNodeReduceFn(name string, pf api.NodeReduceFn)

AddNodeReduceFn add Node reduce function

func (*Session) AddOverusedFn

func (ssn *Session) AddOverusedFn(name string, fn api.ValidateFn)

AddOverusedFn add overused function

func (*Session) AddPredicateFn

func (ssn *Session) AddPredicateFn(name string, pf api.PredicateFn)

AddPredicateFn add Predicate function

func (*Session) AddPreemptableFn

func (ssn *Session) AddPreemptableFn(name string, cf api.EvictableFn)

AddPreemptableFn add preemptable function

func (*Session) AddQueueOrderFn

func (ssn *Session) AddQueueOrderFn(name string, qf api.CompareFn)

AddQueueOrderFn add queue order function

func (*Session) AddReclaimableFn

func (ssn *Session) AddReclaimableFn(name string, rf api.EvictableFn)

AddReclaimableFn add Reclaimable function

func (*Session) AddReservedNodesFn added in v1.1.0

func (ssn *Session) AddReservedNodesFn(name string, fn api.ReservedNodesFn)

AddReservedNodesFn add reservedNodesFn function

func (*Session) AddTargetJobFn added in v1.1.0

func (ssn *Session) AddTargetJobFn(name string, fn api.TargetJobFn)

AddTargetJobFn add targetjob function

func (*Session) AddTaskOrderFn

func (ssn *Session) AddTaskOrderFn(name string, cf api.CompareFn)

AddTaskOrderFn add task order function

func (*Session) AddUnderusedResourceFn added in v1.4.0

func (ssn *Session) AddUnderusedResourceFn(name string, fn api.UnderUsedResourceFn)

AddUnderusedResourceFn add underused function

func (*Session) AddVictimTasksFns added in v1.2.0

func (ssn *Session) AddVictimTasksFns(name string, fn api.VictimTasksFn)

AddVictimTasksFns add victimTasksFns function

func (*Session) Allocate

func (ssn *Session) Allocate(task *api.TaskInfo, nodeInfo *api.NodeInfo) error

Allocate the task to the node in the session

func (*Session) BatchNodeOrderFn

func (ssn *Session) BatchNodeOrderFn(task *api.TaskInfo, nodes []*api.NodeInfo) (map[string]float64, error)

BatchNodeOrderFn invoke node order function of the plugins

func (*Session) BestNodeFn added in v0.4.1

func (ssn *Session) BestNodeFn(task *api.TaskInfo, nodeScores map[float64][]*api.NodeInfo) *api.NodeInfo

BestNodeFn invoke bestNode function of the plugins

func (*Session) BindPodGroup added in v1.4.0

func (ssn *Session) BindPodGroup(job *api.JobInfo, cluster string) error

BindPodGroup bind PodGroup to specified cluster

func (*Session) ClusterOrderFn added in v1.4.0

func (ssn *Session) ClusterOrderFn(l, r interface{}) bool

ClusterOrderFn invoke ClusterOrderFn function of the plugins

func (*Session) Evict

func (ssn *Session) Evict(reclaimee *api.TaskInfo, reason string) error

Evict the task in the session

func (Session) InformerFactory added in v1.4.0

func (ssn Session) InformerFactory() informers.SharedInformerFactory

InformerFactory returns the scheduler ShareInformerFactory

func (*Session) JobEnqueueable

func (ssn *Session) JobEnqueueable(obj interface{}) bool

JobEnqueueable invoke jobEnqueueableFns function of the plugins

func (*Session) JobEnqueued added in v1.4.0

func (ssn *Session) JobEnqueued(obj interface{})

JobEnqueued invoke jobEnqueuedFns function of the plugins

func (*Session) JobOrderFn

func (ssn *Session) JobOrderFn(l, r interface{}) bool

JobOrderFn invoke joborder function of the plugins

func (*Session) JobPipelined

func (ssn *Session) JobPipelined(obj interface{}) bool

JobPipelined invoke pipelined function of the plugins Check if job has get enough resource to run

func (*Session) JobReady

func (ssn *Session) JobReady(obj interface{}) bool

JobReady invoke jobready function of the plugins

func (*Session) JobStarving added in v1.2.0

func (ssn *Session) JobStarving(obj interface{}) bool

JobStarving invoke jobStarving function of the plugins Check if job still need more resource

func (*Session) JobValid

func (ssn *Session) JobValid(obj interface{}) *api.ValidateResult

JobValid invoke jobvalid function of the plugins

func (Session) KubeClient added in v1.0.0

func (ssn Session) KubeClient() kubernetes.Interface

KubeClient returns the kubernetes client

func (*Session) NamespaceOrderFn

func (ssn *Session) NamespaceOrderFn(l, r interface{}) bool

NamespaceOrderFn invoke namespaceorder function of the plugins

func (*Session) NodeOrderFn

func (ssn *Session) NodeOrderFn(task *api.TaskInfo, node *api.NodeInfo) (float64, error)

NodeOrderFn invoke node order function of the plugins

func (*Session) NodeOrderMapFn

func (ssn *Session) NodeOrderMapFn(task *api.TaskInfo, node *api.NodeInfo) (map[string]float64, float64, error)

NodeOrderMapFn invoke node order function of the plugins

func (*Session) NodeOrderReduceFn

func (ssn *Session) NodeOrderReduceFn(task *api.TaskInfo, pluginNodeScoreMap map[string]k8sframework.NodeScoreList) (map[string]float64, error)

NodeOrderReduceFn invoke node order function of the plugins

func (*Session) Overused

func (ssn *Session) Overused(queue *api.QueueInfo) bool

Overused invoke overused function of the plugins

func (*Session) Pipeline

func (ssn *Session) Pipeline(task *api.TaskInfo, hostname string) error

Pipeline the task to the node in the session

func (*Session) PredicateFn

func (ssn *Session) PredicateFn(task *api.TaskInfo, node *api.NodeInfo) error

PredicateFn invoke predicate function of the plugins

func (*Session) Preemptable

func (ssn *Session) Preemptable(preemptor *api.TaskInfo, preemptees []*api.TaskInfo) []*api.TaskInfo

Preemptable invoke preemptable function of the plugins

func (*Session) QueueOrderFn

func (ssn *Session) QueueOrderFn(l, r interface{}) bool

QueueOrderFn invoke queueorder function of the plugins

func (*Session) Reclaimable

func (ssn *Session) Reclaimable(reclaimer *api.TaskInfo, reclaimees []*api.TaskInfo) []*api.TaskInfo

Reclaimable invoke reclaimable function of the plugins

func (*Session) ReservedNodes added in v1.1.0

func (ssn *Session) ReservedNodes()

ReservedNodes invoke ReservedNodes function of the plugins

func (*Session) Statement

func (ssn *Session) Statement() *Statement

Statement returns new statement object

func (Session) String

func (ssn Session) String() string

String return nodes and jobs information in the session

func (*Session) TargetJob added in v1.1.0

func (ssn *Session) TargetJob(jobs []*api.JobInfo) *api.JobInfo

TargetJob invoke targetJobFns function of the plugins

func (*Session) TaskCompareFns

func (ssn *Session) TaskCompareFns(l, r interface{}) int

TaskCompareFns invoke taskorder function of the plugins

func (*Session) TaskOrderFn

func (ssn *Session) TaskOrderFn(l, r interface{}) bool

TaskOrderFn invoke taskorder function of the plugins

func (*Session) UnderusedResources added in v1.4.0

func (ssn *Session) UnderusedResources(queue *api.QueueInfo) api.ResourceNameList

UnderusedResources invoke underused function of the plugins Returns:

  • nil if no `UnderUsedResourceFn` is registered
  • [] if no under-used resources

func (*Session) UpdatePodGroupCondition added in v0.4.2

func (ssn *Session) UpdatePodGroupCondition(jobInfo *api.JobInfo, cond *scheduling.PodGroupCondition) error

UpdatePodGroupCondition update job condition accordingly.

func (*Session) UpdateSchedulerNumaInfo added in v1.4.0

func (ssn *Session) UpdateSchedulerNumaInfo(AllocatedSets map[string]api.ResNumaSets)

UpdateSchedulerNumaInfo update SchedulerNumaInfo

func (*Session) VictimTasks added in v1.2.0

func (ssn *Session) VictimTasks() []*api.TaskInfo

VictimTasks invoke ReservedNodes function of the plugins

type Statement

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

Statement structure

func NewStatement added in v1.0.0

func NewStatement(ssn *Session) *Statement

NewStatement returns new statement object

func (*Statement) Allocate

func (s *Statement) Allocate(task *api.TaskInfo, nodeInfo *api.NodeInfo) error

Allocate the task to node

func (*Statement) Commit

func (s *Statement) Commit()

Commit operation for evict and pipeline

func (*Statement) Discard

func (s *Statement) Discard()

Discard operation for evict, pipeline and allocate

func (*Statement) Evict

func (s *Statement) Evict(reclaimee *api.TaskInfo, reason string) error

Evict the pod

func (*Statement) Pipeline

func (s *Statement) Pipeline(task *api.TaskInfo, hostname string) error

Pipeline the task for the node

Jump to

Keyboard shortcuts

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