framework

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2019 License: Apache-2.0 Imports: 14 Imported by: 28

Documentation

Index

Constants

This section is empty.

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 RegisterAction

func RegisterAction(act Action)

RegisterAction register action

func RegisterPluginBuilder

func RegisterPluginBuilder(name string, pc PluginBuilder)

RegisterPluginBuilder register the plugin

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 added in v0.5.0

type Arguments map[string]string

Arguments map

func (Arguments) GetBool added in v0.5.0

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

GetBool get the bool value from string

func (Arguments) GetInt added in v0.5.0

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 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

	Jobs    map[api.JobID]*api.JobInfo
	Nodes   map[string]*api.NodeInfo
	Queues  map[api.QueueID]*api.QueueInfo
	Backlog []*api.JobInfo
	Tiers   []conf.Tier
	// contains filtered or unexported fields
}

Session information for the current session

func OpenSession

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

OpenSession start the session

func (*Session) AddEventHandler

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

AddEventHandler add event handlers

func (*Session) AddJobOrderFn

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

AddJobOrderFn add job order function

func (*Session) AddJobPipelinedFn added in v0.5.0

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

AddJobPipelinedFn add pipelined function

func (*Session) AddJobReadyFn

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

AddJobReadyFn add JobReady function

func (*Session) AddJobValidFn added in v0.4.1

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

AddJobValidFn add jobvalid function

func (*Session) AddNodePrioritizers added in v0.5.0

func (ssn *Session) AddNodePrioritizers(name string, pf []algorithm.PriorityConfig)

AddNodePrioritizers add Node prioritizers

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) AddTaskOrderFn

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

AddTaskOrderFn add task order function

func (*Session) Allocate

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

Allocate the task to the node in the session

func (*Session) Evict

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

Evict the task in the session

func (*Session) JobOrderFn

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

JobOrderFn invoke joborder function of the plugins

func (*Session) JobPipelined added in v0.5.0

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

JobPipelined invoke pipelined function of the plugins

func (*Session) JobReady

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

JobReady invoke jobready function of the plugins

func (*Session) JobValid added in v0.4.1

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

JobValid invoke jobvalid function of the plugins

func (*Session) NodePrioritizers added in v0.5.0

func (ssn *Session) NodePrioritizers() []algorithm.PriorityConfig

NodePrioritizers merge all prioritizers 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) Statement added in v0.4.1

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) 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) UpdateJobCondition added in v0.4.1

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

UpdateJobCondition update job condition accordingly.

type Statement added in v0.4.1

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

Statement structure

func (*Statement) Commit added in v0.4.1

func (s *Statement) Commit()

Commit operation for evict and pipeline

func (*Statement) Discard added in v0.4.1

func (s *Statement) Discard()

Discard operation for evict and pipeline

func (*Statement) Evict added in v0.4.1

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

Evict the pod

func (*Statement) Pipeline added in v0.4.1

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