@@ -68,12 +68,10 @@ type SchedulingQueue interface {
6868 Length () int
6969}
7070
71-
72-
7371// NewSchedulingQueue initializes a new scheduling queue. If pod priority is
7472// enabled a priority queue is returned. If it is disabled, a FIFO is returned.
7573func NewSchedulingQueue () SchedulingQueue {
76- return NewPriorityQueue ()
74+ return NewPriorityQueue ()
7775}
7876
7977// UnschedulablePods is an interface for a queue that is used to keep unschedulable
@@ -131,19 +129,21 @@ func (p *PriorityQueue) IfExist(qj *qjobv1.AppWrapper) bool {
131129 p .lock .Lock ()
132130 defer p .lock .Unlock ()
133131 _ , exists , _ := p .activeQ .Get (qj )
134- if ( p .unschedulableQ .Get (qj )!= nil || exists ) {
132+ if p .unschedulableQ .Get (qj ) != nil || exists {
135133 return true
136134 }
137135 return false
138136}
139137
138+ //used by queuejob_controller_ex.go
140139func (p * PriorityQueue ) IfExistActiveQ (qj * qjobv1.AppWrapper ) bool {
141140 p .lock .Lock ()
142141 defer p .lock .Unlock ()
143142 _ , exists , _ := p .activeQ .Get (qj )
144143 return exists
145144}
146145
146+ //used by queuejob_controller_ex.go
147147func (p * PriorityQueue ) IfExistUnschedulableQ (qj * qjobv1.AppWrapper ) bool {
148148 p .lock .Lock ()
149149 defer p .lock .Unlock ()
@@ -152,6 +152,7 @@ func (p *PriorityQueue) IfExistUnschedulableQ(qj *qjobv1.AppWrapper) bool {
152152}
153153
154154// Move QJ from unschedulableQ to activeQ if exists
155+ //used by queuejob_controller_ex.go
155156func (p * PriorityQueue ) MoveToActiveQueueIfExists (aw * qjobv1.AppWrapper ) error {
156157 p .lock .Lock ()
157158 defer p .lock .Unlock ()
@@ -167,9 +168,6 @@ func (p *PriorityQueue) MoveToActiveQueueIfExists(aw *qjobv1.AppWrapper) error {
167168 return nil
168169}
169170
170-
171-
172-
173171// Add adds a QJ to the active queue. It should be called only when a new QJ
174172// is added so there is no chance the QJ is already in either queue.
175173func (p * PriorityQueue ) Add (qj * qjobv1.AppWrapper ) error {
@@ -190,6 +188,7 @@ func (p *PriorityQueue) Add(qj *qjobv1.AppWrapper) error {
190188
191189// AddIfNotPresent adds a pod to the active queue if it is not present in any of
192190// the two queues. If it is present in any, it doesn't do any thing.
191+ //used by queuejob_controller_ex.go
193192func (p * PriorityQueue ) AddIfNotPresent (qj * qjobv1.AppWrapper ) error {
194193 p .lock .Lock ()
195194 defer p .lock .Unlock ()
@@ -208,16 +207,10 @@ func (p *PriorityQueue) AddIfNotPresent(qj *qjobv1.AppWrapper) error {
208207 return err
209208}
210209
211- func isPodUnschedulable (qj * qjobv1.AppWrapper ) bool {
212- //_, cond := podutil.GetPodCondition(&pod.Status, v1.PodScheduled)
213- //return cond != nil && cond.Status == v1.ConditionFalse && cond.Reason == v1.PodReasonUnschedulable
214- //TODO
215- return false
216- }
217-
218210// AddUnschedulableIfNotPresent does nothing if the pod is present in either
219211// queue. Otherwise it adds the pod to the unschedulable queue if
220212// p.receivedMoveRequest is false, and to the activeQ if p.receivedMoveRequest is true.
213+ //used by queuejob_controller_ex.go
221214func (p * PriorityQueue ) AddUnschedulableIfNotPresent (qj * qjobv1.AppWrapper ) error {
222215 p .lock .Lock ()
223216 defer p .lock .Unlock ()
@@ -242,6 +235,7 @@ func (p *PriorityQueue) AddUnschedulableIfNotPresent(qj *qjobv1.AppWrapper) erro
242235// Pop removes the head of the active queue and returns it. It blocks if the
243236// activeQ is empty and waits until a new item is added to the queue. It also
244237// clears receivedMoveRequest to mark the beginning of a new scheduling cycle.
238+ //used by queuejob_controller_ex.go
245239func (p * PriorityQueue ) Pop () (* qjobv1.AppWrapper , error ) {
246240 p .lock .Lock ()
247241 defer p .lock .Unlock ()
@@ -303,6 +297,7 @@ func (p *PriorityQueue) Update(oldQJ, newQJ *qjobv1.AppWrapper) error {
303297
304298// Delete deletes the item from either of the two queues. It assumes the pod is
305299// only in one queue.
300+ //used by queuejob_controller_ex.go
306301func (p * PriorityQueue ) Delete (qj * qjobv1.AppWrapper ) error {
307302 p .lock .Lock ()
308303 defer p .lock .Unlock ()
@@ -335,17 +330,6 @@ func (p *PriorityQueue) MoveAllToActiveQueue() {
335330 p .cond .Broadcast ()
336331}
337332
338- func (p * PriorityQueue ) movePodsToActiveQueue (pods []* qjobv1.AppWrapper ) {
339- p .lock .Lock ()
340- defer p .lock .Unlock ()
341- for _ , pod := range pods {
342- p .activeQ .Add (pod )
343- p .unschedulableQ .Delete (pod )
344- }
345- p .receivedMoveRequest = true
346- p .cond .Broadcast ()
347- }
348-
349333// UnschedulablePodsMap holds pods that cannot be scheduled. This data structure
350334// is used to implement unschedulableQ.
351335type UnschedulableQJMap struct {
0 commit comments