Skip to content

Commit 92e065f

Browse files
committed
add default quota to AW
1 parent 7a5b67e commit 92e065f

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
@@ -1261,6 +1261,33 @@ func (qjm *XController) ScheduleNext() {
12611261

12621262
if aggqj.LessEqual(resources) && qjm.nodeChecks(qjm.cache.GetUnallocatedHistograms(), qj) {
12631263
//Now evaluate quota
1264+
//Quota tree design:
1265+
// Quota tree should have two nodes : default node and experimental node
1266+
// default node should have the same quota as root node with hardlimit set to True
1267+
// experimental node is the node which will borrow resources with hardlimit set to False but
1268+
// quota set to much lower value than default node.
1269+
1270+
// All non-quota submission AWs will consume quota from default node.
1271+
1272+
//Find if AW has label named "quota_context"
1273+
allLabels := qj.Labels
1274+
quotaSetForAw := false
1275+
for labelk, _ := range allLabels {
1276+
if labelk == "quota_context" {
1277+
quotaSetForAw = true
1278+
}
1279+
}
1280+
if quotaSetForAw == false {
1281+
qj.Labels["quota_context"] = "default"
1282+
if err := qjm.updateEtcd(qj, "ScheduleNext - setDefaultQuota"); err == nil {
1283+
klog.V(3).Infof("[ScheduleNext] Default quota added to AW %v", qj.Name)
1284+
}
1285+
1286+
if err != nil {
1287+
klog.V(3).Infof("[ScheduleNext] Failed to added default quota to AW %v, skipping dispatch of AW", qj.Name)
1288+
return
1289+
}
1290+
}
12641291
fits := true
12651292
klog.V(4).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)
12661293
if qjm.serverOption.QuotaEnabled {

0 commit comments

Comments
 (0)