Skip to content

Commit d65c3a5

Browse files
committed
add default quota to AW
1 parent c1dde5e commit d65c3a5

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

pkg/controller/queuejob/queuejob_controller_ex.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,33 @@ func (qjm *XController) ScheduleNext() {
12521252

12531253
if aggqj.LessEqual(resources) && qjm.nodeChecks(qjm.cache.GetUnallocatedHistograms(), qj) {
12541254
//Now evaluate quota
1255+
//Quota tree design:
1256+
// Quota tree should have two nodes : default node and experimental node
1257+
// default node should have the same quota as root node with hardlimit set to True
1258+
// experimental node is the node which will borrow resources with hardlimit set to False but
1259+
// quota set to much lower value than default node.
1260+
1261+
// All non-quota submission AWs will consume quota from default node.
1262+
1263+
//Find if AW has label named "quota_context"
1264+
allLabels := qj.Labels
1265+
quotaSetForAw := false
1266+
for labelk, _ := range allLabels {
1267+
if labelk == "quota_context" {
1268+
quotaSetForAw = true
1269+
}
1270+
}
1271+
if quotaSetForAw == false {
1272+
qj.Labels["quota_context"] = "default"
1273+
if err := qjm.updateEtcd(qj, "ScheduleNext - setDefaultQuota"); err == nil {
1274+
klog.V(3).Infof("[ScheduleNext] Default quota added to AW %v", qj.Name)
1275+
}
1276+
1277+
if err != nil {
1278+
klog.V(3).Infof("[ScheduleNext] Failed to added default quota to AW %v, skipping dispatch of AW", qj.Name)
1279+
return
1280+
}
1281+
}
12551282
fits := true
12561283
klog.V(10).Infof("[ScheduleNext] HOL available resourse successful check for %s at %s activeQ=%t Unsched=%t &qj=%p Version=%s Status=%+v due to quota limits", qj.Name, time.Now().Sub(HOLStartTime), qjm.qjqueue.IfExistActiveQ(qj), qjm.qjqueue.IfExistUnschedulableQ(qj), qj, qj.ResourceVersion, qj.Status)
12571284
if qjm.serverOption.QuotaEnabled {

0 commit comments

Comments
 (0)