diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 05ffebfdd0..04600ddfd3 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -1158,6 +1158,8 @@ Release 0.23.0 - Unreleased MAPREDUCE-2893. Remove duplicate entry of YarnClientProtocolProvider in ClientProtocolProvider services file. (Liang-Chi Hsieh via acmurthy) + MAPREDUCE-2891. Javadoc for AMRMProtocol and related records. (acmurthy) + Release 0.22.0 - Unreleased INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/AMRMProtocol.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/AMRMProtocol.java index 58dc9e02e4..d194926f94 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/AMRMProtocol.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/AMRMProtocol.java @@ -18,16 +18,89 @@ package org.apache.hadoop.yarn.api; +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest; import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse; import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterRequest; import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterRequest; import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse; +import org.apache.hadoop.yarn.api.records.Container; +import org.apache.hadoop.yarn.api.records.ResourceRequest; import org.apache.hadoop.yarn.exceptions.YarnRemoteException; +/** + *
The protocol between a live instance of ApplicationMaster
+ * and the ResourceManager
.
This is used by the ApplicationMaster
to register/unregister
+ * and to request and obtain resources in the cluster from the
+ * ResourceManager
.
The interface used by a new ApplicationMaster
to register
+ * with the ResourceManager
.
The ApplicationMaster
needs to provide details such
+ * as RPC Port, HTTP tracking url etc. as specified in
+ * {@link RegisterApplicationMasterRequest}.
The ResourceManager
responds with critical details such
+ * as minimum and maximum resource capabilities in the cluster as specified in
+ * {@link RegisterApplicationMasterResponse}.
The interface used by an ApplicationMaster
to notify the
+ * ResourceManager
about its completion (success or failed).
The ApplicationMaster
has to provide details such as
+ * final state, diagnostics (in case of failures) etc. as specified in
+ * {@link FinishApplicationMasterRequest}.
The ResourceManager
responds with
+ * {@link FinishApplicationMasterResponse}.
The main interface between an ApplicationMaster
+ * and the ResourceManager
.
The ApplicationMaster
uses this interface to provide a list
+ * of {@link ResourceRequest} and returns unused {@link Container} allocated
+ * to it via {@link AllocateRequest}.
The ResourceManager
responds with list of allocated
+ * {@link Container}, status of completed containers and headroom information
+ * for the application.
The ApplicationMaster
can use the available headroom
+ * (resources) to decide how to utilized allocated resources and make
+ * informed decisions about future resource requests.
The core request sent by the ApplicationMaster
to the
+ * ResourceManager
to obtain resources in the cluster via
+ * {@link AMRMProtocol#allocate(AllocateRequest)}.
The request includes: + *
ApplicationMaster
+ * ResourceManager
about the application's
+ * resource requirements.
+ * ApplicationMaster
.
+ * @return ApplicationAttemptId
being managed by the
+ * ApplicationMaster
+ */
+ @Public
+ @Stable
ApplicationAttemptId getApplicationAttemptId();
+
+ @Private
+ @Unstable
void setApplicationAttemptId(ApplicationAttemptId applicationAttemptId);
+ /**
+ * Get the response id.
+ * @return the response id
+ */
+ @Public
+ @Stable
int getResponseId();
+
+ @Private
+ @Unstable
void setResponseId(int id);
+ /**
+ * Get the current progress of application.
+ * @return the current progress of application
+ */
+ @Public
+ @Stable
float getProgress();
+
+ @Private
+ @Unstable
void setProgress(float progress);
+ /**
+ * Get the list of ResourceRequest
to upate the
+ * ResourceManager
about the application's resource requirements.
+ * @return the list of ResourceRequest
+ */
+ @Public
+ @Stable
ListContainerId
of unused containers being
+ * released by the ApplicationMaster
.
+ * @return list of ContainerId
of unused containers being
+ * released by the ApplicationMaster
+ */
+ @Public
+ @Stable
ListThe response sent by the ResourceManager
the
+ * ApplicationMaster
during resource negotiation via
+ * {@link AMRMProtocol#allocate(AllocateRequest)}.
The response, via {@link AMResponse}, includes: + *
ApplicationMaster
that its
+ * horribly out of sync and needs to reboot.ResourceManager
.
+ * @return AMResponse
sent by the ResourceManager
+ */
+ @Public
+ @Stable
public abstract AMResponse getAMResponse();
-
+
+ @Private
+ @Unstable
public abstract void setAMResponse(AMResponse amResponse);
}
diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/FinishApplicationMasterRequest.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/FinishApplicationMasterRequest.java
index fbb71e753a..d9baf4b148 100644
--- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/FinishApplicationMasterRequest.java
+++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/FinishApplicationMasterRequest.java
@@ -18,21 +18,85 @@
package org.apache.hadoop.yarn.api.protocolrecords;
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.AMRMProtocol;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
-
+/**
+ * The finalization request sent by the ApplicationMaster
to
+ * inform the ResourceManager
about its completion via the
+ * {@link AMRMProtocol#finishApplicationMaster(FinishApplicationMasterRequest)}
+ * api.
The final request includes details such: + *
ApplicationMaster
+ * ApplicationMaster
ApplicationMaster
+ * ApplicationMaster
.
+ * @return ApplicationAttemptId
being managed by the
+ * ApplicationMaster
+ */
+ @Public
+ @Stable
ApplicationAttemptId getApplicationAttemptId();
+
+ @Private
+ @Unstable
void setAppAttemptId(ApplicationAttemptId applicationAttemptId);
+ /**
+ * Get final state of the ApplicationMaster
.
+ * @return final state of the ApplicationMaster
+ */
+ @Public
+ @Stable
String getFinalState();
+
+ @Private
+ @Unstable
void setFinalState(String string);
+ /**
+ * Get diagnostic information if the application failed.
+ * @return diagnostic information if the application failed
+ */
+ @Public
+ @Stable
String getDiagnostics();
+
+ @Private
+ @Unstable
void setDiagnostics(String string);
+ /**
+ * Get the tracking URL for the ApplicationMaster
.
+ * @return the tracking URL for the ApplicationMaster
+ */
+ @Public
+ @Stable
String getTrackingUrl();
+
+ @Private
+ @Unstable
void setTrackingUrl(String historyUrl);
}
diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/FinishApplicationMasterResponse.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/FinishApplicationMasterResponse.java
index 1c30ac4a65..45682bf5dc 100644
--- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/FinishApplicationMasterResponse.java
+++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/FinishApplicationMasterResponse.java
@@ -18,6 +18,20 @@
package org.apache.hadoop.yarn.api.protocolrecords;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.yarn.api.AMRMProtocol;
+
+/**
+ * The response sent by the ResourceManager
to a
+ * ApplicationMaster
on it's completion via the
+ * {@link AMRMProtocol#finishApplicationMaster(FinishApplicationMasterRequest)}
+ * api.
Currently, this is empty.
+ */ +@Public +@Stable public interface FinishApplicationMasterResponse { } diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/RegisterApplicationMasterRequest.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/RegisterApplicationMasterRequest.java index 202dca7af9..2325b5ad0d 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/RegisterApplicationMasterRequest.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/RegisterApplicationMasterRequest.java @@ -18,19 +18,83 @@ package org.apache.hadoop.yarn.api.protocolrecords; +import org.apache.hadoop.classification.InterfaceAudience.Private; +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Stable; +import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.yarn.api.AMRMProtocol; import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; +/** + *The request sent by the ApplicationMaster
to
+ * ResourceManager
on registration via the
+ * {@link AMRMProtocol#registerApplicationMaster(RegisterApplicationMasterRequest)}
+ * api.
The registration includes details such as: + *
ApplicationMaster
+ * ApplicationMaster
.
+ * @return ApplicationAttemptId
being managed by the
+ * ApplicationMaster
+ */
+ @Public
+ @Stable
ApplicationAttemptId getApplicationAttemptId();
+
+ @Private
+ @Unstable
void setApplicationAttemptId(ApplicationAttemptId applicationAttemptId);
+ /**
+ * Get the host on which the ApplicationMaster
is running.
+ * @return host on which the ApplicationMaster
is running
+ */
+ @Public
+ @Stable
String getHost();
+
+ @Private
+ @Unstable
void setHost(String host);
+ /**
+ * Get the RPC port on which the ApplicationMaster
is responding.
+ * @return the RPC port on which the ApplicationMaster
is
+ * responding
+ */
+ @Public
+ @Stable
int getRpcPort();
+
+ @Private
+ @Unstable
void setRpcPort(int port);
+ /**
+ * Get the tracking URL for the ApplicationMaster
.
+ * @return the tracking URL for the ApplicationMaster
+ */
+ @Public
+ @Stable
String getTrackingUrl();
+
+ @Private
+ @Unstable
void setTrackingUrl(String string);
}
diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/RegisterApplicationMasterResponse.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/RegisterApplicationMasterResponse.java
index 9d595cf382..b2232b8d7c 100644
--- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/RegisterApplicationMasterResponse.java
+++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/RegisterApplicationMasterResponse.java
@@ -18,11 +18,53 @@
package org.apache.hadoop.yarn.api.protocolrecords;
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.AMRMProtocol;
import org.apache.hadoop.yarn.api.records.Resource;
+/**
+ * The response sent by the ResourceManager
to a new
+ * ApplicationMaster
on registration via the
+ * {@link AMRMProtocol#registerApplicationMaster(RegisterApplicationMasterRequest)}
+ * api.
The response contains critical details such as: + *
ResourceManager
in the cluster.
+ * @return minimum capability of allocated resources in the cluster
+ */
+ @Public
+ @Stable
public Resource getMinimumResourceCapability();
+
+ @Private
+ @Unstable
public void setMinimumResourceCapability(Resource capability);
+
+ /**
+ * Get the maximum capability for any {@link Resource} allocated by the
+ * ResourceManager
in the cluster.
+ * @return maximum capability of allocated resources in the cluster
+ */
+ @Public
+ @Stable
public Resource getMaximumResourceCapability();
+
+ @Private
+ @Unstable
public void setMaximumResourceCapability(Resource capability);
}
diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/AMResponse.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/AMResponse.java
index a14b641f68..33d3b92968 100644
--- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/AMResponse.java
+++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/AMResponse.java
@@ -20,31 +20,139 @@
import java.util.List;
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.AMRMProtocol;
+import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
+
+/**
+ * The response sent by the ResourceManager
the
+ * ApplicationMaster
during resource negotiation via
+ * {@link AMRMProtocol#allocate(AllocateRequest)}.
The response includes: + *
ApplicationMaster
that its
+ * horribly out of sync and needs to reboot.ApplicationMaster
reboot for being horribly
+ * out-of-sync with the ResourceManager
as deigned by
+ * {@link #getResponseId()}?
+ *
+ * @return true
if the ApplicationMaster
should
+ * reboot, false
otherwise
+ */
+ @Public
+ @Stable
public boolean getReboot();
+
+ @Private
+ @Unstable
+ public void setReboot(boolean reboot);
+
+ /**
+ * Get the last response id.
+ * @return the last response id
+ */
+ @Public
+ @Stable
public int getResponseId();
+ @Private
+ @Unstable
+ public void setResponseId(int responseId);
+
+ /**
+ * Get the list of newly allocated {@link Container} by the
+ * ResourceManager
.
+ * @return list of newly allocated Container
+ */
+ @Public
+ @Stable
public List