public FifoSchedulerInfo(ResourceManager rm)
        {
            // JAXB needs this
            RMContext     rmContext = rm.GetRMContext();
            FifoScheduler fs        = (FifoScheduler)rm.GetResourceScheduler();

            qName = fs.GetQueueInfo(string.Empty, false, false).GetQueueName();
            QueueInfo qInfo = fs.GetQueueInfo(qName, true, true);

            this.usedCapacity           = qInfo.GetCurrentCapacity();
            this.capacity               = qInfo.GetCapacity();
            this.minQueueMemoryCapacity = fs.GetMinimumResourceCapability().GetMemory();
            this.maxQueueMemoryCapacity = fs.GetMaximumResourceCapability().GetMemory();
            this.qstate            = qInfo.GetQueueState();
            this.numNodes          = rmContext.GetRMNodes().Count;
            this.usedNodeCapacity  = 0;
            this.availNodeCapacity = 0;
            this.totalNodeCapacity = 0;
            this.numContainers     = 0;
            foreach (RMNode ni in rmContext.GetRMNodes().Values)
            {
                SchedulerNodeReport report = fs.GetNodeReport(ni.GetNodeID());
                this.usedNodeCapacity  += report.GetUsedResource().GetMemory();
                this.availNodeCapacity += report.GetAvailableResource().GetMemory();
                this.totalNodeCapacity += ni.GetTotalCapability().GetMemory();
                this.numContainers     += fs.GetNodeReport(ni.GetNodeID()).GetNumContainers();
            }
        }
Beispiel #2
0
        private void PrintQueueInfo(PrintWriter writer, QueueInfo queueInfo)
        {
            writer.Write("Queue Name : ");
            writer.WriteLine(queueInfo.GetQueueName());
            writer.Write("\tState : ");
            writer.WriteLine(queueInfo.GetQueueState());
            DecimalFormat df = new DecimalFormat("#.0");

            writer.Write("\tCapacity : ");
            writer.WriteLine(df.Format(queueInfo.GetCapacity() * 100) + "%");
            writer.Write("\tCurrent Capacity : ");
            writer.WriteLine(df.Format(queueInfo.GetCurrentCapacity() * 100) + "%");
            writer.Write("\tMaximum Capacity : ");
            writer.WriteLine(df.Format(queueInfo.GetMaximumCapacity() * 100) + "%");
            writer.Write("\tDefault Node Label expression : ");
            if (null != queueInfo.GetDefaultNodeLabelExpression())
            {
                writer.WriteLine(queueInfo.GetDefaultNodeLabelExpression());
            }
            else
            {
                writer.WriteLine();
            }
            ICollection <string> nodeLabels = queueInfo.GetAccessibleNodeLabels();
            StringBuilder        labelList  = new StringBuilder();

            writer.Write("\tAccessible Node Labels : ");
            foreach (string nodeLabel in nodeLabels)
            {
                if (labelList.Length > 0)
                {
                    labelList.Append(',');
                }
                labelList.Append(nodeLabel);
            }
            writer.WriteLine(labelList.ToString());
        }