framework

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2019 License: Apache-2.0 Imports: 7 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
	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) AddPreemptableFn

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

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

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

func (*Session) JobReady

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

func (*Session) Pipeline

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

func (*Session) Preempt

func (ssn *Session) Preempt(preemptor, preemptee *api.TaskInfo) error

func (*Session) Preemptable

func (ssn *Session) Preemptable(preemptor, preemptee *api.TaskInfo) bool

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