Documentation ¶
Index ¶
- func Key(q *kueue.LocalQueue) string
- type ClusterQueue
- type ClusterQueueBestEffortFIFO
- func (c ClusterQueueBestEffortFIFO) AddFromLocalQueue(q *LocalQueue) bool
- func (c ClusterQueueBestEffortFIFO) Cohort() string
- func (c ClusterQueueBestEffortFIFO) Delete(w *kueue.Workload)
- func (c ClusterQueueBestEffortFIFO) DeleteFromLocalQueue(q *LocalQueue)
- func (c ClusterQueueBestEffortFIFO) Dump() (sets.Set[string], bool)
- func (c ClusterQueueBestEffortFIFO) DumpInadmissible() (sets.Set[string], bool)
- func (c ClusterQueueBestEffortFIFO) Info(key string) *workload.Info
- func (c ClusterQueueBestEffortFIFO) Pending() int
- func (c ClusterQueueBestEffortFIFO) PendingActive() int
- func (c ClusterQueueBestEffortFIFO) PendingInadmissible() int
- func (c ClusterQueueBestEffortFIFO) Pop() *workload.Info
- func (c ClusterQueueBestEffortFIFO) PushOrUpdate(wInfo *workload.Info)
- func (c ClusterQueueBestEffortFIFO) QueueInadmissibleWorkloads(ctx context.Context, client client.Client) bool
- func (cq *ClusterQueueBestEffortFIFO) RequeueIfNotPresent(wInfo *workload.Info, reason RequeueReason) bool
- func (c ClusterQueueBestEffortFIFO) Snapshot() []*workload.Info
- func (c ClusterQueueBestEffortFIFO) Update(apiCQ *kueue.ClusterQueue) error
- type ClusterQueueStrictFIFO
- func (c ClusterQueueStrictFIFO) AddFromLocalQueue(q *LocalQueue) bool
- func (c ClusterQueueStrictFIFO) Cohort() string
- func (c ClusterQueueStrictFIFO) Delete(w *kueue.Workload)
- func (c ClusterQueueStrictFIFO) DeleteFromLocalQueue(q *LocalQueue)
- func (c ClusterQueueStrictFIFO) Dump() (sets.Set[string], bool)
- func (c ClusterQueueStrictFIFO) DumpInadmissible() (sets.Set[string], bool)
- func (c ClusterQueueStrictFIFO) Info(key string) *workload.Info
- func (c ClusterQueueStrictFIFO) Pending() int
- func (c ClusterQueueStrictFIFO) PendingActive() int
- func (c ClusterQueueStrictFIFO) PendingInadmissible() int
- func (c ClusterQueueStrictFIFO) Pop() *workload.Info
- func (c ClusterQueueStrictFIFO) PushOrUpdate(wInfo *workload.Info)
- func (c ClusterQueueStrictFIFO) QueueInadmissibleWorkloads(ctx context.Context, client client.Client) bool
- func (cq *ClusterQueueStrictFIFO) RequeueIfNotPresent(wInfo *workload.Info, reason RequeueReason) bool
- func (c ClusterQueueStrictFIFO) Snapshot() []*workload.Info
- func (c ClusterQueueStrictFIFO) Update(apiCQ *kueue.ClusterQueue) error
- type LocalQueue
- type Manager
- func (m *Manager) AddClusterQueue(ctx context.Context, cq *kueue.ClusterQueue) error
- func (m *Manager) AddLocalQueue(ctx context.Context, q *kueue.LocalQueue) error
- func (m *Manager) AddOrUpdateWorkload(w *kueue.Workload) bool
- func (m *Manager) Broadcast()
- func (m *Manager) CleanUpOnContext(ctx context.Context)
- func (m *Manager) ClusterQueueForWorkload(wl *kueue.Workload) (string, bool)
- func (m *Manager) DeleteClusterQueue(cq *kueue.ClusterQueue)
- func (m *Manager) DeleteLocalQueue(q *kueue.LocalQueue)
- func (m *Manager) DeleteSnapshot(cq *kueue.ClusterQueue)
- func (m *Manager) DeleteWorkload(w *kueue.Workload)
- func (m *Manager) Dump() map[string]sets.Set[string]
- func (m *Manager) DumpInadmissible() map[string]sets.Set[string]
- func (m *Manager) GetClusterQueueNames() []string
- func (m *Manager) GetSnapshot(cqName string) []kueue.ClusterQueuePendingWorkload
- func (m *Manager) Heads(ctx context.Context) []workload.Info
- func (m *Manager) Pending(cq *kueue.ClusterQueue) int
- func (m *Manager) PendingWorkloads(q *kueue.LocalQueue) (int32, error)
- func (m *Manager) QueueAssociatedInadmissibleWorkloadsAfter(ctx context.Context, w *kueue.Workload, action func())
- func (m *Manager) QueueForWorkloadExists(wl *kueue.Workload) bool
- func (m *Manager) QueueInadmissibleWorkloads(ctx context.Context, cqNames sets.Set[string])
- func (m *Manager) RequeueWorkload(ctx context.Context, info *workload.Info, reason RequeueReason) bool
- func (m *Manager) UpdateClusterQueue(ctx context.Context, cq *kueue.ClusterQueue) error
- func (m *Manager) UpdateLocalQueue(q *kueue.LocalQueue) error
- func (m *Manager) UpdateSnapshot(cqName string, maxCount int32) bool
- func (m *Manager) UpdateWorkload(oldW, w *kueue.Workload) bool
- type RequeueReason
- type StatusChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClusterQueue ¶
type ClusterQueue interface { // Update updates the properties of this ClusterQueue. Update(*kueue.ClusterQueue) error // Cohort returns the Cohort of this ClusterQueue. Cohort() string // AddFromLocalQueue pushes all workloads belonging to this queue to // the ClusterQueue. If at least one workload is added, returns true. // Otherwise returns false. AddFromLocalQueue(*LocalQueue) bool // DeleteFromLocalQueue removes all workloads belonging to this queue from // the ClusterQueue. DeleteFromLocalQueue(*LocalQueue) // PushOrUpdate pushes the workload to ClusterQueue. // If the workload is already present, updates with the new one. PushOrUpdate(*workload.Info) // Delete removes the workload from ClusterQueue. Delete(*kueue.Workload) // Pop removes the head of the queue and returns it. It returns nil if the // queue is empty. Pop() *workload.Info // RequeueIfNotPresent inserts a workload that was not // admitted back into the ClusterQueue. If the boolean is true, // the workloads should be put back in the queue immediately, // because we couldn't determine if the workload was admissible // in the last cycle. If the boolean is false, the implementation might // choose to keep it in temporary placeholder stage where it doesn't // compete with other workloads, until cluster events free up quota. // The workload should not be reinserted if it's already in the ClusterQueue. // Returns true if the workload was inserted. RequeueIfNotPresent(*workload.Info, RequeueReason) bool // QueueInadmissibleWorkloads moves all workloads put in temporary placeholder stage // to the ClusterQueue. If at least one workload is moved, // returns true. Otherwise returns false. QueueInadmissibleWorkloads(ctx context.Context, client client.Client) bool // Pending returns the total number of pending workloads. Pending() int // PendingActive returns the number of active pending workloads, // workloads that are in the admission queue. PendingActive() int // PendingInadmissible returns the number of inadmissible pending workloads, // workloads that were already tried and are waiting for cluster conditions // to change to potentially become admissible. PendingInadmissible() int // Dump produces a dump of the current workloads in the heap of // this ClusterQueue. It returns false if the queue is empty. // Otherwise returns true. Dump() (sets.Set[string], bool) DumpInadmissible() (sets.Set[string], bool) // Snapshot returns a copy of the current workloads in the heap of // this ClusterQueue. Snapshot() []*workload.Info // Info returns workload.Info for the workload key. // Users of this method should not modify the returned object. Info(string) *workload.Info }
ClusterQueue is an interface for a cluster queue to store workloads waiting to be scheduled.
type ClusterQueueBestEffortFIFO ¶
type ClusterQueueBestEffortFIFO struct {
// contains filtered or unexported fields
}
ClusterQueueBestEffortFIFO is the implementation for the ClusterQueue for BestEffortFIFO.
func (ClusterQueueBestEffortFIFO) AddFromLocalQueue ¶ added in v0.3.0
func (c ClusterQueueBestEffortFIFO) AddFromLocalQueue(q *LocalQueue) bool
func (ClusterQueueBestEffortFIFO) Cohort ¶ added in v0.3.0
func (c ClusterQueueBestEffortFIFO) Cohort() string
func (ClusterQueueBestEffortFIFO) DeleteFromLocalQueue ¶ added in v0.3.0
func (c ClusterQueueBestEffortFIFO) DeleteFromLocalQueue(q *LocalQueue)
func (ClusterQueueBestEffortFIFO) DumpInadmissible ¶ added in v0.3.0
func (ClusterQueueBestEffortFIFO) Pending ¶ added in v0.1.1
func (c ClusterQueueBestEffortFIFO) Pending() int
func (ClusterQueueBestEffortFIFO) PendingActive ¶ added in v0.3.0
func (c ClusterQueueBestEffortFIFO) PendingActive() int
func (ClusterQueueBestEffortFIFO) PendingInadmissible ¶ added in v0.3.0
func (c ClusterQueueBestEffortFIFO) PendingInadmissible() int
func (ClusterQueueBestEffortFIFO) PushOrUpdate ¶
func (ClusterQueueBestEffortFIFO) QueueInadmissibleWorkloads ¶
func (c ClusterQueueBestEffortFIFO) QueueInadmissibleWorkloads(ctx context.Context, client client.Client) bool
QueueInadmissibleWorkloads moves all workloads from inadmissibleWorkloads to heap. If at least one workload is moved, returns true. Otherwise returns false.
func (*ClusterQueueBestEffortFIFO) RequeueIfNotPresent ¶
func (cq *ClusterQueueBestEffortFIFO) RequeueIfNotPresent(wInfo *workload.Info, reason RequeueReason) bool
func (ClusterQueueBestEffortFIFO) Update ¶ added in v0.3.0
func (c ClusterQueueBestEffortFIFO) Update(apiCQ *kueue.ClusterQueue) error
type ClusterQueueStrictFIFO ¶
type ClusterQueueStrictFIFO struct {
// contains filtered or unexported fields
}
ClusterQueueStrictFIFO is the implementation for the ClusterQueue for StrictFIFO.
func (ClusterQueueStrictFIFO) AddFromLocalQueue ¶ added in v0.3.0
func (c ClusterQueueStrictFIFO) AddFromLocalQueue(q *LocalQueue) bool
func (ClusterQueueStrictFIFO) Cohort ¶ added in v0.3.0
func (c ClusterQueueStrictFIFO) Cohort() string
func (ClusterQueueStrictFIFO) DeleteFromLocalQueue ¶ added in v0.3.0
func (c ClusterQueueStrictFIFO) DeleteFromLocalQueue(q *LocalQueue)
func (ClusterQueueStrictFIFO) DumpInadmissible ¶ added in v0.3.0
func (ClusterQueueStrictFIFO) Pending ¶ added in v0.3.0
func (c ClusterQueueStrictFIFO) Pending() int
func (ClusterQueueStrictFIFO) PendingActive ¶ added in v0.3.0
func (c ClusterQueueStrictFIFO) PendingActive() int
func (ClusterQueueStrictFIFO) PendingInadmissible ¶ added in v0.3.0
func (c ClusterQueueStrictFIFO) PendingInadmissible() int
func (ClusterQueueStrictFIFO) PushOrUpdate ¶ added in v0.3.0
func (ClusterQueueStrictFIFO) QueueInadmissibleWorkloads ¶ added in v0.3.0
func (c ClusterQueueStrictFIFO) QueueInadmissibleWorkloads(ctx context.Context, client client.Client) bool
QueueInadmissibleWorkloads moves all workloads from inadmissibleWorkloads to heap. If at least one workload is moved, returns true. Otherwise returns false.
func (*ClusterQueueStrictFIFO) RequeueIfNotPresent ¶ added in v0.3.0
func (cq *ClusterQueueStrictFIFO) RequeueIfNotPresent(wInfo *workload.Info, reason RequeueReason) bool
RequeueIfNotPresent requeues if the workload is not present. If the reason for requeue is that the workload doesn't match the CQ's namespace selector, then the requeue is not immediate.
func (ClusterQueueStrictFIFO) Update ¶ added in v0.3.0
func (c ClusterQueueStrictFIFO) Update(apiCQ *kueue.ClusterQueue) error
type LocalQueue ¶ added in v0.2.0
LocalQueue is the internal implementation of kueue.LocalQueue.
func (*LocalQueue) AddOrUpdate ¶ added in v0.2.0
func (q *LocalQueue) AddOrUpdate(info *workload.Info)
type Manager ¶
func NewManager ¶
func NewManager(client client.Client, checker StatusChecker) *Manager
func (*Manager) AddClusterQueue ¶
func (*Manager) AddLocalQueue ¶ added in v0.2.0
func (*Manager) AddOrUpdateWorkload ¶
AddOrUpdateWorkload adds or updates workload to the corresponding queue. Returns whether the queue existed.
func (*Manager) CleanUpOnContext ¶
CleanUpOnContext tracks the context. When closed, it wakes routines waiting on elements to be available. It should be called before doing any calls to Heads.
func (*Manager) ClusterQueueForWorkload ¶
ClusterQueueForWorkload returns the name of the ClusterQueue where the workload should be queued and whether it exists. Returns empty string if the queue doesn't exist.
func (*Manager) DeleteClusterQueue ¶
func (m *Manager) DeleteClusterQueue(cq *kueue.ClusterQueue)
func (*Manager) DeleteLocalQueue ¶ added in v0.2.0
func (m *Manager) DeleteLocalQueue(q *kueue.LocalQueue)
func (*Manager) DeleteSnapshot ¶ added in v0.5.0
func (m *Manager) DeleteSnapshot(cq *kueue.ClusterQueue)
func (*Manager) DeleteWorkload ¶
func (*Manager) Dump ¶
Dump is a dump of the queues and it's elements (unordered). Only use for testing purposes.
func (*Manager) DumpInadmissible ¶ added in v0.2.0
DumpInadmissible is a dump of the inadmissible workloads list. Only use for testing purposes.
func (*Manager) GetClusterQueueNames ¶ added in v0.5.0
func (*Manager) GetSnapshot ¶ added in v0.5.0
func (m *Manager) GetSnapshot(cqName string) []kueue.ClusterQueuePendingWorkload
func (*Manager) Heads ¶
Heads returns the heads of the queues, along with their associated ClusterQueue. It blocks if the queues empty until they have elements or the context terminates.
func (*Manager) PendingWorkloads ¶
func (m *Manager) PendingWorkloads(q *kueue.LocalQueue) (int32, error)
func (*Manager) QueueAssociatedInadmissibleWorkloadsAfter ¶ added in v0.3.0
func (m *Manager) QueueAssociatedInadmissibleWorkloadsAfter(ctx context.Context, w *kueue.Workload, action func())
QueueAssociatedInadmissibleWorkloadsAfter requeues into the heaps all previously inadmissible workloads in the same ClusterQueue and cohort (if they exist) as the provided admitted workload to the heaps. An optional action can be executed at the beginning of the function, while holding the lock, to provide atomicity with the operations in the queues.
func (*Manager) QueueForWorkloadExists ¶
func (*Manager) QueueInadmissibleWorkloads ¶ added in v0.2.0
QueueInadmissibleWorkloads moves all inadmissibleWorkloads in corresponding ClusterQueues to heap. If at least one workload queued, we will broadcast the event.
func (*Manager) RequeueWorkload ¶
func (m *Manager) RequeueWorkload(ctx context.Context, info *workload.Info, reason RequeueReason) bool
RequeueWorkload requeues the workload ensuring that the queue and the workload still exist in the client cache and it's not admitted. It won't requeue if the workload is already in the queue (possible if the workload was updated).
func (*Manager) UpdateClusterQueue ¶
func (*Manager) UpdateLocalQueue ¶ added in v0.2.0
func (m *Manager) UpdateLocalQueue(q *kueue.LocalQueue) error
func (*Manager) UpdateSnapshot ¶ added in v0.5.0
UpdateSnapshot computes the new snapshot and replaces if it differs from the previous version. It returns true if the snapshot was actually updated.
type RequeueReason ¶ added in v0.2.0
type RequeueReason string
const ( RequeueReasonFailedAfterNomination RequeueReason = "FailedAfterNomination" RequeueReasonNamespaceMismatch RequeueReason = "NamespaceMismatch" RequeueReasonGeneric RequeueReason = "" RequeueReasonPendingPreemption RequeueReason = "PendingPreemption" )
type StatusChecker ¶ added in v0.2.0
type StatusChecker interface { // ClusterQueueActive returns whether the clusterQueue is active. ClusterQueueActive(name string) bool }
StatusChecker checks status of clusterQueue.