YARN-10675. Consolidate YARN-10672 and YARN-10447. Contributed by Szilard Nemeth.
This commit is contained in:
parent
e472ee2aa5
commit
20416bc62d
|
@ -249,8 +249,6 @@ public class CapacityScheduler extends
|
|||
|
||||
private CSMaxRunningAppsEnforcer maxRunningEnforcer;
|
||||
|
||||
private boolean activitiesManagerEnabled = true;
|
||||
|
||||
public CapacityScheduler() {
|
||||
super(CapacityScheduler.class.getName());
|
||||
this.maxRunningEnforcer = new CSMaxRunningAppsEnforcer(this);
|
||||
|
@ -351,9 +349,7 @@ public class CapacityScheduler extends
|
|||
this.workflowPriorityMappingsMgr = new WorkflowPriorityMappingsManager();
|
||||
|
||||
this.activitiesManager = new ActivitiesManager(rmContext);
|
||||
if (activitiesManagerEnabled) {
|
||||
activitiesManager.init(conf);
|
||||
}
|
||||
activitiesManager.init(conf);
|
||||
initializeQueues(this.conf);
|
||||
this.isLazyPreemptionEnabled = conf.getLazyPreemptionEnabled();
|
||||
|
||||
|
@ -411,9 +407,7 @@ public class CapacityScheduler extends
|
|||
private void startSchedulerThreads() {
|
||||
writeLock.lock();
|
||||
try {
|
||||
if (activitiesManagerEnabled) {
|
||||
activitiesManager.start();
|
||||
}
|
||||
activitiesManager.start();
|
||||
if (scheduleAsynchronously) {
|
||||
Preconditions.checkNotNull(asyncSchedulerThreads,
|
||||
"asyncSchedulerThreads is null");
|
||||
|
@ -447,9 +441,7 @@ public class CapacityScheduler extends
|
|||
public void serviceStop() throws Exception {
|
||||
writeLock.lock();
|
||||
try {
|
||||
if (activitiesManagerEnabled) {
|
||||
this.activitiesManager.stop();
|
||||
}
|
||||
this.activitiesManager.stop();
|
||||
if (scheduleAsynchronously && asyncSchedulerThreads != null) {
|
||||
for (Thread t : asyncSchedulerThreads) {
|
||||
t.interrupt();
|
||||
|
@ -3480,7 +3472,6 @@ public class CapacityScheduler extends
|
|||
this.maxRunningEnforcer = enforcer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returning true as capacity scheduler supports placement constraints.
|
||||
*/
|
||||
|
@ -3489,11 +3480,6 @@ public class CapacityScheduler extends
|
|||
return true;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void setActivitiesManagerEnabled(boolean enabled) {
|
||||
this.activitiesManagerEnabled = enabled;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void setQueueManager(CapacitySchedulerQueueManager qm) {
|
||||
this.queueManager = qm;
|
||||
|
|
|
@ -162,9 +162,13 @@ public class TestLeafQueue {
|
|||
private void setUpInternal(ResourceCalculator rC, boolean withNodeLabels)
|
||||
throws Exception {
|
||||
CapacityScheduler spyCs = new CapacityScheduler();
|
||||
spyCs.setActivitiesManagerEnabled(false);
|
||||
queues = new CSQueueStore();
|
||||
cs = spy(spyCs);
|
||||
|
||||
//All stub calls on the spy object of the 'cs' field should happen
|
||||
//before cs.start() is invoked. See YARN-10672 for more details.
|
||||
when(cs.getNumClusterNodes()).thenReturn(3);
|
||||
|
||||
rmContext = TestUtils.getMockRMContext();
|
||||
spyRMContext = spy(rmContext);
|
||||
|
||||
|
@ -231,7 +235,6 @@ public class TestLeafQueue {
|
|||
when(spyRMContext.getScheduler()).thenReturn(cs);
|
||||
when(spyRMContext.getYarnConfiguration())
|
||||
.thenReturn(new YarnConfiguration());
|
||||
when(cs.getNumClusterNodes()).thenReturn(3);
|
||||
cs.start();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue