/// <summary>
        /// Compute the resources assigned to a Schedulable given a particular
        /// weight-to-resource ratio w2rRatio.
        /// </summary>
        private static int ComputeShare(Schedulable sched, double w2rRatio, ResourceType
                                        type)
        {
            double share = sched.GetWeights().GetWeight(type) * w2rRatio;

            share = Math.Max(share, GetResourceValue(sched.GetMinShare(), type));
            share = Math.Min(share, GetResourceValue(sched.GetMaxShare(), type));
            return((int)share);
        }
 /// <summary>
 /// Get the fairshare for the
 /// <see cref="Org.Apache.Hadoop.Yarn.Server.Resourcemanager.Scheduler.Fair.Schedulable
 ///     "/>
 /// if it is fixed, -1 otherwise.
 /// The fairshare is fixed if either the maxShare is 0, weight is 0,
 /// or the Schedulable is not active for instantaneous fairshare.
 /// </summary>
 private static int GetFairShareIfFixed(Schedulable sched, bool isSteadyShare, ResourceType
                                        type)
 {
     // Check if maxShare is 0
     if (GetResourceValue(sched.GetMaxShare(), type) <= 0)
     {
         return(0);
     }
     // For instantaneous fairshares, check if queue is active
     if (!isSteadyShare && (sched is FSQueue) && !((FSQueue)sched).IsActive())
     {
         return(0);
     }
     // Check if weight is 0
     if (sched.GetWeights().GetWeight(type) <= 0)
     {
         int minShare = GetResourceValue(sched.GetMinShare(), type);
         return((minShare <= 0) ? 0 : minShare);
     }
     return(-1);
 }