コード例 #1
0
        public static void UpdateQueueStatistics(ResourceCalculator calculator, CSQueue childQueue
                                                 , CSQueue parentQueue, Org.Apache.Hadoop.Yarn.Api.Records.Resource clusterResource
                                                 , Org.Apache.Hadoop.Yarn.Api.Records.Resource minimumAllocation)
        {
            Org.Apache.Hadoop.Yarn.Api.Records.Resource queueLimit    = Resources.None();
            Org.Apache.Hadoop.Yarn.Api.Records.Resource usedResources = childQueue.GetUsedResources
                                                                            ();
            float absoluteUsedCapacity = 0.0f;
            float usedCapacity         = 0.0f;

            if (Resources.GreaterThan(calculator, clusterResource, clusterResource, Resources
                                      .None()))
            {
                queueLimit = Resources.Multiply(clusterResource, childQueue.GetAbsoluteCapacity()
                                                );
                absoluteUsedCapacity = Resources.Divide(calculator, clusterResource, usedResources
                                                        , clusterResource);
                usedCapacity = Resources.Equals(queueLimit, Resources.None()) ? 0 : Resources.Divide
                                   (calculator, clusterResource, usedResources, queueLimit);
            }
            childQueue.SetUsedCapacity(usedCapacity);
            childQueue.SetAbsoluteUsedCapacity(absoluteUsedCapacity);
            Org.Apache.Hadoop.Yarn.Api.Records.Resource available = Resources.Subtract(queueLimit
                                                                                       , usedResources);
            childQueue.GetMetrics().SetAvailableResourcesToQueue(Resources.Max(calculator, clusterResource
                                                                               , available, Resources.None()));
        }