func()

in pkg/scheduler/objects/queue.go [488:555]


func (sq *Queue) UpdateQueueProperties() {
	sq.Lock()
	defer sq.Unlock()
	if common.IsRecoveryQueue(sq.QueuePath) {
		// recovery queue properties should never be updated
		sq.sortType = policies.FifoSortPolicy
		return
	}
	if !sq.isLeaf {
		// set the sorting type for parent queues
		sq.sortType = policies.FairSortPolicy
	}
	// walk over all properties and process
	var err error
	for key, value := range sq.properties {
		switch key {
		case configs.ApplicationSortPolicy:
			if sq.isLeaf {
				sq.sortType, err = policies.SortPolicyFromString(value)
				if err != nil {
					log.Log(log.SchedQueue).Debug("application sort property configuration error",
						zap.Error(err))
				}
				// if it is not defined default to fifo
				if sq.sortType == policies.Undefined {
					sq.sortType = policies.FifoSortPolicy
				}
			}
		case configs.ApplicationSortPriority:
			sq.prioritySortEnabled, err = applicationSortPriorityEnabled(value)
			if err != nil {
				log.Log(log.SchedQueue).Debug("queue application sort priority configuration error",
					zap.Error(err))
			}
		case configs.PriorityOffset:
			sq.priorityOffset, err = priorityOffset(value)
			if err != nil {
				log.Log(log.SchedQueue).Debug("queue priority offset configuration error",
					zap.Error(err))
			}
		case configs.PriorityPolicy:
			sq.priorityPolicy, err = policies.PriorityPolicyFromString(value)
			if err != nil {
				log.Log(log.SchedQueue).Debug("queue priority policy configuration error",
					zap.Error(err))
			}
		case configs.PreemptionPolicy:
			sq.preemptionPolicy, err = policies.PreemptionPolicyFromString(value)
			if err != nil {
				log.Log(log.SchedQueue).Debug("queue preemption policy configuration error",
					zap.Error(err))
			}
		case configs.PreemptionDelay:
			if sq.isLeaf {
				sq.preemptionDelay, err = preemptionDelay(value)
				if err != nil {
					log.Log(log.SchedQueue).Debug("preemption delay property configuration error",
						zap.Error(err))
				}
			}
		default:
			// skip unknown properties just log them
			log.Log(log.SchedQueue).Debug("queue property skipped",
				zap.String("key", key),
				zap.String("value", value))
		}
	}
}