|
@@ -91,6 +91,7 @@ public abstract class FSQueue implements Queue, Schedulable {
|
|
|
this.queueEntity = new PrivilegedEntity(EntityType.QUEUE, name);
|
|
|
this.metrics = FSQueueMetrics.forQueue(getName(), parent, true, scheduler.getConf());
|
|
|
this.parent = parent;
|
|
|
+ reinit(false);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -98,10 +99,19 @@ public abstract class FSQueue implements Queue, Schedulable {
|
|
|
* metrics.
|
|
|
* This function is invoked when a new queue is created or reloading the
|
|
|
* allocation configuration.
|
|
|
+ *
|
|
|
+ * @param recursive whether child queues should be reinitialized recursively
|
|
|
*/
|
|
|
- public void init() {
|
|
|
+ public void reinit(boolean recursive) {
|
|
|
AllocationConfiguration allocConf = scheduler.getAllocationConfiguration();
|
|
|
allocConf.initFSQueue(this, scheduler);
|
|
|
+ updatePreemptionVariables();
|
|
|
+
|
|
|
+ if (recursive) {
|
|
|
+ for (FSQueue child : getChildQueues()) {
|
|
|
+ child.reinit(recursive);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public String getName() {
|
|
@@ -307,6 +317,7 @@ public abstract class FSQueue implements Queue, Schedulable {
|
|
|
this.fairSharePreemptionThreshold = fairSharePreemptionThreshold;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
public boolean isPreemptable() {
|
|
|
return preemptable;
|
|
|
}
|
|
@@ -329,7 +340,7 @@ public abstract class FSQueue implements Queue, Schedulable {
|
|
|
* Update the min/fair share preemption timeouts, threshold and preemption
|
|
|
* disabled flag for this queue.
|
|
|
*/
|
|
|
- public void updatePreemptionVariables() {
|
|
|
+ private void updatePreemptionVariables() {
|
|
|
// For min share timeout
|
|
|
minSharePreemptionTimeout = scheduler.getAllocationConfiguration()
|
|
|
.getMinSharePreemptionTimeout(getName());
|
|
@@ -348,9 +359,15 @@ public abstract class FSQueue implements Queue, Schedulable {
|
|
|
if (fairSharePreemptionThreshold < 0 && parent != null) {
|
|
|
fairSharePreemptionThreshold = parent.getFairSharePreemptionThreshold();
|
|
|
}
|
|
|
- // For option whether allow preemption from this queue
|
|
|
- preemptable = scheduler.getAllocationConfiguration()
|
|
|
- .isPreemptable(getName());
|
|
|
+ // For option whether allow preemption from this queue.
|
|
|
+ // If the parent is non-preemptable, this queue is non-preemptable as well,
|
|
|
+ // otherwise get the value from the allocation file.
|
|
|
+ if (parent != null && !parent.isPreemptable()) {
|
|
|
+ preemptable = false;
|
|
|
+ } else {
|
|
|
+ preemptable = scheduler.getAllocationConfiguration()
|
|
|
+ .isPreemptable(getName());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|