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

View File

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