@@ -68,12 +68,10 @@ type SchedulingQueue interface {
68
68
Length () int
69
69
}
70
70
71
-
72
-
73
71
// NewSchedulingQueue initializes a new scheduling queue. If pod priority is
74
72
// enabled a priority queue is returned. If it is disabled, a FIFO is returned.
75
73
func NewSchedulingQueue () SchedulingQueue {
76
- return NewPriorityQueue ()
74
+ return NewPriorityQueue ()
77
75
}
78
76
79
77
// 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 {
131
129
p .lock .Lock ()
132
130
defer p .lock .Unlock ()
133
131
_ , exists , _ := p .activeQ .Get (qj )
134
- if ( p .unschedulableQ .Get (qj )!= nil || exists ) {
132
+ if p .unschedulableQ .Get (qj ) != nil || exists {
135
133
return true
136
134
}
137
135
return false
138
136
}
139
137
138
+ //used by queuejob_controller_ex.go
140
139
func (p * PriorityQueue ) IfExistActiveQ (qj * qjobv1.AppWrapper ) bool {
141
140
p .lock .Lock ()
142
141
defer p .lock .Unlock ()
143
142
_ , exists , _ := p .activeQ .Get (qj )
144
143
return exists
145
144
}
146
145
146
+ //used by queuejob_controller_ex.go
147
147
func (p * PriorityQueue ) IfExistUnschedulableQ (qj * qjobv1.AppWrapper ) bool {
148
148
p .lock .Lock ()
149
149
defer p .lock .Unlock ()
@@ -152,6 +152,7 @@ func (p *PriorityQueue) IfExistUnschedulableQ(qj *qjobv1.AppWrapper) bool {
152
152
}
153
153
154
154
// Move QJ from unschedulableQ to activeQ if exists
155
+ //used by queuejob_controller_ex.go
155
156
func (p * PriorityQueue ) MoveToActiveQueueIfExists (aw * qjobv1.AppWrapper ) error {
156
157
p .lock .Lock ()
157
158
defer p .lock .Unlock ()
@@ -167,9 +168,6 @@ func (p *PriorityQueue) MoveToActiveQueueIfExists(aw *qjobv1.AppWrapper) error {
167
168
return nil
168
169
}
169
170
170
-
171
-
172
-
173
171
// Add adds a QJ to the active queue. It should be called only when a new QJ
174
172
// is added so there is no chance the QJ is already in either queue.
175
173
func (p * PriorityQueue ) Add (qj * qjobv1.AppWrapper ) error {
@@ -190,6 +188,7 @@ func (p *PriorityQueue) Add(qj *qjobv1.AppWrapper) error {
190
188
191
189
// AddIfNotPresent adds a pod to the active queue if it is not present in any of
192
190
// the two queues. If it is present in any, it doesn't do any thing.
191
+ //used by queuejob_controller_ex.go
193
192
func (p * PriorityQueue ) AddIfNotPresent (qj * qjobv1.AppWrapper ) error {
194
193
p .lock .Lock ()
195
194
defer p .lock .Unlock ()
@@ -208,16 +207,10 @@ func (p *PriorityQueue) AddIfNotPresent(qj *qjobv1.AppWrapper) error {
208
207
return err
209
208
}
210
209
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
-
218
210
// AddUnschedulableIfNotPresent does nothing if the pod is present in either
219
211
// queue. Otherwise it adds the pod to the unschedulable queue if
220
212
// p.receivedMoveRequest is false, and to the activeQ if p.receivedMoveRequest is true.
213
+ //used by queuejob_controller_ex.go
221
214
func (p * PriorityQueue ) AddUnschedulableIfNotPresent (qj * qjobv1.AppWrapper ) error {
222
215
p .lock .Lock ()
223
216
defer p .lock .Unlock ()
@@ -242,6 +235,7 @@ func (p *PriorityQueue) AddUnschedulableIfNotPresent(qj *qjobv1.AppWrapper) erro
242
235
// Pop removes the head of the active queue and returns it. It blocks if the
243
236
// activeQ is empty and waits until a new item is added to the queue. It also
244
237
// clears receivedMoveRequest to mark the beginning of a new scheduling cycle.
238
+ //used by queuejob_controller_ex.go
245
239
func (p * PriorityQueue ) Pop () (* qjobv1.AppWrapper , error ) {
246
240
p .lock .Lock ()
247
241
defer p .lock .Unlock ()
@@ -303,6 +297,7 @@ func (p *PriorityQueue) Update(oldQJ, newQJ *qjobv1.AppWrapper) error {
303
297
304
298
// Delete deletes the item from either of the two queues. It assumes the pod is
305
299
// only in one queue.
300
+ //used by queuejob_controller_ex.go
306
301
func (p * PriorityQueue ) Delete (qj * qjobv1.AppWrapper ) error {
307
302
p .lock .Lock ()
308
303
defer p .lock .Unlock ()
@@ -335,17 +330,6 @@ func (p *PriorityQueue) MoveAllToActiveQueue() {
335
330
p .cond .Broadcast ()
336
331
}
337
332
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
-
349
333
// UnschedulablePodsMap holds pods that cannot be scheduled. This data structure
350
334
// is used to implement unschedulableQ.
351
335
type UnschedulableQJMap struct {
0 commit comments