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.MasterKey;
import org.apache.hadoop.yarn.server.api.records.NodeAction; import org.apache.hadoop.yarn.server.api.records.NodeAction;
public interface NodeHeartbeatResponse { /**
int getResponseId(); * Node Manager's heartbeat response.
NodeAction getNodeAction(); */
public abstract class NodeHeartbeatResponse {
public abstract int getResponseId();
List<ContainerId> getContainersToCleanup(); public abstract NodeAction getNodeAction();
List<ContainerId> getContainersToBeRemovedFromNM();
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 // This tells NM the collectors' address info of related apps
Map<ApplicationId, String> getAppCollectorsMap(); public abstract Map<ApplicationId, String> getAppCollectorsMap();
void setAppCollectorsMap(Map<ApplicationId, String> appCollectorsMap);
void setResponseId(int responseId); public abstract void setAppCollectorsMap(
void setNodeAction(NodeAction action); Map<ApplicationId, String> appCollectorsMap);
MasterKey getContainerTokenMasterKey(); public abstract void setResponseId(int responseId);
void setContainerTokenMasterKey(MasterKey secretKey);
MasterKey getNMTokenMasterKey(); public abstract void setNodeAction(NodeAction action);
void setNMTokenMasterKey(MasterKey secretKey);
void addAllContainersToCleanup(List<ContainerId> containers); 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 // This tells NM to remove finished containers from its context. Currently, NM
// will remove finished containers from its context only after AM has actually // will remove finished containers from its context only after AM has actually
// received the finished containers in a previous allocate response // received the finished containers in a previous allocate response
void addContainersToBeRemovedFromNM(List<ContainerId> containers); public abstract void addContainersToBeRemovedFromNM(
List<ContainerId> containers);
void addAllApplicationsToCleanup(List<ApplicationId> applications); public abstract void addAllApplicationsToCleanup(
List<ApplicationId> applications);
List<SignalContainerRequest> getContainersToSignalList(); public abstract List<SignalContainerRequest> getContainersToSignalList();
void addAllContainersToSignal(List<SignalContainerRequest> containers);
long getNextHeartBeatInterval();
void setNextHeartBeatInterval(long nextHeartBeatInterval);
String getDiagnosticsMessage(); public abstract void addAllContainersToSignal(
List<SignalContainerRequest> containers);
void setDiagnosticsMessage(String diagnosticsMessage); 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 // Credentials (i.e. hdfs tokens) needed by NodeManagers for application
// localizations and logAggreations. // localizations and logAggreations.
Map<ApplicationId, ByteBuffer> getSystemCredentialsForApps(); public abstract Map<ApplicationId, ByteBuffer> getSystemCredentialsForApps();
void setSystemCredentialsForApps( public abstract void setSystemCredentialsForApps(
Map<ApplicationId, ByteBuffer> systemCredentials); Map<ApplicationId, ByteBuffer> systemCredentials);
boolean getAreNodeLabelsAcceptedByRM(); public abstract boolean getAreNodeLabelsAcceptedByRM();
void setAreNodeLabelsAcceptedByRM(boolean areNodeLabelsAcceptedByRM);
Resource getResource(); public abstract void setAreNodeLabelsAcceptedByRM(
void setResource(Resource resource); boolean areNodeLabelsAcceptedByRM);
List<Container> getContainersToDecrease(); public abstract Resource getResource();
void addAllContainersToDecrease(Collection<Container> containersToDecrease);
ContainerQueuingLimit getContainerQueuingLimit(); public abstract void setResource(Resource resource);
void setContainerQueuingLimit(ContainerQueuingLimit containerQueuingLimit);
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.MasterKey;
import org.apache.hadoop.yarn.server.api.records.NodeAction; 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(); public abstract Resource getResource();
void setResource(Resource resource);
boolean getAreNodeLabelsAcceptedByRM(); public abstract void setResource(Resource resource);
void setAreNodeLabelsAcceptedByRM(boolean areNodeLabelsAcceptedByRM);
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.ApplicationIdPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.ContainerIdPBImpl; 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.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.ProtoUtils;
import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl; import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl;
import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto; 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.ContainerQueuingLimitPBImpl;
import org.apache.hadoop.yarn.server.api.records.impl.pb.MasterKeyPBImpl; import org.apache.hadoop.yarn.server.api.records.impl.pb.MasterKeyPBImpl;
/**
public class NodeHeartbeatResponsePBImpl extends * PBImpl class for NodeHeartbeatResponse.
ProtoBase<NodeHeartbeatResponseProto> implements NodeHeartbeatResponse { */
NodeHeartbeatResponseProto proto = NodeHeartbeatResponseProto.getDefaultInstance(); public class NodeHeartbeatResponsePBImpl extends NodeHeartbeatResponse {
NodeHeartbeatResponseProto.Builder builder = null; private NodeHeartbeatResponseProto proto = NodeHeartbeatResponseProto
boolean viaProto = false; .getDefaultInstance();
private NodeHeartbeatResponseProto.Builder builder = null;
private boolean viaProto = false;
private List<ContainerId> containersToCleanup = null; private List<ContainerId> containersToCleanup = null;
private List<ContainerId> containersToBeRemovedFromNM = 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.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.api.records.impl.pb.ResourcePBImpl;
import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto; import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto;
import org.apache.hadoop.yarn.proto.YarnServerCommonProtos.MasterKeyProto; 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.NodeAction;
import org.apache.hadoop.yarn.server.api.records.impl.pb.MasterKeyPBImpl; import org.apache.hadoop.yarn.server.api.records.impl.pb.MasterKeyPBImpl;
/**
public class RegisterNodeManagerResponsePBImpl extends ProtoBase<RegisterNodeManagerResponseProto> implements RegisterNodeManagerResponse { * PBImpl class for RegisterNodeManagerResponse.
RegisterNodeManagerResponseProto proto = RegisterNodeManagerResponseProto.getDefaultInstance(); */
RegisterNodeManagerResponseProto.Builder builder = null; public class RegisterNodeManagerResponsePBImpl
boolean viaProto = false; extends RegisterNodeManagerResponse {
private RegisterNodeManagerResponseProto proto =
RegisterNodeManagerResponseProto.getDefaultInstance();
private RegisterNodeManagerResponseProto.Builder builder = null;
private boolean viaProto = false;
private Resource resource = null; private Resource resource = null;
private MasterKey containerTokenMasterKey = null; private MasterKey containerTokenMasterKey = null;