Example #1
0
        internal CapacitySchedulerQueueInfo(CSQueue q)
        {
            queuePath    = q.GetQueuePath();
            capacity     = q.GetCapacity() * 100;
            usedCapacity = q.GetUsedCapacity() * 100;
            maxCapacity  = q.GetMaximumCapacity();
            if (maxCapacity < Epsilon || maxCapacity > 1f)
            {
                maxCapacity = 1f;
            }
            maxCapacity         *= 100;
            absoluteCapacity     = Cap(q.GetAbsoluteCapacity(), 0f, 1f) * 100;
            absoluteMaxCapacity  = Cap(q.GetAbsoluteMaximumCapacity(), 0f, 1f) * 100;
            absoluteUsedCapacity = Cap(q.GetAbsoluteUsedCapacity(), 0f, 1f) * 100;
            numApplications      = q.GetNumApplications();
            queueName            = q.GetQueueName();
            state         = q.GetState();
            resourcesUsed = new ResourceInfo(q.GetUsedResources());
            if (q is PlanQueue && !((PlanQueue)q).ShowReservationsAsQueues())
            {
                hideReservationQueues = true;
            }
            // add labels
            ICollection <string> labelSet = q.GetAccessibleNodeLabels();

            if (labelSet != null)
            {
                Sharpen.Collections.AddAll(nodeLabels, labelSet);
                nodeLabels.Sort();
            }
        }
Example #2
0
 /// <exception cref="System.IO.IOException"/>
 internal virtual void SetupQueueConfigs(Org.Apache.Hadoop.Yarn.Api.Records.Resource
                                         clusterResource)
 {
     lock (this)
     {
         // get labels
         this.accessibleLabels = csContext.GetConfiguration().GetAccessibleNodeLabels(GetQueuePath
                                                                                          ());
         this.defaultLabelExpression = csContext.GetConfiguration().GetDefaultNodeLabelExpression
                                           (GetQueuePath());
         // inherit from parent if labels not set
         if (this.accessibleLabels == null && parent != null)
         {
             this.accessibleLabels = parent.GetAccessibleNodeLabels();
         }
         // inherit from parent if labels not set
         if (this.defaultLabelExpression == null && parent != null && this.accessibleLabels
             .ContainsAll(parent.GetAccessibleNodeLabels()))
         {
             this.defaultLabelExpression = parent.GetDefaultNodeLabelExpression();
         }
         // After we setup labels, we can setup capacities
         SetupConfigurableCapacities();
         this.maximumAllocation = csContext.GetConfiguration().GetMaximumAllocationPerQueue
                                      (GetQueuePath());
         authorizer = YarnAuthorizationProvider.GetInstance(csContext.GetConf());
         this.state = csContext.GetConfiguration().GetState(GetQueuePath());
         this.acls  = csContext.GetConfiguration().GetAcls(GetQueuePath());
         // Update metrics
         CSQueueUtils.UpdateQueueStatistics(resourceCalculator, this, parent, clusterResource
                                            , minimumAllocation);
         // Check if labels of this queue is a subset of parent queue, only do this
         // when we not root
         if (parent != null && parent.GetParent() != null)
         {
             if (parent.GetAccessibleNodeLabels() != null && !parent.GetAccessibleNodeLabels()
                 .Contains(RMNodeLabelsManager.Any))
             {
                 // if parent isn't "*", child shouldn't be "*" too
                 if (this.GetAccessibleNodeLabels().Contains(RMNodeLabelsManager.Any))
                 {
                     throw new IOException("Parent's accessible queue is not ANY(*), " + "but child's accessible queue is *"
                                           );
                 }
                 else
                 {
                     ICollection <string> diff = Sets.Difference(this.GetAccessibleNodeLabels(), parent
                                                                 .GetAccessibleNodeLabels());
                     if (!diff.IsEmpty())
                     {
                         throw new IOException("Some labels of child queue is not a subset " + "of parent queue, these labels=["
                                               + StringUtils.Join(diff, ",") + "]");
                     }
                 }
             }
         }
         this.reservationsContinueLooking = csContext.GetConfiguration().GetReservationContinueLook
                                                ();
         this.preemptionDisabled = IsQueueHierarchyPreemptionDisabled(this);
     }
 }