YARN-3732. Change NodeHeartbeatResponse.java and RegisterNodeManagerResponse.java as abstract classes. Contributed by Devaraj K.

This commit is contained in:
Rohith Sharma K S 2016-10-28 12:11:43 +05:30
parent 7d2d8d25ba
commit 9d0c2ad5a5
4 changed files with 99 additions and 66 deletions

View File

@ -32,62 +32,85 @@ import org.apache.hadoop.yarn.server.api.records.ContainerQueuingLimit;
import org.apache.hadoop.yarn.server.api.records.MasterKey;
import org.apache.hadoop.yarn.server.api.records.NodeAction;
public interface NodeHeartbeatResponse {
int getResponseId();
NodeAction getNodeAction();
/**
* Node Manager's heartbeat response.
*/
public abstract class NodeHeartbeatResponse {
public abstract int getResponseId();
List<ContainerId> getContainersToCleanup();
List<ContainerId> getContainersToBeRemovedFromNM();
public abstract NodeAction getNodeAction();
List<ApplicationId> getApplicationsToCleanup();
public abstract List<ContainerId> getContainersToCleanup();
public abstract List<ContainerId> getContainersToBeRemovedFromNM();
public abstract List<ApplicationId> getApplicationsToCleanup();
// This tells NM the collectors' address info of related apps
Map<ApplicationId, String> getAppCollectorsMap();
void setAppCollectorsMap(Map<ApplicationId, String> appCollectorsMap);
public abstract Map<ApplicationId, String> getAppCollectorsMap();
void setResponseId(int responseId);
void setNodeAction(NodeAction action);
public abstract void setAppCollectorsMap(
Map<ApplicationId, String> appCollectorsMap);
MasterKey getContainerTokenMasterKey();
void setContainerTokenMasterKey(MasterKey secretKey);
MasterKey getNMTokenMasterKey();
void setNMTokenMasterKey(MasterKey secretKey);
public abstract void setResponseId(int responseId);
void addAllContainersToCleanup(List<ContainerId> containers);
public abstract void setNodeAction(NodeAction action);
public abstract MasterKey getContainerTokenMasterKey();
public abstract void setContainerTokenMasterKey(MasterKey secretKey);
public abstract MasterKey getNMTokenMasterKey();
public abstract void setNMTokenMasterKey(MasterKey secretKey);
public abstract void addAllContainersToCleanup(List<ContainerId> containers);
// This tells NM to remove finished containers from its context. Currently, NM
// will remove finished containers from its context only after AM has actually
// received the finished containers in a previous allocate response
void addContainersToBeRemovedFromNM(List<ContainerId> containers);
void addAllApplicationsToCleanup(List<ApplicationId> applications);
public abstract void addContainersToBeRemovedFromNM(
List<ContainerId> containers);
List<SignalContainerRequest> getContainersToSignalList();
void addAllContainersToSignal(List<SignalContainerRequest> containers);
long getNextHeartBeatInterval();
void setNextHeartBeatInterval(long nextHeartBeatInterval);
String getDiagnosticsMessage();
public abstract void addAllApplicationsToCleanup(
List<ApplicationId> applications);
void setDiagnosticsMessage(String diagnosticsMessage);
public abstract List<SignalContainerRequest> getContainersToSignalList();
public abstract void addAllContainersToSignal(
List<SignalContainerRequest> containers);
public abstract long getNextHeartBeatInterval();
public abstract void setNextHeartBeatInterval(long nextHeartBeatInterval);
public abstract String getDiagnosticsMessage();
public abstract void setDiagnosticsMessage(String diagnosticsMessage);
// Credentials (i.e. hdfs tokens) needed by NodeManagers for application
// localizations and logAggreations.
Map<ApplicationId, ByteBuffer> getSystemCredentialsForApps();
public abstract Map<ApplicationId, ByteBuffer> getSystemCredentialsForApps();
void setSystemCredentialsForApps(
public abstract void setSystemCredentialsForApps(
Map<ApplicationId, ByteBuffer> systemCredentials);
boolean getAreNodeLabelsAcceptedByRM();
void setAreNodeLabelsAcceptedByRM(boolean areNodeLabelsAcceptedByRM);
public abstract boolean getAreNodeLabelsAcceptedByRM();
Resource getResource();
void setResource(Resource resource);
public abstract void setAreNodeLabelsAcceptedByRM(
boolean areNodeLabelsAcceptedByRM);
List<Container> getContainersToDecrease();
void addAllContainersToDecrease(Collection<Container> containersToDecrease);
public abstract Resource getResource();
ContainerQueuingLimit getContainerQueuingLimit();
void setContainerQueuingLimit(ContainerQueuingLimit containerQueuingLimit);
public abstract void setResource(Resource resource);
public abstract List<Container> getContainersToDecrease();
public abstract void addAllContainersToDecrease(
Collection<Container> containersToDecrease);
public abstract ContainerQueuingLimit getContainerQueuingLimit();
public abstract void setContainerQueuingLimit(
ContainerQueuingLimit containerQueuingLimit);
}

View File

@ -22,34 +22,40 @@ import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.server.api.records.MasterKey;
import org.apache.hadoop.yarn.server.api.records.NodeAction;
public interface RegisterNodeManagerResponse {
MasterKey getContainerTokenMasterKey();
/**
* Node Manager's register response.
*/
public abstract class RegisterNodeManagerResponse {
public abstract MasterKey getContainerTokenMasterKey();
void setContainerTokenMasterKey(MasterKey secretKey);
public abstract void setContainerTokenMasterKey(MasterKey secretKey);
MasterKey getNMTokenMasterKey();
public abstract MasterKey getNMTokenMasterKey();
void setNMTokenMasterKey(MasterKey secretKey);
public abstract void setNMTokenMasterKey(MasterKey secretKey);
NodeAction getNodeAction();
public abstract NodeAction getNodeAction();
void setNodeAction(NodeAction nodeAction);
public abstract void setNodeAction(NodeAction nodeAction);
long getRMIdentifier();
public abstract long getRMIdentifier();
void setRMIdentifier(long rmIdentifier);
public abstract void setRMIdentifier(long rmIdentifier);
String getDiagnosticsMessage();
public abstract String getDiagnosticsMessage();
void setDiagnosticsMessage(String diagnosticsMessage);
public abstract void setDiagnosticsMessage(String diagnosticsMessage);
void setRMVersion(String version);
public abstract void setRMVersion(String version);
String getRMVersion();
public abstract String getRMVersion();
Resource getResource();
void setResource(Resource resource);
public abstract Resource getResource();
boolean getAreNodeLabelsAcceptedByRM();
void setAreNodeLabelsAcceptedByRM(boolean areNodeLabelsAcceptedByRM);
public abstract void setResource(Resource resource);
public abstract boolean getAreNodeLabelsAcceptedByRM();
public abstract void setAreNodeLabelsAcceptedByRM(
boolean areNodeLabelsAcceptedByRM);
}

View File

@ -35,7 +35,6 @@ import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.ContainerIdPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.ContainerPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.ProtoBase;
import org.apache.hadoop.yarn.api.records.impl.pb.ProtoUtils;
import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl;
import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto;
@ -57,12 +56,14 @@ import org.apache.hadoop.yarn.server.api.records.NodeAction;
import org.apache.hadoop.yarn.server.api.records.impl.pb.ContainerQueuingLimitPBImpl;
import org.apache.hadoop.yarn.server.api.records.impl.pb.MasterKeyPBImpl;
public class NodeHeartbeatResponsePBImpl extends
ProtoBase<NodeHeartbeatResponseProto> implements NodeHeartbeatResponse {
NodeHeartbeatResponseProto proto = NodeHeartbeatResponseProto.getDefaultInstance();
NodeHeartbeatResponseProto.Builder builder = null;
boolean viaProto = false;
/**
* PBImpl class for NodeHeartbeatResponse.
*/
public class NodeHeartbeatResponsePBImpl extends NodeHeartbeatResponse {
private NodeHeartbeatResponseProto proto = NodeHeartbeatResponseProto
.getDefaultInstance();
private NodeHeartbeatResponseProto.Builder builder = null;
private boolean viaProto = false;
private List<ContainerId> containersToCleanup = null;
private List<ContainerId> containersToBeRemovedFromNM = null;

View File

@ -20,7 +20,6 @@ package org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.api.records.impl.pb.ProtoBase;
import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl;
import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto;
import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.MasterKeyProto;
@ -32,11 +31,15 @@ import org.apache.hadoop.yarn.server.api.records.MasterKey;
import org.apache.hadoop.yarn.server.api.records.NodeAction;
import org.apache.hadoop.yarn.server.api.records.impl.pb.MasterKeyPBImpl;
public class RegisterNodeManagerResponsePBImpl extends ProtoBase<RegisterNodeManagerResponseProto> implements RegisterNodeManagerResponse {
RegisterNodeManagerResponseProto proto = RegisterNodeManagerResponseProto.getDefaultInstance();
RegisterNodeManagerResponseProto.Builder builder = null;
boolean viaProto = false;
/**
* PBImpl class for RegisterNodeManagerResponse.
*/
public class RegisterNodeManagerResponsePBImpl
extends RegisterNodeManagerResponse {
private RegisterNodeManagerResponseProto proto =
RegisterNodeManagerResponseProto.getDefaultInstance();
private RegisterNodeManagerResponseProto.Builder builder = null;
private boolean viaProto = false;
private Resource resource = null;
private MasterKey containerTokenMasterKey = null;