framework

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupPluginBuilders

func CleanupPluginBuilders()

func CloseSession

func CloseSession(ssn *Session)

func RegisterAction

func RegisterAction(act Action)

func RegisterPluginBuilder

func RegisterPluginBuilder(name string, pc func(*PluginArgs) 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)

type Event

type Event struct {
	Task *api.TaskInfo
}

type EventHandler

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

type Plugin

type Plugin interface {
	OnSessionOpen(ssn *Session)
	OnSessionClose(ssn *Session)
}

type PluginArgs

type PluginArgs struct {
	Name                 string
	PreemptableFnEnabled bool
	JobOrderFnEnabled    bool
	TaskOrderFnEnabled   bool
	JobReadyFnEnabled    bool
}

type PluginBuilder

type PluginBuilder func(*PluginArgs) Plugin

func GetPluginBuilder

func GetPluginBuilder(name string) (PluginBuilder, bool)

type Session

type Session struct {
	UID types.UID

	Jobs       []*api.JobInfo
	JobIndex   map[api.JobID]*api.JobInfo
	Nodes      []*api.NodeInfo
	NodeIndex  map[string]*api.NodeInfo
	Queues     []*api.QueueInfo
	QueueIndex map[api.QueueID]*api.QueueInfo
	Others     []*api.TaskInfo
	Backlog    []*api.JobInfo
	// contains filtered or unexported fields
}

func OpenSession

func OpenSession(cache cache.Cache, args []*PluginArgs) *Session

func (*Session) AddEventHandler

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

func (*Session) AddJobOrderFn

func (ssn *Session) AddJobOrderFn(cf api.CompareFn)

func (*Session) AddJobReadyFn

func (ssn *Session) AddJobReadyFn(vf api.ValidateFn)

func (*Session) AddOverusedFn

func (ssn *Session) AddOverusedFn(fn api.ValidateFn)

func (*Session) AddPredicateFn

func (ssn *Session) AddPredicateFn(pf api.PredicateFn)

func (*Session) AddPreemptableFn

func (ssn *Session) AddPreemptableFn(cf api.PreemptableFn)

func (*Session) AddQueueOrderFn

func (ssn *Session) AddQueueOrderFn(qf api.CompareFn)

func (*Session) AddReclaimableFn

func (ssn *Session) AddReclaimableFn(rf api.ReclaimableFn)

func (*Session) AddTaskOrderFn

func (ssn *Session) AddTaskOrderFn(cf api.CompareFn)

func (*Session) Allocate

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

func (*Session) Discard

func (ssn *Session) Discard(job *api.JobInfo, event arbcorev1.Event, reason string) error

Discard discards a job from session, so no plugin/action handles it.

func (*Session) Evict

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

func (*Session) JobOrderFn

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

func (*Session) JobReady

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

func (*Session) Overused

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

func (*Session) Pipeline

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

func (*Session) PredicateFn

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

func (*Session) Preemptable

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

func (*Session) QueueOrderFn

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

func (*Session) Reclaimable

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

func (Session) String

func (ssn Session) String() string

func (*Session) TaskCompareFns

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

func (*Session) TaskOrderFn

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

Jump to

Keyboard shortcuts

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