Esempio n. 1
0
 public override void UpdateClusterResource(Org.Apache.Hadoop.Yarn.Api.Records.Resource
                                            clusterResource, ResourceLimits resourceLimits)
 {
     lock (this)
     {
         // Update all children
         foreach (CSQueue childQueue in childQueues)
         {
             // Get ResourceLimits of child queue before assign containers
             ResourceLimits childLimits = GetResourceLimitsOfChild(childQueue, clusterResource
                                                                   , resourceLimits);
             childQueue.UpdateClusterResource(clusterResource, childLimits);
         }
         // Update metrics
         CSQueueUtils.UpdateQueueStatistics(resourceCalculator, this, parent, clusterResource
                                            , minimumAllocation);
     }
 }
Esempio n. 2
0
 /// <exception cref="System.IO.IOException"/>
 public override void Reinitialize(CSQueue newlyParsedQueue, Resource clusterResource
                                   )
 {
     lock (this)
     {
         // Sanity check
         if (!(newlyParsedQueue is Org.Apache.Hadoop.Yarn.Server.Resourcemanager.Scheduler.Capacity.ReservationQueue
               ) || !newlyParsedQueue.GetQueuePath().Equals(GetQueuePath()))
         {
             throw new IOException("Trying to reinitialize " + GetQueuePath() + " from " + newlyParsedQueue
                                   .GetQueuePath());
         }
         base.Reinitialize(newlyParsedQueue, clusterResource);
         CSQueueUtils.UpdateQueueStatistics(parent.schedulerContext.GetResourceCalculator(
                                                ), newlyParsedQueue, parent, parent.schedulerContext.GetClusterResource(), parent
                                            .schedulerContext.GetMinimumResourceCapability());
         UpdateQuotas(parent.GetUserLimitForReservation(), parent.GetUserLimitFactor(), parent
                      .GetMaxApplicationsForReservations(), parent.GetMaxApplicationsPerUserForReservation
                          ());
     }
 }
Esempio n. 3
0
 protected internal virtual void ReleaseResource(Org.Apache.Hadoop.Yarn.Api.Records.Resource
                                                 clusterResource, Org.Apache.Hadoop.Yarn.Api.Records.Resource resource, ICollection
                                                 <string> nodeLabels)
 {
     lock (this)
     {
         // Update usedResources by labels
         if (null == nodeLabels || nodeLabels.IsEmpty())
         {
             queueUsage.DecUsed(resource);
         }
         else
         {
             foreach (string label in Sets.Intersection(accessibleLabels, nodeLabels))
             {
                 queueUsage.DecUsed(label, resource);
             }
         }
         CSQueueUtils.UpdateQueueStatistics(resourceCalculator, this, GetParent(), clusterResource
                                            , minimumAllocation);
         --numContainers;
     }
 }
Esempio n. 4
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);
     }
 }