YARN-7722. Rename variables in MockNM, MockRM for better clarity. Contributed by Lovekesh bansal

This commit is contained in:
Sunil G 2018-01-10 20:51:34 +05:30
parent d98a2e6e23
commit afd8caba27
2 changed files with 15 additions and 15 deletions

View File

@ -55,7 +55,7 @@ public class MockNM {
private int responseId; private int responseId;
private NodeId nodeId; private NodeId nodeId;
private Resource capatibility; private Resource capability;
private ResourceTrackerService resourceTracker; private ResourceTrackerService resourceTracker;
private int httpPort = 2; private int httpPort = 2;
private MasterKey currentContainerTokenMasterKey; private MasterKey currentContainerTokenMasterKey;
@ -86,15 +86,15 @@ public class MockNM {
version); version);
} }
public MockNM(String nodeIdStr, Resource capatibility, public MockNM(String nodeIdStr, Resource capability,
ResourceTrackerService resourceTracker) { ResourceTrackerService resourceTracker) {
this(nodeIdStr, capatibility, resourceTracker, this(nodeIdStr, capability, resourceTracker,
YarnVersionInfo.getVersion()); YarnVersionInfo.getVersion());
} }
public MockNM(String nodeIdStr, Resource capatibility, public MockNM(String nodeIdStr, Resource capability,
ResourceTrackerService resourceTracker, String version) { ResourceTrackerService resourceTracker, String version) {
this.capatibility = capatibility; this.capability = capability;
this.resourceTracker = resourceTracker; this.resourceTracker = resourceTracker;
this.version = version; this.version = version;
String[] splits = nodeIdStr.split(":"); String[] splits = nodeIdStr.split(":");
@ -166,7 +166,7 @@ public class MockNM {
RegisterNodeManagerRequest.class); RegisterNodeManagerRequest.class);
req.setNodeId(nodeId); req.setNodeId(nodeId);
req.setHttpPort(httpPort); req.setHttpPort(httpPort);
req.setResource(capatibility); req.setResource(capability);
req.setContainerStatuses(containerReports); req.setContainerStatuses(containerReports);
req.setNMVersion(version); req.setNMVersion(version);
req.setRunningApplications(runningApplications); req.setRunningApplications(runningApplications);
@ -177,7 +177,7 @@ public class MockNM {
this.currentNMTokenMasterKey = registrationResponse.getNMTokenMasterKey(); this.currentNMTokenMasterKey = registrationResponse.getNMTokenMasterKey();
Resource newResource = registrationResponse.getResource(); Resource newResource = registrationResponse.getResource();
if (newResource != null) { if (newResource != null) {
capatibility = Resources.clone(newResource); capability = Resources.clone(newResource);
} }
containerStats.clear(); containerStats.clear();
if (containerReports != null) { if (containerReports != null) {
@ -202,7 +202,7 @@ public class MockNM {
long containerId, ContainerState containerState) throws Exception { long containerId, ContainerState containerState) throws Exception {
ContainerStatus containerStatus = BuilderUtils.newContainerStatus( ContainerStatus containerStatus = BuilderUtils.newContainerStatus(
BuilderUtils.newContainerId(attemptId, containerId), containerState, BuilderUtils.newContainerId(attemptId, containerId), containerState,
"Success", 0, capatibility); "Success", 0, capability);
ArrayList<ContainerStatus> containerStatusList = ArrayList<ContainerStatus> containerStatusList =
new ArrayList<ContainerStatus>(1); new ArrayList<ContainerStatus>(1);
containerStatusList.add(containerStatus); containerStatusList.add(containerStatus);
@ -282,22 +282,22 @@ public class MockNM {
Resource newResource = heartbeatResponse.getResource(); Resource newResource = heartbeatResponse.getResource();
if (newResource != null) { if (newResource != null) {
capatibility = Resources.clone(newResource); capability = Resources.clone(newResource);
} }
return heartbeatResponse; return heartbeatResponse;
} }
public long getMemory() { public long getMemory() {
return capatibility.getMemorySize(); return capability.getMemorySize();
} }
public int getvCores() { public int getvCores() {
return capatibility.getVirtualCores(); return capability.getVirtualCores();
} }
public Resource getCapatibility() { public Resource getCapability() {
return capatibility; return capability;
} }
public String getVersion() { public String getVersion() {

View File

@ -855,9 +855,9 @@ public class MockRM extends ResourceManager {
return nm; return nm;
} }
public MockNM registerNode(String nodeIdStr, Resource nodeCapatibility) public MockNM registerNode(String nodeIdStr, Resource nodeCapability)
throws Exception { throws Exception {
MockNM nm = new MockNM(nodeIdStr, nodeCapatibility, MockNM nm = new MockNM(nodeIdStr, nodeCapability,
getResourceTrackerService()); getResourceTrackerService());
nm.registerNode(); nm.registerNode();
drainEventsImplicitly(); drainEventsImplicitly();