in pkg/scheduler/objects/queue.go [679:733]
func (sq *Queue) GetPartitionQueueDAOInfo(include bool) dao.PartitionQueueDAOInfo {
queueInfo := dao.PartitionQueueDAOInfo{}
children := sq.GetCopyOfChildren()
if include {
queueInfo.Children = make([]dao.PartitionQueueDAOInfo, 0, len(children))
for _, child := range children {
queueInfo.Children = append(queueInfo.Children, child.GetPartitionQueueDAOInfo(true))
}
}
// we have held the read lock so following method should not take lock again.
queueInfo.HeadRoom = sq.getHeadRoom().DAOMap()
sq.RLock()
defer sq.RUnlock()
for _, child := range children {
queueInfo.ChildNames = append(queueInfo.ChildNames, child.QueuePath)
}
queueInfo.QueueName = sq.QueuePath
queueInfo.Status = sq.stateMachine.Current()
queueInfo.PendingResource = sq.pending.DAOMap()
queueInfo.MaxResource = sq.maxResource.DAOMap()
queueInfo.GuaranteedResource = sq.guaranteedResource.DAOMap()
queueInfo.AllocatedResource = sq.allocatedResource.DAOMap()
queueInfo.PreemptingResource = sq.preemptingResource.DAOMap()
queueInfo.IsLeaf = sq.isLeaf
queueInfo.IsManaged = sq.isManaged
queueInfo.CurrentPriority = sq.getCurrentPriority()
queueInfo.TemplateInfo = sq.template.GetTemplateInfo()
queueInfo.AbsUsedCapacity = resources.CalculateAbsUsedCapacity(sq.maxResource, sq.allocatedResource).DAOMap()
queueInfo.SortingPolicy = sq.sortType.String()
queueInfo.PrioritySorting = sq.prioritySortEnabled
queueInfo.PreemptionEnabled = sq.preemptionPolicy != policies.DisabledPreemptionPolicy
queueInfo.IsPreemptionFence = sq.preemptionPolicy == policies.FencePreemptionPolicy
queueInfo.PreemptionDelay = sq.preemptionDelay.String()
queueInfo.IsPriorityFence = sq.priorityPolicy == policies.FencePriorityPolicy
queueInfo.PriorityOffset = sq.priorityOffset
queueInfo.Properties = make(map[string]string)
for k, v := range sq.properties {
queueInfo.Properties[k] = v
}
if sq.parent == nil {
queueInfo.Parent = ""
} else {
queueInfo.Parent = sq.QueuePath[:strings.LastIndex(sq.QueuePath, configs.DOT)]
}
queueInfo.MaxRunningApps = sq.maxRunningApps
queueInfo.RunningApps = sq.runningApps
queueInfo.AllocatingAcceptedApps = make([]string, 0)
for appID, result := range sq.allocatingAcceptedApps {
if result {
queueInfo.AllocatingAcceptedApps = append(queueInfo.AllocatingAcceptedApps, appID)
}
}
return queueInfo
}