diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 04600ddfd3c..bdc9d3eb602 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -1160,6 +1160,9 @@ Release 0.23.0 - Unreleased MAPREDUCE-2891. Javadoc for AMRMProtocol and related records. (acmurthy) + MAPREDUCE-2898. Javadoc for ContainerManager protocol 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/ContainerManager.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ContainerManager.java index a778793992a..46071929aee 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ContainerManager.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ContainerManager.java @@ -18,21 +18,107 @@ 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.GetContainerStatusRequest; import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusResponse; import org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest; import org.apache.hadoop.yarn.api.protocolrecords.StartContainerResponse; import org.apache.hadoop.yarn.api.protocolrecords.StopContainerRequest; import org.apache.hadoop.yarn.api.protocolrecords.StopContainerResponse; +import org.apache.hadoop.yarn.api.records.ContainerId; +import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; +import org.apache.hadoop.yarn.api.records.ContainerStatus; import org.apache.hadoop.yarn.exceptions.YarnRemoteException; +/** + *
The protocol between an ApplicationMaster
and a
+ * NodeManager
to start/stop containers and to get status
+ * of running containers.
If security is enabled the NodeManager
verifies that the
+ * ApplicationMaster
has truly been allocated the container
+ * by the ResourceManager
and also verifies all interactions such
+ * as stopping the container or obtaining status information for the container.
+ *
The ApplicationMaster
requests a NodeManager
+ * to start a {@link Container} allocated to it using this interface.
+ *
The ApplicationMaster
has to provide details such as
+ * allocated resource capability, security tokens (if enabled), command
+ * to be executed to start the container, environment for the process,
+ * necessary binaries/jar/shared-objects etc. via the
+ * {@link ContainerLaunchContext} in the {@link StartContainerRequest}.
Currently the NodeManager
sends an immediate, empty
+ * response via {@link StartContainerResponse} to signify acceptance of the
+ * request and throws an exception in case of errors. The
+ * ApplicationMaster
can use
+ * {@link #getContainerStatus(GetContainerStatusRequest)} to get updated
+ * status of the to-be-launched or launched container.
The ApplicationMaster
requests a NodeManager
+ * to stop a {@link Container} allocated to it using this interface.
+ *
The ApplicationMaster
Currently the NodeManager
sends an immediate, empty
+ * response via {@link StopContainerResponse} to signify acceptance of the
+ * request and throws an exception in case of errors. The
+ * ApplicationMaster
can use
+ * {@link #getContainerStatus(GetContainerStatusRequest)} to get updated
+ * status of the container.
The api used by the ApplicationMaster
to request for
+ * current status of a Container
from the
+ * NodeManager
.
The ApplicationMaster
The NodeManager
responds with
+ *{@link GetContainerStatusResponse} which includes the
+ *{@link ContainerStatus} of the container.
ContainerStatus
of a container
+ * with the specified ContainerId
+ * @return
+ * @throws YarnRemoteException
+ */
+ @Public
+ @Stable
GetContainerStatusResponse getContainerStatus(
GetContainerStatusRequest request) throws YarnRemoteException;
}
diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusRequest.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusRequest.java
index c9498b0d67e..61b0aa7f087 100644
--- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusRequest.java
+++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusRequest.java
@@ -18,9 +18,33 @@
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.ContainerManager;
import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.api.records.ContainerStatus;
+/**
+ * The request sent by the ApplicationMaster
to the
+ * NodeManager
to get {@link ContainerStatus} of a container via
+ * {@link ContainerManager#getContainerStatus(GetContainerStatusRequest)}.
ContainerId
of container for which to obtain the
+ * ContainerStatus
.
+ * @return ContainerId
of container for which to obtain the
+ * ContainerStatus
+ */
+ @Public
+ @Stable
public abstract ContainerId getContainerId();
+
+ @Private
+ @Unstable
public abstract void setContainerId(ContainerId containerId);
}
diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusResponse.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusResponse.java
index bcf0ffd99a2..7893c733a60 100644
--- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusResponse.java
+++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusResponse.java
@@ -18,9 +18,31 @@
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.ContainerManager;
import org.apache.hadoop.yarn.api.records.ContainerStatus;
+/**
+ * The response sent by the NodeManager
to the
+ * ApplicationMaster
when asked to obtainer status
+ * of a container via
+ * {@link ContainerManager#getContainerStatus(GetContainerStatusRequest)}.
ContainerStatus
of the container.
+ * @return ContainerStatus
of the container
+ */
+ @Public
+ @Stable
public abstract ContainerStatus getStatus();
+
+ @Private
+ @Unstable
public abstract void setStatus(ContainerStatus containerStatus);
}
diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerRequest.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerRequest.java
index 1226c91a2a3..0f986442b57 100644
--- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerRequest.java
+++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerRequest.java
@@ -18,10 +18,40 @@
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.ContainerManager;
import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
+/**
+ * The request sent by the ApplicationMaster
to the
+ * NodeManager
to start a container via
+ * {@link ContainerManager#startContainer(StartContainerRequest)}.
The ApplicationMaster
has to provide details such as
+ * allocated resource capability, security tokens (if enabled), command
+ * to be executed to start the container, environment for the process,
+ * necessary binaries/jar/shared-objects etc. via the
+ * {@link ContainerLaunchContext}.
ContainerLaunchContext
for the container to be started
+ * by the NodeManager
.
+ *
+ * @return ContainerLaunchContext
for the container to be started
+ * by the NodeManager
+ */
+ @Public
+ @Stable
public abstract ContainerLaunchContext getContainerLaunchContext();
+ @Private
+ @Unstable
public abstract void setContainerLaunchContext(ContainerLaunchContext context);
}
diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerResponse.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerResponse.java
index 7153d199853..ffbdbc9ee1a 100644
--- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerResponse.java
+++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerResponse.java
@@ -18,6 +18,18 @@
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.ContainerManager;
+
+/**
+ * The response sent by the NodeManager
to the
+ * ApplicationMaster
when asked to start an
+ * allocated container via
+ * {@link ContainerManager#startContainer(StartContainerRequest)}.
The request sent by the ApplicationMaster
to the
+ * NodeManager
to stop a container via
+ * {@link ContainerManager#stopContainer(StopContainerRequest)}.
ContainerId
of the container to be stopped.
+ * @return ContainerId
of container to be stopped
+ */
+ @Public
+ @Stable
ContainerId getContainerId();
+
+ @Private
+ @Unstable
void setContainerId(ContainerId containerId);
}
diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainerResponse.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainerResponse.java
index ffbdd8a246b..6b59ae66703 100644
--- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainerResponse.java
+++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainerResponse.java
@@ -18,6 +18,18 @@
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.ContainerManager;
+
+/**
+ * The response sent by the NodeManager
to the
+ * ApplicationMaster
when asked to stop an
+ * allocated container via
+ * {@link ContainerManager#stopContainer(StopContainerRequest)}.
ContainerLaunchContext
represents the all of the information
+ * needed by the NodeManager
to launch a container.
It includes details such as: + *
ContainerId
of container to be launched.
+ * @return ContainerId
of container to be launched
+ */
+ @Public
+ @Stable
ContainerId getContainerId();
+
+ @Private
+ @Unstable
+ void setContainerId(ContainerId containerId);
+
+ /**
+ * Get the user to whom the container has been allocated.
+ * @return the user to whom the container has been allocated
+ */
+ @Public
+ @Stable
String getUser();
+
+ @Private
+ @Unstable
+ void setUser(String user);
+
+ /**
+ * Get the Resource
allocated to the container by the
+ * ResourceManager
.
+ * @return Resource
allocated to the container by the
+ * ResourceManager
+ */
+ @Public
+ @Stable
Resource getResource();
+ @Private
+ @Unstable
+ void setResource(Resource resource);
+
+ /**
+ * Get security tokens (if security is enabled).
+ * @return security tokens (if security is enabled)
+ */
+ @Public
+ @Stable
+ ByteBuffer getContainerTokens();
+
+ @Private
+ @Unstable
+ void setContainerTokens(ByteBuffer containerToken);
+
+ /**
+ * Get all LocalResource
required by the container.
+ * @return all LocalResource
required by the container
+ */
+ @Public
+ @Stable
Map