scheduler

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OverrideReservationDelay

func OverrideReservationDelay(delay time.Duration)

override reservation delay for tests

Types

type ClusterSchedulingContext

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

func NewClusterSchedulingContext

func NewClusterSchedulingContext() *ClusterSchedulingContext

func (*ClusterSchedulingContext) GetPartitionReservations

func (csc *ClusterSchedulingContext) GetPartitionReservations(partitionName string) map[string]int

Return the list of reservations for the partition. Returns nil if the partition cannot be found or an empty map if there are no reservations Visible for tests

func (*ClusterSchedulingContext) GetSchedulingApplication

func (csc *ClusterSchedulingContext) GetSchedulingApplication(appID, partitionName string) *SchedulingApplication

Get the scheduling application based on the ID from the partition. Returns nil if the partition or app cannot be found. Visible for tests

func (*ClusterSchedulingContext) GetSchedulingNode

func (csc *ClusterSchedulingContext) GetSchedulingNode(nodeID, partitionName string) *SchedulingNode

Get a scheduling node based on its name from the partition. Returns nil if the partition or node cannot be found. Visible for tests

func (*ClusterSchedulingContext) GetSchedulingQueue

func (csc *ClusterSchedulingContext) GetSchedulingQueue(queueName string, partitionName string) *SchedulingQueue

Get the scheduling queue based on the queue path name from the partition. Returns nil if the partition or queue cannot be found. Visible for tests

func (*ClusterSchedulingContext) NeedPreemption

func (csc *ClusterSchedulingContext) NeedPreemption() bool

func (*ClusterSchedulingContext) RemoveSchedulingPartitionsByRMId

func (csc *ClusterSchedulingContext) RemoveSchedulingPartitionsByRMId(rmID string)

type DRFPreemptionPolicy

type DRFPreemptionPolicy struct {
}

Preemption policy based-on DRF

func (*DRFPreemptionPolicy) DoPreemption

func (m *DRFPreemptionPolicy) DoPreemption(scheduler *Scheduler)

type DefaultNodeIterator

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

Default iterator, wraps the base iterator. Iterates over the list from the start, position zero, to end.

func NewDefaultNodeIterator

func NewDefaultNodeIterator(schedulerNodes []*SchedulingNode) *DefaultNodeIterator

Create a new default iterator

func (*DefaultNodeIterator) HasNext

func (bi *DefaultNodeIterator) HasNext() bool

HasNext returns true if there is a next element in the array. Returns false if there are no more elements or list is empty.

func (*DefaultNodeIterator) Next

func (bi *DefaultNodeIterator) Next() *SchedulingNode

Next returns the next element and advances to next element in array. Returns nil at the end of iteration.

func (*DefaultNodeIterator) Reset

func (bi *DefaultNodeIterator) Reset()

Reset the iterator to start from the beginning

type NodeIterator

type NodeIterator interface {
	// returns true if there are more values to iterate over
	HasNext() (ok bool)
	// returns the next node from the iterator
	Next() (node *SchedulingNode)
	// reset the iterator to a clean state
	Reset()
}

NodeIterator iterates over a list of nodes based on the defined policy

type PreemptionPolicy

type PreemptionPolicy interface {
	DoPreemption(scheduler *Scheduler)
}

type RoundRobinNodeIterator

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

Random iterator, wraps the base iterator Iterates over the list from a random starting position in the list. The iterator automatically wraps at the end of the list.

func NewRoundRobinNodeIterator

func NewRoundRobinNodeIterator(schedulerNodes []*SchedulingNode) *RoundRobinNodeIterator

The starting point is randomised in the slice.

func (*RoundRobinNodeIterator) HasNext

func (bi *RoundRobinNodeIterator) HasNext() bool

HasNext returns true if there is a next element in the array. Returns false if there are no more elements or list is empty.

func (*RoundRobinNodeIterator) Next

Next returns the next element and advances to next element in array. Returns nil at the end of iteration.

func (*RoundRobinNodeIterator) Reset

func (ri *RoundRobinNodeIterator) Reset()

type Scheduler

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

Responsibility of this class is, get status from SchedulerCache, and send allocation / release proposal back to cache.

Scheduler may maintain its local status which is different from SchedulerCache

func NewScheduler

func NewScheduler(clusterInfo *cache.ClusterInfo) *Scheduler

func (*Scheduler) GetClusterSchedulingContext

func (s *Scheduler) GetClusterSchedulingContext() *ClusterSchedulingContext

Visible by tests

func (*Scheduler) HandleEvent

func (s *Scheduler) HandleEvent(ev interface{})

Implement methods for Scheduler events

func (*Scheduler) ManualInspectOutstandingRequests added in v0.9.0

func (s *Scheduler) ManualInspectOutstandingRequests(nInspect int)

The inspector for testing which runs nInspect times the normal inspection routine. Visible by tests

func (*Scheduler) MultiStepSchedule

func (s *Scheduler) MultiStepSchedule(nAlloc int)

The scheduler for testing which runs nAlloc times the normal schedule routine. Visible by tests

func (*Scheduler) SingleStepPreemption

func (s *Scheduler) SingleStepPreemption()

Visible by tests

func (*Scheduler) StartService

func (s *Scheduler) StartService(handlers handler.EventHandlers, manualSchedule bool)

Start service

type SchedulingApplication

type SchedulingApplication struct {
	ApplicationInfo *cache.ApplicationInfo

	sync.RWMutex
	// contains filtered or unexported fields
}

func (*SchedulingApplication) GetAllocatedResource

func (sa *SchedulingApplication) GetAllocatedResource() *resources.Resource

Return the allocated resources for this application

func (*SchedulingApplication) GetPendingResource

func (sa *SchedulingApplication) GetPendingResource() *resources.Resource

Return the pending resources for this application

func (*SchedulingApplication) GetReservations

func (sa *SchedulingApplication) GetReservations() []string

Return an array of all reservation keys for the app. This will return an empty array if there are no reservations. Visible for tests

func (*SchedulingApplication) GetSchedulingAllocationAsk

func (sa *SchedulingApplication) GetSchedulingAllocationAsk(allocationKey string) *schedulingAllocationAsk

Return the allocation ask for the key, nil if not found

type SchedulingNode

type SchedulingNode struct {
	NodeID string

	sync.RWMutex
	// contains filtered or unexported fields
}

func (*SchedulingNode) GetAllocatedResource

func (sn *SchedulingNode) GetAllocatedResource() *resources.Resource

Get the allocated resource on this node. These resources are just the confirmed allocations (tracked in the cache node). This does not lock the cache node as it will take its own lock.

func (*SchedulingNode) GetAvailableResource

func (sn *SchedulingNode) GetAvailableResource() *resources.Resource

Get the available resource on this node. These resources are confirmed allocations (tracked in the cache node) minus the resources currently being allocated but not confirmed in the cache. This does not lock the cache node as it will take its own lock.

func (*SchedulingNode) GetReservations

func (sn *SchedulingNode) GetReservations() []string

Return an array of all reservation keys for the node. This will return an empty array if there are no reservations. Visible for tests

type SchedulingQueue

type SchedulingQueue struct {
	Name      string           // Fully qualified path for the queue
	QueueInfo *cache.QueueInfo // link back to the queue in the cache

	sync.RWMutex
	// contains filtered or unexported fields
}

Represents Queue inside Scheduler

func (*SchedulingQueue) GetAllocatedResource

func (sq *SchedulingQueue) GetAllocatedResource() *resources.Resource

Return the allocated resources for this queue

func (*SchedulingQueue) GetCopyOfChildren

func (sq *SchedulingQueue) GetCopyOfChildren() map[string]*SchedulingQueue

Get a copy of the child queues This is used by the partition manager to find all queues to clean however we can not guarantee that there is no new child added while we clean up since there is no overall lock on the scheduler. We'll need to test just before to make sure the parent is empty

func (*SchedulingQueue) GetPendingResource

func (sq *SchedulingQueue) GetPendingResource() *resources.Resource

Return the pending resources for this queue

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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