|
@@ -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;
|
|
|
|
|
|
+/**
|
|
|
+ * <p>The protocol between a live instance of <code>ApplicationMaster</code>
|
|
|
+ * and the <code>ResourceManager</code>.</p>
|
|
|
+ *
|
|
|
+ * <p>This is used by the <code>ApplicationMaster</code> to register/unregister
|
|
|
+ * and to request and obtain resources in the cluster from the
|
|
|
+ * <code>ResourceManager</code>.</p>
|
|
|
+ */
|
|
|
+@Public
|
|
|
+@Stable
|
|
|
public interface AMRMProtocol {
|
|
|
- public RegisterApplicationMasterResponse registerApplicationMaster(RegisterApplicationMasterRequest request) throws YarnRemoteException;
|
|
|
- public FinishApplicationMasterResponse finishApplicationMaster(FinishApplicationMasterRequest request) throws YarnRemoteException;;
|
|
|
- public AllocateResponse allocate(AllocateRequest request) throws YarnRemoteException;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * <p>The interface used by a new <code>ApplicationMaster</code> to register
|
|
|
+ * with the <code>ResourceManager</code>.</p>
|
|
|
+ *
|
|
|
+ * <p>The <code>ApplicationMaster</code> needs to provide details such
|
|
|
+ * as RPC Port, HTTP tracking url etc. as specified in
|
|
|
+ * {@link RegisterApplicationMasterRequest}.</p>
|
|
|
+ *
|
|
|
+ * <p>The <code>ResourceManager</code> responds with critical details such
|
|
|
+ * as minimum and maximum resource capabilities in the cluster as specified in
|
|
|
+ * {@link RegisterApplicationMasterResponse}.</p>
|
|
|
+ *
|
|
|
+ * @param request registration request
|
|
|
+ * @return registration respose
|
|
|
+ * @throws YarnRemoteException
|
|
|
+ */
|
|
|
+ public RegisterApplicationMasterResponse registerApplicationMaster(
|
|
|
+ RegisterApplicationMasterRequest request)
|
|
|
+ throws YarnRemoteException;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * <p>The interface used by an <code>ApplicationMaster</code> to notify the
|
|
|
+ * <code>ResourceManager</code> about its completion (success or failed).</p>
|
|
|
+ *
|
|
|
+ * <p>The <code>ApplicationMaster</code> has to provide details such as
|
|
|
+ * final state, diagnostics (in case of failures) etc. as specified in
|
|
|
+ * {@link FinishApplicationMasterRequest}.</p>
|
|
|
+ *
|
|
|
+ * <p>The <code>ResourceManager</code> responds with
|
|
|
+ * {@link FinishApplicationMasterResponse}.</p>
|
|
|
+ *
|
|
|
+ * @param request completion request
|
|
|
+ * @return completion response
|
|
|
+ * @throws YarnRemoteException
|
|
|
+ */
|
|
|
+ public FinishApplicationMasterResponse finishApplicationMaster(
|
|
|
+ FinishApplicationMasterRequest request)
|
|
|
+ throws YarnRemoteException;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * <p>The main interface between an <code>ApplicationMaster</code>
|
|
|
+ * and the <code>ResourceManager</code>.</p>
|
|
|
+ *
|
|
|
+ * <p>The <code>ApplicationMaster</code> uses this interface to provide a list
|
|
|
+ * of {@link ResourceRequest} and returns unused {@link Container} allocated
|
|
|
+ * to it via {@link AllocateRequest}.</p>
|
|
|
+ *
|
|
|
+ * <p>The <code>ResourceManager</code> responds with list of allocated
|
|
|
+ * {@link Container}, status of completed containers and headroom information
|
|
|
+ * for the application.</p>
|
|
|
+ *
|
|
|
+ * <p>The <code>ApplicationMaster</code> can use the available headroom
|
|
|
+ * (resources) to decide how to utilized allocated resources and make
|
|
|
+ * informed decisions about future resource requests.</p>
|
|
|
+ *
|
|
|
+ * @param request allocation request
|
|
|
+ * @return allocation response
|
|
|
+ * @throws YarnRemoteException
|
|
|
+ */
|
|
|
+ public AllocateResponse allocate(AllocateRequest request)
|
|
|
+ throws YarnRemoteException;
|
|
|
}
|