YARN-10447. TestLeafQueue: ActivitiesManager thread might interfere with ongoing stubbing. Contributed by Peter Bacsko
This commit is contained in:
parent
d68d2a5c1e
commit
bb8446e80c
|
@ -245,6 +245,8 @@ public class CapacityScheduler extends
|
||||||
|
|
||||||
private CSMaxRunningAppsEnforcer maxRunningEnforcer;
|
private CSMaxRunningAppsEnforcer maxRunningEnforcer;
|
||||||
|
|
||||||
|
private boolean activitiesManagerEnabled = true;
|
||||||
|
|
||||||
public CapacityScheduler() {
|
public CapacityScheduler() {
|
||||||
super(CapacityScheduler.class.getName());
|
super(CapacityScheduler.class.getName());
|
||||||
this.maxRunningEnforcer = new CSMaxRunningAppsEnforcer(this);
|
this.maxRunningEnforcer = new CSMaxRunningAppsEnforcer(this);
|
||||||
|
@ -342,7 +344,9 @@ public class CapacityScheduler extends
|
||||||
this.workflowPriorityMappingsMgr = new WorkflowPriorityMappingsManager();
|
this.workflowPriorityMappingsMgr = new WorkflowPriorityMappingsManager();
|
||||||
|
|
||||||
this.activitiesManager = new ActivitiesManager(rmContext);
|
this.activitiesManager = new ActivitiesManager(rmContext);
|
||||||
activitiesManager.init(conf);
|
if (activitiesManagerEnabled) {
|
||||||
|
activitiesManager.init(conf);
|
||||||
|
}
|
||||||
initializeQueues(this.conf);
|
initializeQueues(this.conf);
|
||||||
this.isLazyPreemptionEnabled = conf.getLazyPreemptionEnabled();
|
this.isLazyPreemptionEnabled = conf.getLazyPreemptionEnabled();
|
||||||
|
|
||||||
|
@ -400,7 +404,9 @@ public class CapacityScheduler extends
|
||||||
private void startSchedulerThreads() {
|
private void startSchedulerThreads() {
|
||||||
writeLock.lock();
|
writeLock.lock();
|
||||||
try {
|
try {
|
||||||
activitiesManager.start();
|
if (activitiesManagerEnabled) {
|
||||||
|
activitiesManager.start();
|
||||||
|
}
|
||||||
if (scheduleAsynchronously) {
|
if (scheduleAsynchronously) {
|
||||||
Preconditions.checkNotNull(asyncSchedulerThreads,
|
Preconditions.checkNotNull(asyncSchedulerThreads,
|
||||||
"asyncSchedulerThreads is null");
|
"asyncSchedulerThreads is null");
|
||||||
|
@ -434,7 +440,9 @@ public class CapacityScheduler extends
|
||||||
public void serviceStop() throws Exception {
|
public void serviceStop() throws Exception {
|
||||||
writeLock.lock();
|
writeLock.lock();
|
||||||
try {
|
try {
|
||||||
this.activitiesManager.stop();
|
if (activitiesManagerEnabled) {
|
||||||
|
this.activitiesManager.stop();
|
||||||
|
}
|
||||||
if (scheduleAsynchronously && asyncSchedulerThreads != null) {
|
if (scheduleAsynchronously && asyncSchedulerThreads != null) {
|
||||||
for (Thread t : asyncSchedulerThreads) {
|
for (Thread t : asyncSchedulerThreads) {
|
||||||
t.interrupt();
|
t.interrupt();
|
||||||
|
@ -3286,6 +3294,7 @@ public class CapacityScheduler extends
|
||||||
this.maxRunningEnforcer = enforcer;
|
this.maxRunningEnforcer = enforcer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returning true as capacity scheduler supports placement constraints.
|
* Returning true as capacity scheduler supports placement constraints.
|
||||||
*/
|
*/
|
||||||
|
@ -3293,4 +3302,9 @@ public class CapacityScheduler extends
|
||||||
public boolean placementConstraintEnabled() {
|
public boolean placementConstraintEnabled() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
public void setActivitiesManagerEnabled(boolean enabled) {
|
||||||
|
this.activitiesManagerEnabled = enabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,6 +162,7 @@ public class TestLeafQueue {
|
||||||
private void setUpInternal(ResourceCalculator rC, boolean withNodeLabels)
|
private void setUpInternal(ResourceCalculator rC, boolean withNodeLabels)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
CapacityScheduler spyCs = new CapacityScheduler();
|
CapacityScheduler spyCs = new CapacityScheduler();
|
||||||
|
spyCs.setActivitiesManagerEnabled(false);
|
||||||
queues = new CSQueueStore();
|
queues = new CSQueueStore();
|
||||||
cs = spy(spyCs);
|
cs = spy(spyCs);
|
||||||
rmContext = TestUtils.getMockRMContext();
|
rmContext = TestUtils.getMockRMContext();
|
||||||
|
|
Loading…
Reference in New Issue