/// <summary> /// The specified queue is preemptable if system-wide preemption is turned on /// unless any queue in the <em>qPath</em> hierarchy has explicitly turned /// preemption off. /// </summary> /// <remarks> /// The specified queue is preemptable if system-wide preemption is turned on /// unless any queue in the <em>qPath</em> hierarchy has explicitly turned /// preemption off. /// NOTE: Preemptability is inherited from a queue's parent. /// </remarks> /// <returns>true if queue has preemption disabled, false otherwise</returns> private bool IsQueueHierarchyPreemptionDisabled(CSQueue q) { CapacitySchedulerConfiguration csConf = csContext.GetConfiguration(); bool systemWidePreemption = csConf.GetBoolean(YarnConfiguration.RmSchedulerEnableMonitors , YarnConfiguration.DefaultRmSchedulerEnableMonitors); CSQueue parentQ = q.GetParent(); // If the system-wide preemption switch is turned off, all of the queues in // the qPath hierarchy have preemption disabled, so return true. if (!systemWidePreemption) { return(true); } // If q is the root queue and the system-wide preemption switch is turned // on, then q does not have preemption disabled (default=false, below) // unless the preemption_disabled property is explicitly set. if (parentQ == null) { return(csConf.GetPreemptionDisabled(q.GetQueuePath(), false)); } // If this is not the root queue, inherit the default value for the // preemption_disabled property from the parent. Preemptability will be // inherited from the parent's hierarchy unless explicitly overridden at // this level. return(csConf.GetPreemptionDisabled(q.GetQueuePath(), parentQ.GetPreemptionDisabled ())); }
/// <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); } }