YARN-4893. Fix some intermittent test failures in TestRMAdminService. Contributed by Brahma Reddy Battula.
This commit is contained in:
parent
1cbcd4a491
commit
6be28bcc46
|
@ -56,12 +56,12 @@ import org.apache.hadoop.yarn.api.records.ContainerState;
|
||||||
import org.apache.hadoop.yarn.api.records.ContainerStatus;
|
import org.apache.hadoop.yarn.api.records.ContainerStatus;
|
||||||
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
|
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
|
||||||
import org.apache.hadoop.yarn.api.records.LogAggregationContext;
|
import org.apache.hadoop.yarn.api.records.LogAggregationContext;
|
||||||
import org.apache.hadoop.yarn.api.records.ResourceRequest;
|
|
||||||
import org.apache.hadoop.yarn.api.records.SignalContainerCommand;
|
|
||||||
import org.apache.hadoop.yarn.api.records.NodeId;
|
import org.apache.hadoop.yarn.api.records.NodeId;
|
||||||
import org.apache.hadoop.yarn.api.records.NodeState;
|
import org.apache.hadoop.yarn.api.records.NodeState;
|
||||||
import org.apache.hadoop.yarn.api.records.Priority;
|
import org.apache.hadoop.yarn.api.records.Priority;
|
||||||
import org.apache.hadoop.yarn.api.records.Resource;
|
import org.apache.hadoop.yarn.api.records.Resource;
|
||||||
|
import org.apache.hadoop.yarn.api.records.ResourceRequest;
|
||||||
|
import org.apache.hadoop.yarn.api.records.SignalContainerCommand;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.apache.hadoop.yarn.event.Dispatcher;
|
import org.apache.hadoop.yarn.event.Dispatcher;
|
||||||
import org.apache.hadoop.yarn.event.DrainDispatcher;
|
import org.apache.hadoop.yarn.event.DrainDispatcher;
|
||||||
|
@ -603,6 +603,7 @@ public class MockRM extends ResourceManager {
|
||||||
public MockNM registerNode(String nodeIdStr, int memory) throws Exception {
|
public MockNM registerNode(String nodeIdStr, int memory) throws Exception {
|
||||||
MockNM nm = new MockNM(nodeIdStr, memory, getResourceTrackerService());
|
MockNM nm = new MockNM(nodeIdStr, memory, getResourceTrackerService());
|
||||||
nm.registerNode();
|
nm.registerNode();
|
||||||
|
drainEvents();
|
||||||
return nm;
|
return nm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -611,6 +612,7 @@ public class MockRM extends ResourceManager {
|
||||||
MockNM nm =
|
MockNM nm =
|
||||||
new MockNM(nodeIdStr, memory, vCores, getResourceTrackerService());
|
new MockNM(nodeIdStr, memory, vCores, getResourceTrackerService());
|
||||||
nm.registerNode();
|
nm.registerNode();
|
||||||
|
drainEvents();
|
||||||
return nm;
|
return nm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,6 +622,7 @@ public class MockRM extends ResourceManager {
|
||||||
new MockNM(nodeIdStr, memory, vCores, getResourceTrackerService(),
|
new MockNM(nodeIdStr, memory, vCores, getResourceTrackerService(),
|
||||||
YarnVersionInfo.getVersion());
|
YarnVersionInfo.getVersion());
|
||||||
nm.registerNode(runningApplications);
|
nm.registerNode(runningApplications);
|
||||||
|
drainEvents();
|
||||||
return nm;
|
return nm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,7 @@ import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
|
@ -49,7 +47,6 @@ import org.apache.hadoop.security.authorize.ProxyUsers;
|
||||||
import org.apache.hadoop.security.authorize.ServiceAuthorizationManager;
|
import org.apache.hadoop.security.authorize.ServiceAuthorizationManager;
|
||||||
import org.apache.hadoop.yarn.api.records.DecommissionType;
|
import org.apache.hadoop.yarn.api.records.DecommissionType;
|
||||||
import org.apache.hadoop.yarn.api.records.NodeId;
|
import org.apache.hadoop.yarn.api.records.NodeId;
|
||||||
import org.apache.hadoop.yarn.api.records.NodeId;
|
|
||||||
import org.apache.hadoop.yarn.api.records.Resource;
|
import org.apache.hadoop.yarn.api.records.Resource;
|
||||||
import org.apache.hadoop.yarn.conf.HAUtil;
|
import org.apache.hadoop.yarn.conf.HAUtil;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
|
|
|
@ -81,8 +81,6 @@ import org.apache.hadoop.yarn.api.records.Resource;
|
||||||
import org.apache.hadoop.yarn.api.records.ResourceRequest;
|
import org.apache.hadoop.yarn.api.records.ResourceRequest;
|
||||||
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
|
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.apache.hadoop.yarn.event.Dispatcher;
|
|
||||||
import org.apache.hadoop.yarn.event.DrainDispatcher;
|
|
||||||
import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException;
|
import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException;
|
||||||
import org.apache.hadoop.yarn.security.AMRMTokenIdentifier;
|
import org.apache.hadoop.yarn.security.AMRMTokenIdentifier;
|
||||||
import org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier;
|
import org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier;
|
||||||
|
|
|
@ -176,7 +176,6 @@ public class TestResourceTrackerService extends NodeLabelTestBase {
|
||||||
MockNM nm2 = rm.registerNode("host2:5678", 10240);
|
MockNM nm2 = rm.registerNode("host2:5678", 10240);
|
||||||
MockNM nm3 = rm.registerNode("localhost:4433", 1024);
|
MockNM nm3 = rm.registerNode("localhost:4433", 1024);
|
||||||
|
|
||||||
rm.drainEvents();
|
|
||||||
|
|
||||||
int metricCount = ClusterMetrics.getMetrics().getNumDecommisionedNMs();
|
int metricCount = ClusterMetrics.getMetrics().getNumDecommisionedNMs();
|
||||||
NodeHeartbeatResponse nodeHeartbeat = nm1.nodeHeartbeat(true);
|
NodeHeartbeatResponse nodeHeartbeat = nm1.nodeHeartbeat(true);
|
||||||
|
@ -208,7 +207,6 @@ public class TestResourceTrackerService extends NodeLabelTestBase {
|
||||||
rm.getNodesListManager().refreshNodes(conf);
|
rm.getNodesListManager().refreshNodes(conf);
|
||||||
|
|
||||||
nm3 = rm.registerNode("localhost:4433", 1024);
|
nm3 = rm.registerNode("localhost:4433", 1024);
|
||||||
rm.drainEvents();
|
|
||||||
nodeHeartbeat = nm3.nodeHeartbeat(true);
|
nodeHeartbeat = nm3.nodeHeartbeat(true);
|
||||||
rm.drainEvents();
|
rm.drainEvents();
|
||||||
Assert.assertTrue(NodeAction.NORMAL.equals(nodeHeartbeat.getNodeAction()));
|
Assert.assertTrue(NodeAction.NORMAL.equals(nodeHeartbeat.getNodeAction()));
|
||||||
|
@ -1027,7 +1025,6 @@ public class TestResourceTrackerService extends NodeLabelTestBase {
|
||||||
|
|
||||||
// unhealthy node changed back to healthy
|
// unhealthy node changed back to healthy
|
||||||
nm2 = rm.registerNode("host2:5678", 5120);
|
nm2 = rm.registerNode("host2:5678", 5120);
|
||||||
rm.drainEvents();
|
|
||||||
response = nm2.nodeHeartbeat(true);
|
response = nm2.nodeHeartbeat(true);
|
||||||
response = nm2.nodeHeartbeat(true);
|
response = nm2.nodeHeartbeat(true);
|
||||||
rm.drainEvents();
|
rm.drainEvents();
|
||||||
|
@ -1035,7 +1032,6 @@ public class TestResourceTrackerService extends NodeLabelTestBase {
|
||||||
|
|
||||||
// reconnect of node with changed capability
|
// reconnect of node with changed capability
|
||||||
nm1 = rm.registerNode("host2:5678", 10240);
|
nm1 = rm.registerNode("host2:5678", 10240);
|
||||||
rm.drainEvents();
|
|
||||||
response = nm1.nodeHeartbeat(true);
|
response = nm1.nodeHeartbeat(true);
|
||||||
rm.drainEvents();
|
rm.drainEvents();
|
||||||
Assert.assertTrue(NodeAction.NORMAL.equals(response.getNodeAction()));
|
Assert.assertTrue(NodeAction.NORMAL.equals(response.getNodeAction()));
|
||||||
|
@ -1045,7 +1041,6 @@ public class TestResourceTrackerService extends NodeLabelTestBase {
|
||||||
List<ApplicationId> runningApps = new ArrayList<ApplicationId>();
|
List<ApplicationId> runningApps = new ArrayList<ApplicationId>();
|
||||||
runningApps.add(ApplicationId.newInstance(1, 0));
|
runningApps.add(ApplicationId.newInstance(1, 0));
|
||||||
nm1 = rm.registerNode("host2:5678", 15360, 2, runningApps);
|
nm1 = rm.registerNode("host2:5678", 15360, 2, runningApps);
|
||||||
rm.drainEvents();
|
|
||||||
response = nm1.nodeHeartbeat(true);
|
response = nm1.nodeHeartbeat(true);
|
||||||
rm.drainEvents();
|
rm.drainEvents();
|
||||||
Assert.assertTrue(NodeAction.NORMAL.equals(response.getNodeAction()));
|
Assert.assertTrue(NodeAction.NORMAL.equals(response.getNodeAction()));
|
||||||
|
@ -1055,7 +1050,6 @@ public class TestResourceTrackerService extends NodeLabelTestBase {
|
||||||
nm1 = new MockNM("host1:1234", 5120, rm.getResourceTrackerService());
|
nm1 = new MockNM("host1:1234", 5120, rm.getResourceTrackerService());
|
||||||
nm1.setHttpPort(3);
|
nm1.setHttpPort(3);
|
||||||
nm1.registerNode();
|
nm1.registerNode();
|
||||||
rm.drainEvents();
|
|
||||||
response = nm1.nodeHeartbeat(true);
|
response = nm1.nodeHeartbeat(true);
|
||||||
response = nm1.nodeHeartbeat(true);
|
response = nm1.nodeHeartbeat(true);
|
||||||
rm.drainEvents();
|
rm.drainEvents();
|
||||||
|
|
|
@ -29,8 +29,8 @@ import org.apache.hadoop.yarn.api.records.ContainerState;
|
||||||
import org.apache.hadoop.yarn.api.records.Resource;
|
import org.apache.hadoop.yarn.api.records.Resource;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.apache.hadoop.yarn.event.AbstractEvent;
|
import org.apache.hadoop.yarn.event.AbstractEvent;
|
||||||
import org.apache.hadoop.yarn.event.AsyncDispatcher;
|
|
||||||
import org.apache.hadoop.yarn.event.Dispatcher;
|
import org.apache.hadoop.yarn.event.Dispatcher;
|
||||||
|
import org.apache.hadoop.yarn.event.DrainDispatcher;
|
||||||
import org.apache.hadoop.yarn.event.EventHandler;
|
import org.apache.hadoop.yarn.event.EventHandler;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.MockAM;
|
import org.apache.hadoop.yarn.server.resourcemanager.MockAM;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.MockNM;
|
import org.apache.hadoop.yarn.server.resourcemanager.MockNM;
|
||||||
|
@ -43,7 +43,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
|
||||||
import org.apache.hadoop.yarn.util.ControlledClock;
|
import org.apache.hadoop.yarn.util.ControlledClock;
|
||||||
import org.apache.hadoop.yarn.util.SystemClock;
|
|
||||||
import org.apache.log4j.Level;
|
import org.apache.log4j.Level;
|
||||||
import org.apache.log4j.LogManager;
|
import org.apache.log4j.LogManager;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
@ -236,7 +235,7 @@ public class TestNodesListManager {
|
||||||
* Create dispatcher object
|
* Create dispatcher object
|
||||||
*/
|
*/
|
||||||
private Dispatcher getDispatcher() {
|
private Dispatcher getDispatcher() {
|
||||||
Dispatcher dispatcher = new AsyncDispatcher() {
|
Dispatcher dispatcher = new DrainDispatcher() {
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
@Override
|
@Override
|
||||||
public EventHandler getEventHandler() {
|
public EventHandler getEventHandler() {
|
||||||
|
|
Loading…
Reference in New Issue