YARN-6979. [Addendum patch] Fixed classname and added javadocs. (Kartheek Muthyala via asuresh)

This commit is contained in:
Arun Suresh 2017-08-20 08:55:13 -07:00
parent 8410d862d3
commit 7a82d7bcea
4 changed files with 28 additions and 19 deletions

View File

@ -21,17 +21,28 @@ package org.apache.hadoop.yarn.server.nodemanager;
import org.apache.hadoop.yarn.api.records.Container; import org.apache.hadoop.yarn.api.records.Container;
import java.util.List; import java.util.List;
public class CMgrDecreaseContainersResourceEvent extends ContainerManagerEvent { /**
* Event used by the NodeStatusUpdater to notify the ContainerManager of
* container update commands it received from the RM.
*/
public class CMgrUpdateContainersEvent extends ContainerManagerEvent {
private final List<Container> containersToDecrease; private final List<Container> containersToUpdate;
public CMgrDecreaseContainersResourceEvent(List<Container> /**
containersToDecrease) { * Create event.
super(ContainerManagerEventType.DECREASE_CONTAINERS_RESOURCE); * @param containersToUpdate Container to update.
this.containersToDecrease = containersToDecrease; */
public CMgrUpdateContainersEvent(List<Container> containersToUpdate) {
super(ContainerManagerEventType.UPDATE_CONTAINERS);
this.containersToUpdate = containersToUpdate;
} }
public List<Container> getContainersToDecrease() { /**
return this.containersToDecrease; * Get containers to update.
* @return List of containers to update.
*/
public List<Container> getContainersToUpdate() {
return this.containersToUpdate;
} }
} }

View File

@ -21,6 +21,6 @@ package org.apache.hadoop.yarn.server.nodemanager;
public enum ContainerManagerEventType { public enum ContainerManagerEventType {
FINISH_APPS, FINISH_APPS,
FINISH_CONTAINERS, FINISH_CONTAINERS,
DECREASE_CONTAINERS_RESOURCE, UPDATE_CONTAINERS,
SIGNAL_CONTAINERS SIGNAL_CONTAINERS
} }

View File

@ -1099,12 +1099,10 @@ public class NodeStatusUpdaterImpl extends AbstractService implements
parseCredentials(systemCredentials)); parseCredentials(systemCredentials));
} }
List<org.apache.hadoop.yarn.api.records.Container> List<org.apache.hadoop.yarn.api.records.Container>
containersToDecrease = response.getContainersToUpdate(); containersToUpdate = response.getContainersToUpdate();
if (!containersToDecrease.isEmpty()) { if (!containersToUpdate.isEmpty()) {
dispatcher.getEventHandler().handle( dispatcher.getEventHandler().handle(
new CMgrDecreaseContainersResourceEvent( new CMgrUpdateContainersEvent(containersToUpdate));
containersToDecrease)
);
} }
// SignalContainer request originally comes from end users via // SignalContainer request originally comes from end users via

View File

@ -96,7 +96,7 @@ import org.apache.hadoop.yarn.server.api.records.ContainerQueuingLimit;
import org.apache.hadoop.yarn.server.api.records.OpportunisticContainersStatus; import org.apache.hadoop.yarn.server.api.records.OpportunisticContainersStatus;
import org.apache.hadoop.yarn.server.nodemanager.CMgrCompletedAppsEvent; import org.apache.hadoop.yarn.server.nodemanager.CMgrCompletedAppsEvent;
import org.apache.hadoop.yarn.server.nodemanager.CMgrCompletedContainersEvent; import org.apache.hadoop.yarn.server.nodemanager.CMgrCompletedContainersEvent;
import org.apache.hadoop.yarn.server.nodemanager.CMgrDecreaseContainersResourceEvent; import org.apache.hadoop.yarn.server.nodemanager.CMgrUpdateContainersEvent;
import org.apache.hadoop.yarn.server.nodemanager.CMgrSignalContainersEvent; import org.apache.hadoop.yarn.server.nodemanager.CMgrSignalContainersEvent;
import org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor; import org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor;
import org.apache.hadoop.yarn.server.nodemanager.ContainerManagerEvent; import org.apache.hadoop.yarn.server.nodemanager.ContainerManagerEvent;
@ -1599,11 +1599,11 @@ public class ContainerManagerImpl extends CompositeService implements
"Container Killed by ResourceManager")); "Container Killed by ResourceManager"));
} }
break; break;
case DECREASE_CONTAINERS_RESOURCE: case UPDATE_CONTAINERS:
CMgrDecreaseContainersResourceEvent containersDecreasedEvent = CMgrUpdateContainersEvent containersDecreasedEvent =
(CMgrDecreaseContainersResourceEvent) event; (CMgrUpdateContainersEvent) event;
for (org.apache.hadoop.yarn.api.records.Container container for (org.apache.hadoop.yarn.api.records.Container container
: containersDecreasedEvent.getContainersToDecrease()) { : containersDecreasedEvent.getContainersToUpdate()) {
try { try {
ContainerTokenIdentifier containerTokenIdentifier = ContainerTokenIdentifier containerTokenIdentifier =
BuilderUtils.newContainerTokenIdentifier( BuilderUtils.newContainerTokenIdentifier(