MCPcopy Create free account
hub / github.com/cortexproject/cortex / getPriorityList

Function getPriorityList

pkg/scheduler/queue/user_queues.go:391–409  ·  view source on GitHub ↗

getPriorityList returns a list of priorities, each priority repeated as much as number of reserved queriers. This is used when creating map of reserved queriers.

(queryPriority validation.QueryPriority, totalQuerierCount int)

Source from the content-addressed store, hash-verified

389// getPriorityList returns a list of priorities, each priority repeated as much as number of reserved queriers.
390// This is used when creating map of reserved queriers.
391func getPriorityList(queryPriority validation.QueryPriority, totalQuerierCount int) []int64 {
392 var priorityList []int64
393
394 if queryPriority.Enabled {
395 for _, priority := range queryPriority.Priorities {
396 reservedQuerierShardSize := util.DynamicShardSize(priority.ReservedQueriers, totalQuerierCount)
397
398 for range reservedQuerierShardSize {
399 priorityList = append(priorityList, priority.Priority)
400 }
401 }
402 }
403
404 if len(priorityList) >= totalQuerierCount {
405 return []int64{}
406 }
407
408 return priorityList
409}
410
411func hasPriorityListChanged(old, new []int64) bool {
412 if len(old) != len(new) {

Callers 2

getOrAddQueueMethod · 0.85
TestGetPriorityListFunction · 0.85

Calls 1

DynamicShardSizeFunction · 0.92

Tested by 1

TestGetPriorityListFunction · 0.68