queue

package
v0.0.0-...-bc30bd0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgNilPodGroup                     string = "DEBUG: pod group is nil"
	MsgPodGroupBeingDeleted            string = "DEBUG: pod group is being deleted"
	MsgPodGroupInPendingOrUnknownPhase string = "DEBUG: pod group is in either pending or unknown phase"
	MsgPodGroupLessThanMinMember       string = "DEBUG: pod group has not yet met the MinMember requirement with numReadyToBeDispatched=%d and minMember=%d"
)

Variables

View Source
var ErrFIFOClosed = errors.New("DeltaFIFO: manipulating with closed queue")

ErrFIFOClosed used when FIFO is closed

Functions

func NewUnitInfo

func NewUnitInfo() *unitInfo

Types

type CompareFn

type CompareFn func(interface{}, interface{}) int

CompareFn is the func declaration used by sort or priority queue.

type KeyError

type KeyError struct {
	Obj interface{}
	Err error
}

KeyError will be returned any time a KeyFunc gives an error; it includes the object at fault.

func (KeyError) Error

func (k KeyError) Error() string

Error gives a human-readable description of the error.

type KeyFunc

type KeyFunc func(obj interface{}) (string, error)

type LessFunc

type LessFunc func(interface{}, interface{}) bool

LessFunc is the func declaration used by sort or priority queue.

type MetricsFIFO

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

func NewMetricsFIFO

func NewMetricsFIFO(metricRecorder metrics.MetricRecorder, handler UpdateHandler) *MetricsFIFO

func (*MetricsFIFO) Add

func (f *MetricsFIFO) Add(obj interface{}) error

func (*MetricsFIFO) Close

func (f *MetricsFIFO) Close()

func (*MetricsFIFO) Delete

func (f *MetricsFIFO) Delete(obj interface{}) error

func (*MetricsFIFO) Exists

func (f *MetricsFIFO) Exists(obj interface{}) bool

func (*MetricsFIFO) IsClosed

func (f *MetricsFIFO) IsClosed() bool

IsClosed checks if the queue is closed

func (*MetricsFIFO) Pop

func (f *MetricsFIFO) Pop() (interface{}, error)

func (*MetricsFIFO) Update

func (f *MetricsFIFO) Update(obj interface{}) error

type PendingFIFO

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

func NewPendingFIFO

func NewPendingFIFO(metricRecorder metrics.MetricRecorder) *PendingFIFO

func (*PendingFIFO) AddPodInfo

func (p *PendingFIFO) AddPodInfo(podInfo *QueuedPodInfo) error

func (*PendingFIFO) Close

func (p *PendingFIFO) Close()

func (*PendingFIFO) Pop

func (p *PendingFIFO) Pop() ([]*QueuedPodInfo, error)

func (*PendingFIFO) RemovePodInfo

func (p *PendingFIFO) RemovePodInfo(podInfo *QueuedPodInfo) error

func (*PendingFIFO) UpdatePodInfo

func (p *PendingFIFO) UpdatePodInfo(podInfo *QueuedPodInfo) error

type PendingQueue

type PendingQueue interface {
	// AddPodInfo will add pod to queue if not exists. If exists, update it
	AddPodInfo(podInfo *QueuedPodInfo) error
	// UpdatePodInfo will update pod in queue if exists. If not exists, add it
	UpdatePodInfo(podInfo *QueuedPodInfo) error
	// RemovePodInfo will remove pod from the queue if exists
	RemovePodInfo(podInfo *QueuedPodInfo) error
	// Pop will pop pod from the queue
	Pop() ([]*QueuedPodInfo, error)
	// Close the queue
	Close()
}

type PriorityQueue

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

PriorityQueue implements a scheduling queue.

func NewPriorityQueue

func NewPriorityQueue(lessFn LessFunc) *PriorityQueue

NewPriorityQueue returns a PriorityQueue

func (*PriorityQueue) Empty

func (q *PriorityQueue) Empty() bool

Empty check if queue is empty

func (*PriorityQueue) Len

func (q *PriorityQueue) Len() int

Len returns Len of the priority queue

func (*PriorityQueue) Pop

func (q *PriorityQueue) Pop() interface{}

Pop pops element in the priority queueName

func (*PriorityQueue) Push

func (q *PriorityQueue) Push(it interface{})

Push pushes element in the priority queueName

type QueuedPodInfo

type QueuedPodInfo struct {
	PodKey          string
	PodResourceType podutil.PodResourceType

	// The time pod added to the scheduling queue.
	Timestamp time.Time
	// The time when the pod is added to the queue for the first time. The pod may be added
	// back to the queue multiple times before it's successfully dispatched.
	// It shouldn't be updated once initialized. It's used to record the e2e scheduling
	// latency for a pod.
	InitialAddedTimestamp time.Time

	// Tracing context used in dispatcher, which should be passed between different queues
	SpanContext tracing.SpanContext

	// The property of the pod, which is used to describe the pod's attributes
	PodProperty *framework.PodProperty
}

QueuedPodInfo is a Pod wrapper with additional information related to the pod's status in dispatcher queue, such as the timestamp when it's added to the queue.

func NewQueuedPodInfo

func NewQueuedPodInfo(pod *v1.Pod) (*QueuedPodInfo, error)

func (*QueuedPodInfo) GetPodProperty

func (qi *QueuedPodInfo) GetPodProperty() *framework.PodProperty

type SortedFIFO

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

func NewSortedFIFO

func NewSortedFIFO(metricRecorder metrics.MetricRecorder) *SortedFIFO

func (*SortedFIFO) AddPodInfo

func (s *SortedFIFO) AddPodInfo(podInfo *QueuedPodInfo) error

func (*SortedFIFO) Close

func (s *SortedFIFO) Close()

func (*SortedFIFO) PodInfoExist

func (s *SortedFIFO) PodInfoExist(podInfo *QueuedPodInfo) bool

func (*SortedFIFO) PopPodInfo

func (s *SortedFIFO) PopPodInfo() (*QueuedPodInfo, error)

func (*SortedFIFO) RemovePodInfo

func (s *SortedFIFO) RemovePodInfo(podInfo *QueuedPodInfo) error

func (*SortedFIFO) UpdatePodInfo

func (s *SortedFIFO) UpdatePodInfo(podInfo *QueuedPodInfo) error

type SortedQueue

type SortedQueue interface {
	// AddPodInfo will add pod to queue if not exists. If exists, update it
	AddPodInfo(podInfo *QueuedPodInfo) error
	// PopPodInfo will pop pod from the queue
	PopPodInfo() (*QueuedPodInfo, error)
	// PodInfoExist checks whether pod exists in the queue
	PodInfoExist(podInfo *QueuedPodInfo) bool
	// UpdatePodInfo will update pod in queue if exists. If not exists, add it
	UpdatePodInfo(podInfo *QueuedPodInfo) error
	// RemovePodInfo will remove pod from the queue if exists
	RemovePodInfo(podInfo *QueuedPodInfo) error
	// Close the queue
	Close()
}

type UnitInfos

type UnitInfos interface {
	AddPodGroup(pg *v1alpha1.PodGroup)
	UpdatePodGroup(oldPG, newPG *v1alpha1.PodGroup)
	DeletePodGroup(pg *v1alpha1.PodGroup)
	AddPod(unitKey string, podKey string)
	DeletePod(unitKey string, podKey string)
	AddUnSortedPodInfo(unitKey string, podInfo *QueuedPodInfo)
	DeleteUnSortedPodInfo(unitKey string, podInfo *QueuedPodInfo)
	Pop() (*QueuedPodInfo, error)
	Enqueue(podInfo *QueuedPodInfo)
	GetAssignedSchedulerForPodGroupUnit(pg *v1alpha1.PodGroup) string
	AssignSchedulerToPodGroupUnit(pg *v1alpha1.PodGroup, schedName string, forceUpdate bool) error
	Run(stop <-chan struct{})
}

func NewUnitInfos

func NewUnitInfos(recorder events.EventRecorder) UnitInfos

type UpdateHandler

type UpdateHandler func(old, new interface{})

Jump to

Keyboard shortcuts

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