コード例 #1
0
        /// <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
                                                    ()));
        }