You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-commits@hadoop.apache.org by vi...@apache.org on 2013/07/24 05:41:05 UTC
svn commit: r1506391 [1/4] - in /hadoop/common/trunk/hadoop-yarn-project: ./
hadoop-yarn/dev-support/
hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/
hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrec...
Author: vinodkv
Date: Wed Jul 24 03:41:03 2013
New Revision: 1506391
URL: http://svn.apache.org/r1506391
Log:
YARN-926. Modified ContainerManagerProtcol APIs to take in requests for multiple containers. Contributed by Jian He.
MAPREDUCE-5412. Update MR app to use multiple containers API of ContainerManager after YARN-926. Contributed by Jian He.
Added:
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusesRequest.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusesResponse.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainersRequest.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainersResponse.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainersRequest.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainersResponse.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/SerializedException.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetContainerStatusesRequestPBImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetContainerStatusesResponsePBImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/StartContainersRequestPBImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/StartContainersResponsePBImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/StopContainersRequestPBImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/StopContainersResponsePBImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/SerializedExceptionPBImpl.java
Removed:
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusRequest.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusResponse.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerResponse.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainerRequest.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainerResponse.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetContainerStatusRequestPBImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetContainerStatusResponsePBImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/StartContainerResponsePBImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/StopContainerRequestPBImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/StopContainerResponsePBImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/SerializedException.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/records/impl/pb/SerializedExceptionPBImpl.java
Modified:
hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ContainerManagementProtocol.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerRequest.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResource.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResourceType.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResourceVisibility.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/InvalidContainerException.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/NMNotYetReadyException.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/ApplicationInitializationContext.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/AuxiliaryService.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/containermanagement_protocol.proto
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/NMClientImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ContainerManagementProtocolPBClientImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ContainerManagementProtocolPBServiceImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestContainerLaunchRPC.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRPC.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/utils/YarnServerBuilderUtils.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/TestYarnServerApiClasses.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/LocalResourceStatus.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/LocalResourceStatusPBImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ContainerLocalizer.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/DummyContainerManager.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestContainerManagerWithLCE.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestEventFlow.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerReboot.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerShutdown.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeStatusUpdater.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/api/protocolrecords/impl/pb/TestPBRecordImpl.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/BaseContainerManagerTest.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestContainerManager.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/TestContainerLaunch.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/MockLocalResourceStatus.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestResourceLocalizationService.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/TestLogAggregationService.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/TestContainersMonitor.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/amlauncher/AMLauncher.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/Application.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/NodeManager.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAMAuthorization.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestApplicationMasterLauncher.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/security/TestClientToAMTokens.java
hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestContainerManagerSecurity.java
Modified: hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt?rev=1506391&r1=1506390&r2=1506391&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt Wed Jul 24 03:41:03 2013
@@ -223,6 +223,9 @@ Release 2.1.0-beta - 2013-07-02
YARN-918. Remove ApplicationAttemptId from
RegisterApplicationMasterRequestProto. (vinodkv via acmurthy)
+ YARN-926. Modified ContainerManagerProtcol APIs to take in requests for
+ multiple containers. (Jian He via vinodkv)
+
NEW FEATURES
YARN-482. FS: Extend SchedulingMode to intermediate queues.
Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml?rev=1506391&r1=1506390&r2=1506391&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml (original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml Wed Jul 24 03:41:03 2013
@@ -131,6 +131,11 @@
<Class name="org.apache.hadoop.yarn.server.resourcemanager.resource.Priority$Comparator" />
<Bug pattern="SE_COMPARATOR_SHOULD_BE_SERIALIZABLE" />
</Match>
+ <!-- Ignore some irrelevant class name warning -->
+ <Match>
+ <Class name="org.apache.hadoop.yarn.api.records.SerializedException" />
+ <Bug pattern="NM_CLASS_NOT_EXCEPTION" />
+ </Match>
<!-- Inconsistent sync warning - only start() is synchronized-->
<Match>
Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ContainerManagementProtocol.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ContainerManagementProtocol.java?rev=1506391&r1=1506390&r2=1506391&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ContainerManagementProtocol.java (original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ContainerManagementProtocol.java Wed Jul 24 03:41:03 2013
@@ -22,17 +22,17 @@ import java.io.IOException;
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.GetContainerStatusesRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesResponse;
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.protocolrecords.StartContainersRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.StartContainersResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.StopContainersRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse;
import org.apache.hadoop.yarn.api.records.Container;
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.InvalidContainerException;
import org.apache.hadoop.yarn.exceptions.NMNotYetReadyException;
import org.apache.hadoop.yarn.exceptions.YarnException;
@@ -50,10 +50,12 @@ import org.apache.hadoop.yarn.exceptions
@Public
@Stable
public interface ContainerManagementProtocol {
+
/**
* <p>
- * The <code>ApplicationMaster</code> requests a <code>NodeManager</code> to
- * <em>start</em> a {@link Container} allocated to it using this interface.
+ * The <code>ApplicationMaster</code> provides a list of
+ * {@link StartContainerRequest}s to a <code>NodeManager</code> to
+ * <em>start</em> {@link Container}s allocated to it using this interface.
* </p>
*
* <p>
@@ -65,82 +67,107 @@ public interface ContainerManagementProt
* </p>
*
* <p>
- * Currently the <code>NodeManager</code> sends an immediate, empty response
- * via {@link StartContainerResponse} to signify acceptance of the request and
- * throws an exception in case of errors. The <code>ApplicationMaster</code>
- * can use {@link #getContainerStatus(GetContainerStatusRequest)} to get
- * updated status of the to-be-launched or launched container.
+ * The <code>NodeManager</code> sends a response via
+ * {@link StartContainersResponse} which includes a list of
+ * {@link Container}s of successfully launched {@link Container}s, a
+ * containerId-to-exception map for each failed {@link StartContainerRequest} in
+ * which the exception indicates errors from per container and a
+ * allServicesMetaData map between the names of auxiliary services and their
+ * corresponding meta-data. Note: None-container-specific exceptions will
+ * still be thrown by the API method itself.
+ * </p>
+ * <p>
+ * The <code>ApplicationMaster</code> can use
+ * {@link #getContainerStatuses(GetContainerStatusesRequest)} to get updated
+ * statuses of the to-be-launched or launched containers.
* </p>
*
* @param request
- * request to start a container
- * @return empty response to indicate acceptance of the request or an
- * exception
+ * request to start a list of containers
+ * @return response including conatinerIds of all successfully launched
+ * containers, a containerId-to-exception map for failed requests and
+ * a allServicesMetaData map.
* @throws YarnException
* @throws IOException
* @throws NMNotYetReadyException
* This exception is thrown when NM starts from scratch but has not
* yet connected with RM.
- * @throws InvalidContainerException
- * This exception is thrown when NM is rejecting start-container
- * requests for containers allocated by a previous instance of the
- * RM
*/
@Public
@Stable
- StartContainerResponse startContainer(StartContainerRequest request)
+ StartContainersResponse startContainers(StartContainersRequest request)
throws YarnException, IOException;
/**
- * <p>The <code>ApplicationMaster</code> requests a <code>NodeManager</code>
- * to <em>stop</em> a {@link Container} allocated to it using this interface.
+ * <p>
+ * The <code>ApplicationMaster</code> requests a <code>NodeManager</code> to
+ * <em>stop</em> a list of {@link Container}s allocated to it using this
+ * interface.
+ * </p>
+ *
+ * <p>
+ * The <code>ApplicationMaster</code> sends a {@link StopContainersRequest}
+ * which includes the {@link ContainerId}s of the containers to be stopped.
+ * </p>
+ *
+ * <p>
+ * The <code>NodeManager</code> sends a response via
+ * {@link StopContainersResponse} which includes a list of {@link ContainerId}
+ * s of successfully stopped containers, a containerId-to-exception map for
+ * each failed request in which the exception indicates errors from per
+ * container. Note: None-container-specific exceptions will still be thrown by
+ * the API method itself. <code>ApplicationMaster</code> can use
+ * {@link #getContainerStatuses(GetContainerStatusesRequest)} to get updated
+ * statuses of the containers.
* </p>
*
- * <p>The <code>ApplicationMaster</code> sends a
- * {@link StopContainerRequest} which includes the {@link ContainerId} of the
- * container to be stopped.</p>
- *
- * <p>Currently the <code>NodeManager</code> sends an immediate, empty
- * response via {@link StopContainerResponse} to signify acceptance of the
- * request and throws an exception in case of errors. The
- * <code>ApplicationMaster</code> can use
- * {@link #getContainerStatus(GetContainerStatusRequest)} to get updated
- * status of the container.</p>
- *
- * @param request request to stop a container
- * @return empty response to indicate acceptance of the request
- * or an exception
+ * @param request
+ * request to stop a list of containers
+ * @return response which includes a list of containerIds of successfully
+ * stopped containers, a containerId-to-exception map for failed
+ * requests.
* @throws YarnException
* @throws IOException
*/
@Public
@Stable
- StopContainerResponse stopContainer(StopContainerRequest request)
+ StopContainersResponse stopContainers(StopContainersRequest request)
throws YarnException, IOException;
/**
- * <p>The api used by the <code>ApplicationMaster</code> to request for
- * current status of a <code>Container</code> from the
- * <code>NodeManager</code>.</p>
- *
- * <p>The <code>ApplicationMaster</code> sends a
- * {@link GetContainerStatusRequest} which includes the {@link ContainerId} of
- * the container whose status is needed.</p>
- *
- *<p>The <code>NodeManager</code> responds with
- *{@link GetContainerStatusResponse} which includes the
- *{@link ContainerStatus} of the container.</p>
- *
- * @param request request to get <code>ContainerStatus</code> of a container
- * with the specified <code>ContainerId</code>
- * @return response containing the <code>ContainerStatus</code> of the
- * container
+ * <p>
+ * The API used by the <code>ApplicationMaster</code> to request for current
+ * statuses of <code>Container</code>s from the <code>NodeManager</code>.
+ * </p>
+ *
+ * <p>
+ * The <code>ApplicationMaster</code> sends a
+ * {@link GetContainerStatusesRequest} which includes the {@link ContainerId}s
+ * of all containers whose statuses are needed.
+ * </p>
+ *
+ * <p>
+ * The <code>NodeManager</code> responds with
+ * {@link GetContainerStatusesResponse} which includes a list of
+ * {@link ContainerStatus} of the successfully queried containers and a
+ * containerId-to-exception map for each failed request in which the exception
+ * indicates errors from per container. Note: None-container-specific
+ * exceptions will still be thrown by the API method itself.
+ * </p>
+ *
+ * @param request
+ * request to get <code>ContainerStatus</code>es of containers with
+ * the specified <code>ContainerId</code>s
+ * @return response containing the list of <code>ContainerStatus</code> of the
+ * successfully queried containers and a containerId-to-exception map
+ * for failed requests.
+ *
* @throws YarnException
* @throws IOException
*/
@Public
@Stable
- GetContainerStatusResponse getContainerStatus(
- GetContainerStatusRequest request) throws YarnException,
+ GetContainerStatusesResponse getContainerStatuses(
+ GetContainerStatusesRequest request) throws YarnException,
IOException;
}
Added: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusesRequest.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusesRequest.java?rev=1506391&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusesRequest.java (added)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusesRequest.java Wed Jul 24 03:41:03 2013
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.api.protocolrecords;
+
+import java.util.List;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.api.records.ContainerStatus;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * <p>
+ * The request sent by the <code>ApplicationMaster</code> to the
+ * <code>NodeManager</code> to get {@link ContainerStatus} of requested
+ * containers.
+ * </p>
+ *
+ * @see ContainerManagementProtocol#getContainerStatuses(GetContainerStatusesRequest)
+ */
+@Public
+@Stable
+public abstract class GetContainerStatusesRequest {
+
+ @Public
+ @Stable
+ public static GetContainerStatusesRequest newInstance(
+ List<ContainerId> containerIds) {
+ GetContainerStatusesRequest request =
+ Records.newRecord(GetContainerStatusesRequest.class);
+ request.setContainerIds(containerIds);
+ return request;
+ }
+
+ /**
+ * Get the list of <code>ContainerId</code>s of containers for which to obtain
+ * the <code>ContainerStatus</code>.
+ *
+ * @return the list of <code>ContainerId</code>s of containers for which to
+ * obtain the <code>ContainerStatus</code>.
+ */
+ @Public
+ @Stable
+ public abstract List<ContainerId> getContainerIds();
+
+ /**
+ * Set a list of <code>ContainerId</code>s of containers for which to obtain
+ * the <code>ContainerStatus</code>
+ *
+ * @param containerIds
+ * a list of <code>ContainerId</code>s of containers for which to
+ * obtain the <code>ContainerStatus</code>
+ */
+ @Public
+ @Stable
+ public abstract void setContainerIds(List<ContainerId> containerIds);
+}
Added: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusesResponse.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusesResponse.java?rev=1506391&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusesResponse.java (added)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusesResponse.java Wed Jul 24 03:41:03 2013
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.api.protocolrecords;
+
+import java.util.List;
+import java.util.Map;
+
+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.ContainerManagementProtocol;
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.api.records.ContainerStatus;
+import org.apache.hadoop.yarn.api.records.SerializedException;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * <p>
+ * The response sent by the <code>NodeManager</code> to the
+ * <code>ApplicationMaster</code> when asked to obtain the
+ * <code>ContainerStatus</code> of requested containers.
+ * </p>
+ *
+ * @see ContainerManagementProtocol#getContainerStatuses(GetContainerStatusesRequest)
+ */
+@Public
+@Stable
+public abstract class GetContainerStatusesResponse {
+
+ @Private
+ @Unstable
+ public static GetContainerStatusesResponse newInstance(
+ List<ContainerStatus> statuses,
+ Map<ContainerId, SerializedException> failedRequests) {
+ GetContainerStatusesResponse response =
+ Records.newRecord(GetContainerStatusesResponse.class);
+ response.setContainerStatuses(statuses);
+ response.setFailedRequests(failedRequests);
+ return response;
+ }
+
+ /**
+ * Get the <code>ContainerStatus</code>es of the requested containers.
+ *
+ * @return <code>ContainerStatus</code>es of the requested containers.
+ */
+ @Public
+ @Stable
+ public abstract List<ContainerStatus> getContainerStatuses();
+
+ /**
+ * Set the <code>ContainerStatus</code>es of the requested containers.
+ */
+ @Private
+ @Unstable
+ public abstract void setContainerStatuses(List<ContainerStatus> statuses);
+
+ /**
+ * Get the containerId-to-exception map in which the exception indicates error
+ * from per container for failed requests
+ */
+ @Public
+ @Stable
+ public abstract Map<ContainerId, SerializedException> getFailedRequests();
+
+ /**
+ * Set the containerId-to-exception map in which the exception indicates error
+ * from per container for failed requests
+ */
+ @Private
+ @Unstable
+ public abstract void setFailedRequests(
+ Map<ContainerId, SerializedException> failedContainers);
+}
Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerRequest.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerRequest.java?rev=1506391&r1=1506390&r2=1506391&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerRequest.java (original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerRequest.java Wed Jul 24 03:41:03 2013
@@ -36,7 +36,7 @@ import org.apache.hadoop.yarn.util.Recor
* necessary binaries/jar/shared-objects etc. via the
* {@link ContainerLaunchContext}.</p>
*
- * @see ContainerManagementProtocol#startContainer(StartContainerRequest)
+ * @see ContainerManagementProtocol#startContainers(StartContainersRequest)
*/
@Public
@Stable
@@ -81,7 +81,7 @@ public abstract class StartContainerRequ
* @return the container token to be used for authorization during starting
* container.
* @see NMToken
- * @see ContainerManagementProtocol#startContainer(StartContainerRequest)
+ * @see ContainerManagementProtocol#startContainers(StartContainersRequest)
*/
@Public
@Stable
Added: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainersRequest.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainersRequest.java?rev=1506391&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainersRequest.java (added)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainersRequest.java Wed Jul 24 03:41:03 2013
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.api.protocolrecords;
+
+import java.util.List;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
+import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * <p>
+ * The request which contains a list of {@link StartContainerRequest} sent by
+ * the <code>ApplicationMaster</code> to the <code>NodeManager</code> to
+ * <em>start</em> containers.
+ * </p>
+ *
+ * <p>
+ * In each {@link StartContainerRequest}, the <code>ApplicationMaster</code> 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}.
+ * </p>
+ *
+ * @see ContainerManagementProtocol#startContainers(StartContainersRequest)
+ */
+@Public
+@Stable
+public abstract class StartContainersRequest {
+
+ @Public
+ @Stable
+ public static StartContainersRequest newInstance(
+ List<StartContainerRequest> requests) {
+ StartContainersRequest request =
+ Records.newRecord(StartContainersRequest.class);
+ request.setStartContainerRequests(requests);
+ return request;
+ }
+
+ /**
+ * Get a list of {@link StartContainerRequest} to start containers.
+ * @return a list of {@link StartContainerRequest} to start containers.
+ */
+ @Public
+ @Stable
+ public abstract List<StartContainerRequest> getStartContainerRequests();
+
+ /**
+ * Set a list of {@link StartContainerRequest} to start containers.
+ * @param request a list of {@link StartContainerRequest} to start containers
+ */
+ @Public
+ @Stable
+ public abstract void setStartContainerRequests(
+ List<StartContainerRequest> request);
+}
Added: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainersResponse.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainersResponse.java?rev=1506391&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainersResponse.java (added)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainersResponse.java Wed Jul 24 03:41:03 2013
@@ -0,0 +1,131 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.api.protocolrecords;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+import java.util.Map;
+
+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.ContainerManagementProtocol;
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.api.records.SerializedException;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * <p>
+ * The response sent by the <code>NodeManager</code> to the
+ * <code>ApplicationMaster</code> when asked to <em>start</em> an allocated
+ * container.
+ * </p>
+ *
+ * @see ContainerManagementProtocol#startContainers(StartContainersRequest)
+ */
+@Public
+@Stable
+public abstract class StartContainersResponse {
+
+ @Private
+ @Unstable
+ public static StartContainersResponse newInstance(
+ Map<String, ByteBuffer> servicesMetaData,
+ List<ContainerId> succeededContainers,
+ Map<ContainerId, SerializedException> failedContainers) {
+ StartContainersResponse response =
+ Records.newRecord(StartContainersResponse.class);
+ response.setAllServicesMetaData(servicesMetaData);
+ response.setSuccessfullyStartedContainers(succeededContainers);
+ response.setFailedRequests(failedContainers);
+ return response;
+ }
+
+ /**
+ * Get the list of <code>ContainerId</code> s of the containers that are
+ * started successfully.
+ *
+ * @return the list of <code>ContainerId</code> s of the containers that are
+ * started successfully.
+ * @see ContainerManagementProtocol#startContainers(StartContainersRequest)
+ */
+ @Public
+ @Stable
+ public abstract List<ContainerId> getSuccessfullyStartedContainers();
+
+ @Private
+ @Unstable
+ public abstract void setSuccessfullyStartedContainers(
+ List<ContainerId> succeededContainers);
+
+ /**
+ * Get the containerId-to-exception map in which the exception indicates error
+ * from per container for failed requests
+ */
+ @Public
+ @Stable
+ public abstract Map<ContainerId, SerializedException> getFailedRequests();
+
+ /**
+ * Set the containerId-to-exception map in which the exception indicates error
+ * from per container for failed requests
+ */
+ @Private
+ @Unstable
+ public abstract void setFailedRequests(
+ Map<ContainerId, SerializedException> failedContainers);
+
+ /**
+ * <p>
+ * Get the meta-data from all auxiliary services running on the
+ * <code>NodeManager</code>.
+ * </p>
+ * <p>
+ * The meta-data is returned as a Map between the auxiliary service names and
+ * their corresponding per service meta-data as an opaque blob
+ * <code>ByteBuffer</code>
+ * </p>
+ *
+ * <p>
+ * To be able to interpret the per-service meta-data, you should consult the
+ * documentation for the Auxiliary-service configured on the NodeManager
+ * </p>
+ *
+ * @return a Map between the names of auxiliary services and their
+ * corresponding meta-data
+ */
+ @Public
+ @Stable
+ public abstract Map<String, ByteBuffer> getAllServicesMetaData();
+
+ /**
+ * Set to the list of auxiliary services which have been started on the
+ * <code>NodeManager</code>. This is done only once when the
+ * <code>NodeManager</code> starts up
+ *
+ * @param allServicesMetaData
+ * A map from auxiliary service names to the opaque blob
+ * <code>ByteBuffer</code> for that auxiliary service
+ */
+ @Private
+ @Unstable
+ public abstract void setAllServicesMetaData(
+ Map<String, ByteBuffer> allServicesMetaData);
+}
Added: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainersRequest.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainersRequest.java?rev=1506391&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainersRequest.java (added)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainersRequest.java Wed Jul 24 03:41:03 2013
@@ -0,0 +1,63 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.hadoop.yarn.api.protocolrecords;
+
+import java.util.List;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * <p>The request sent by the <code>ApplicationMaster</code> to the
+ * <code>NodeManager</code> to <em>stop</em> containers.</p>
+ *
+ * @see ContainerManagementProtocol#stopContainers(StopContainersRequest)
+ */
+@Public
+@Stable
+public abstract class StopContainersRequest {
+
+ @Public
+ @Stable
+ public static StopContainersRequest newInstance(List<ContainerId> containerIds) {
+ StopContainersRequest request =
+ Records.newRecord(StopContainersRequest.class);
+ request.setContainerIds(containerIds);
+ return request;
+ }
+
+ /**
+ * Get the <code>ContainerId</code>s of the containers to be stopped.
+ * @return <code>ContainerId</code>s of containers to be stopped
+ */
+ @Public
+ @Stable
+ public abstract List<ContainerId> getContainerIds();
+
+ /**
+ * Set the <code>ContainerId</code>s of the containers to be stopped.
+ * @param containerIds <code>ContainerId</code>s of the containers to be stopped
+ */
+ @Public
+ @Stable
+ public abstract void setContainerIds(List<ContainerId> containerIds);
+}
Added: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainersResponse.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainersResponse.java?rev=1506391&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainersResponse.java (added)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainersResponse.java Wed Jul 24 03:41:03 2013
@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.api.protocolrecords;
+
+import java.util.List;
+import java.util.Map;
+
+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.ContainerManagementProtocol;
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.api.records.SerializedException;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * <p>
+ * The response sent by the <code>NodeManager</code> to the
+ * <code>ApplicationMaster</code> when asked to <em>stop</em> allocated
+ * containers.
+ * </p>
+ *
+ * @see ContainerManagementProtocol#stopContainers(StopContainersRequest)
+ */
+@Public
+@Stable
+public abstract class StopContainersResponse {
+ @Private
+ @Unstable
+ public static StopContainersResponse newInstance(
+ List<ContainerId> succeededRequests,
+ Map<ContainerId, SerializedException> failedRequests) {
+ StopContainersResponse response =
+ Records.newRecord(StopContainersResponse.class);
+ response.setFailedRequests(failedRequests);
+ response.setSuccessfullyStoppedContainers(succeededRequests);
+ return response;
+ }
+
+ /**
+ * Get the list of containerIds of successfully stopped containers.
+ *
+ * @return the list of containerIds of successfully stopped containers.
+ */
+ @Public
+ @Stable
+ public abstract List<ContainerId> getSuccessfullyStoppedContainers();
+
+ /**
+ * Set the list of containerIds of successfully stopped containers.
+ */
+ @Private
+ @Unstable
+ public abstract void setSuccessfullyStoppedContainers(
+ List<ContainerId> succeededRequests);
+
+ /**
+ * Get the containerId-to-exception map in which the exception indicates error
+ * from per container for failed requests
+ */
+ @Public
+ @Stable
+ public abstract Map<ContainerId, SerializedException> getFailedRequests();
+
+ /**
+ * Set the containerId-to-exception map in which the exception indicates error
+ * from per container for failed requests
+ */
+ @Private
+ @Unstable
+ public abstract void setFailedRequests(
+ Map<ContainerId, SerializedException> failedRequests);
+}
\ No newline at end of file
Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java?rev=1506391&r1=1506390&r2=1506391&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java (original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java Wed Jul 24 03:41:03 2013
@@ -57,8 +57,8 @@ import org.apache.hadoop.yarn.util.Recor
* start/stop containers.</p>
*
* @see ApplicationMasterProtocol#allocate(org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest)
- * @see ContainerManagementProtocol#startContainer(org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest)
- * @see ContainerManagementProtocol#stopContainer(org.apache.hadoop.yarn.api.protocolrecords.StopContainerRequest)
+ * @see ContainerManagementProtocol#startContainers(org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest)
+ * @see ContainerManagementProtocol#stopContainers(org.apache.hadoop.yarn.api.protocolrecords.StopContainersRequest)
*/
@Public
@Stable
@@ -155,7 +155,7 @@ public abstract class Container implemen
* <code>Container</code> includes the <code>ContainerToken</code>.</p>
*
* @see ApplicationMasterProtocol#allocate(org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest)
- * @see ContainerManagementProtocol#startContainer(org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest)
+ * @see ContainerManagementProtocol#startContainers(org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest)
*
* @return <code>ContainerToken</code> for the container
*/
Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java?rev=1506391&r1=1506390&r2=1506391&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java (original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java Wed Jul 24 03:41:03 2013
@@ -49,7 +49,7 @@ import org.apache.hadoop.yarn.util.Recor
* </ul>
* </p>
*
- * @see ContainerManagementProtocol#startContainer(org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest)
+ * @see ContainerManagementProtocol#startContainers(org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest)
*/
@Public
@Stable
@@ -132,7 +132,7 @@ public abstract class ContainerLaunchCon
/**
* <p>
- * Get application-specific binary <em>service data</em>. This is a map keyed
+ * Set application-specific binary <em>service data</em>. This is a map keyed
* by the name of each {@link AuxiliaryService} that is configured on a
* NodeManager and value correspond to the application specific data targeted
* for the keyed {@link AuxiliaryService}. All pre-existing Map entries are
Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResource.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResource.java?rev=1506391&r1=1506390&r2=1506391&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResource.java (original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResource.java Wed Jul 24 03:41:03 2013
@@ -37,7 +37,7 @@ import org.apache.hadoop.yarn.util.Recor
* @see LocalResourceVisibility
* @see ContainerLaunchContext
* @see ApplicationSubmissionContext
- * @see ContainerManagementProtocol#startContainer(org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest)
+ * @see ContainerManagementProtocol#startContainers(org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest)
*/
@Public
@Stable
Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResourceType.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResourceType.java?rev=1506391&r1=1506390&r2=1506391&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResourceType.java (original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResourceType.java Wed Jul 24 03:41:03 2013
@@ -43,7 +43,7 @@ import org.apache.hadoop.yarn.api.Contai
* @see LocalResource
* @see ContainerLaunchContext
* @see ApplicationSubmissionContext
- * @see ContainerManagementProtocol#startContainer(org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest)
+ * @see ContainerManagementProtocol#startContainers(org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest)
*/
@Public
@Stable
Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResourceVisibility.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResourceVisibility.java?rev=1506391&r1=1506390&r2=1506391&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResourceVisibility.java (original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResourceVisibility.java Wed Jul 24 03:41:03 2013
@@ -43,7 +43,7 @@ import org.apache.hadoop.yarn.api.Contai
* @see LocalResource
* @see ContainerLaunchContext
* @see ApplicationSubmissionContext
- * @see ContainerManagementProtocol#startContainer(org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest)
+ * @see ContainerManagementProtocol#startContainers(org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest)
*/
@Public
@Stable
Added: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/SerializedException.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/SerializedException.java?rev=1506391&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/SerializedException.java (added)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/SerializedException.java Wed Jul 24 03:41:03 2013
@@ -0,0 +1,93 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.api.records;
+
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.util.Records;
+
+@Private
+@Unstable
+public abstract class SerializedException {
+
+ @Private
+ @Unstable
+ public static SerializedException newInstance(Throwable e) {
+ SerializedException exception =
+ Records.newRecord(SerializedException.class);
+ exception.init(e);
+ return exception;
+ }
+
+ /**
+ * Constructs a new <code>SerializedException</code> with the specified detail
+ * message and cause.
+ */
+ @Private
+ @Unstable
+ public abstract void init(String message, Throwable cause);
+
+ /**
+ * Constructs a new <code>SerializedException</code> with the specified detail
+ * message.
+ */
+ @Private
+ @Unstable
+ public abstract void init(String message);
+
+ /**
+ * Constructs a new <code>SerializedException</code> with the specified cause.
+ */
+ @Private
+ @Unstable
+ public abstract void init(Throwable cause);
+
+ /**
+ * Get the detail message string of this exception.
+ * @return the detail message string of this exception.
+ */
+ @Private
+ @Unstable
+ public abstract String getMessage();
+
+ /**
+ * Get the backtrace of this exception.
+ * @return the backtrace of this exception.
+ */
+ @Private
+ @Unstable
+ public abstract String getRemoteTrace();
+
+ /**
+ * Get the cause of this exception or null if the cause is nonexistent or
+ * unknown.
+ * @return the cause of this exception.
+ */
+ @Private
+ @Unstable
+ public abstract SerializedException getCause();
+
+ /**
+ * Deserialize the exception to a new Throwable.
+ * @return the Throwable form of this serialized exception.
+ */
+ @Private
+ @Unstable
+ public abstract Throwable deSerialize();
+}
\ No newline at end of file
Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/InvalidContainerException.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/InvalidContainerException.java?rev=1506391&r1=1506390&r2=1506391&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/InvalidContainerException.java (original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/InvalidContainerException.java Wed Jul 24 03:41:03 2013
@@ -19,12 +19,12 @@
package org.apache.hadoop.yarn.exceptions;
import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
-import org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest;
/**
* This exception is thrown by a NodeManager that is rejecting start-container
* requests via
- * {@link ContainerManagementProtocol#startContainer(StartContainerRequest)}
+ * {@link ContainerManagementProtocol#startContainers(StartContainersRequest)}
* for containers allocated by a previous instance of the RM.
*/
public class InvalidContainerException extends YarnException {
Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/NMNotYetReadyException.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/NMNotYetReadyException.java?rev=1506391&r1=1506390&r2=1506391&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/NMNotYetReadyException.java (original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/exceptions/NMNotYetReadyException.java Wed Jul 24 03:41:03 2013
@@ -19,11 +19,11 @@
package org.apache.hadoop.yarn.exceptions;
import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
-import org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest;
/**
* This exception is thrown on
- * {@link ContainerManagementProtocol#startContainer(StartContainerRequest)} API
+ * {@link ContainerManagementProtocol#startContainers(StartContainersRequest)} API
* when an NM starts from scratch but has not yet connected with RM.
*/
public class NMNotYetReadyException extends YarnException {
Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/ApplicationInitializationContext.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/ApplicationInitializationContext.java?rev=1506391&r1=1506390&r2=1506391&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/ApplicationInitializationContext.java (original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/ApplicationInitializationContext.java Wed Jul 24 03:41:03 2013
@@ -25,7 +25,7 @@ import org.apache.hadoop.classification.
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
-import org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
@@ -70,7 +70,7 @@ public class ApplicationInitializationCo
/**
* Get the data sent to the NodeManager via
- * {@link ContainerManagementProtocol#startContainer(StartContainerRequest)}
+ * {@link ContainerManagementProtocol#startContainers(StartContainersRequest)}
* as part of {@link ContainerLaunchContext#getServiceData()}
*
* @return the servicesData for this application.
Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/AuxiliaryService.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/AuxiliaryService.java?rev=1506391&r1=1506390&r2=1506391&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/AuxiliaryService.java (original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/AuxiliaryService.java Wed Jul 24 03:41:03 2013
@@ -24,8 +24,8 @@ import org.apache.hadoop.classification.
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.service.AbstractService;
import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
-import org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest;
-import org.apache.hadoop.yarn.api.protocolrecords.StartContainerResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.StartContainersResponse;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
/**
@@ -71,8 +71,8 @@ public abstract class AuxiliaryService e
*
* <p>
* The information is passed along to applications via
- * {@link StartContainerResponse#getAllServicesMetaData()} that is returned by
- * {@link ContainerManagementProtocol#startContainer(StartContainerRequest)}
+ * {@link StartContainersResponse#getAllServicesMetaData()} that is returned by
+ * {@link ContainerManagementProtocol#startContainers(StartContainersRequest)}
* </p>
*
* @return meta-data for this service that should be made available to
Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/containermanagement_protocol.proto
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/containermanagement_protocol.proto?rev=1506391&r1=1506390&r2=1506391&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/containermanagement_protocol.proto (original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/containermanagement_protocol.proto Wed Jul 24 03:41:03 2013
@@ -30,7 +30,7 @@ option java_generate_equals_and_hash = t
import "yarn_service_protos.proto";
service ContainerManagementProtocolService {
- rpc startContainer(StartContainerRequestProto) returns (StartContainerResponseProto);
- rpc stopContainer(StopContainerRequestProto) returns (StopContainerResponseProto);
- rpc getContainerStatus(GetContainerStatusRequestProto) returns (GetContainerStatusResponseProto);
+ rpc startContainers(StartContainersRequestProto) returns (StartContainersResponseProto);
+ rpc stopContainers(StopContainersRequestProto) returns (StopContainersResponseProto);
+ rpc getContainerStatuses(GetContainerStatusesRequestProto) returns (GetContainerStatusesResponseProto);
}
Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto?rev=1506391&r1=1506390&r2=1506391&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto (original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto Wed Jul 24 03:41:03 2013
@@ -182,3 +182,37 @@ message GetContainerStatusRequestProto {
message GetContainerStatusResponseProto {
optional ContainerStatusProto status = 1;
}
+
+//// bulk API records
+message StartContainersRequestProto {
+ repeated StartContainerRequestProto start_container_request = 1;
+}
+
+message ContainerExceptionMapProto {
+ optional ContainerIdProto container_id = 1;
+ optional SerializedExceptionProto exception = 2;
+}
+
+message StartContainersResponseProto {
+ repeated StringBytesMapProto services_meta_data = 1;
+ repeated ContainerIdProto succeeded_requests = 2;
+ repeated ContainerExceptionMapProto failed_requests = 3;
+}
+
+message StopContainersRequestProto {
+ repeated ContainerIdProto container_id = 1;
+}
+
+message StopContainersResponseProto {
+ repeated ContainerIdProto succeeded_requests = 1;
+ repeated ContainerExceptionMapProto failed_requests = 2;
+}
+
+message GetContainerStatusesRequestProto {
+ repeated ContainerIdProto container_id = 1;
+}
+
+message GetContainerStatusesResponseProto {
+ repeated ContainerStatusProto status = 1;
+ repeated ContainerExceptionMapProto failed_requests = 2;
+}
Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/NMClientImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/NMClientImpl.java?rev=1506391&r1=1506390&r2=1506391&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/NMClientImpl.java (original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/NMClientImpl.java Wed Jul 24 03:41:03 2013
@@ -20,6 +20,8 @@ package org.apache.hadoop.yarn.client.ap
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -30,9 +32,14 @@ import org.apache.commons.logging.LogFac
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusRequest;
+import org.apache.hadoop.security.token.SecretManager.InvalidToken;
+import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesResponse;
import org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest;
-import org.apache.hadoop.yarn.api.protocolrecords.StopContainerRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.StartContainersResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.StopContainersRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse;
import org.apache.hadoop.yarn.api.records.Container;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
@@ -181,11 +188,23 @@ public class NMClientImpl extends NMClie
proxy =
cmProxy.getProxy(container.getNodeId().toString(),
container.getId());
- allServiceResponse =
+ StartContainerRequest scRequest =
+ StartContainerRequest.newInstance(containerLaunchContext,
+ container.getContainerToken());
+ List<StartContainerRequest> list = new ArrayList<StartContainerRequest>();
+ list.add(scRequest);
+ StartContainersRequest allRequests =
+ StartContainersRequest.newInstance(list);
+ StartContainersResponse response =
proxy
- .getContainerManagementProtocol().startContainer(
- StartContainerRequest.newInstance(containerLaunchContext,
- container.getContainerToken())).getAllServicesMetaData();
+ .getContainerManagementProtocol().startContainers(allRequests);
+ if (response.getFailedRequests() != null
+ && response.getFailedRequests().containsKey(container.getId())) {
+ Throwable t =
+ response.getFailedRequests().get(container.getId()).deSerialize();
+ parseAndThrowException(t);
+ }
+ allServiceResponse = response.getAllServicesMetaData();
startingContainer.state = ContainerState.RUNNING;
} catch (YarnException e) {
startingContainer.state = ContainerState.COMPLETE;
@@ -238,11 +257,20 @@ public class NMClientImpl extends NMClie
NodeId nodeId) throws YarnException, IOException {
ContainerManagementProtocolProxyData proxy = null;
+ List<ContainerId> containerIds = new ArrayList<ContainerId>();
+ containerIds.add(containerId);
try {
proxy = cmProxy.getProxy(nodeId.toString(), containerId);
- ContainerStatus containerStatus =
- proxy.getContainerManagementProtocol().getContainerStatus(
- GetContainerStatusRequest.newInstance(containerId)).getStatus();
+ GetContainerStatusesResponse response =
+ proxy.getContainerManagementProtocol().getContainerStatuses(
+ GetContainerStatusesRequest.newInstance(containerIds));
+ if (response.getFailedRequests() != null
+ && response.getFailedRequests().containsKey(containerId)) {
+ Throwable t =
+ response.getFailedRequests().get(containerId).deSerialize();
+ parseAndThrowException(t);
+ }
+ ContainerStatus containerStatus = response.getContainerStatuses().get(0);
return containerStatus;
} finally {
if (proxy != null) {
@@ -254,10 +282,19 @@ public class NMClientImpl extends NMClie
private void stopContainerInternal(ContainerId containerId, NodeId nodeId)
throws IOException, YarnException {
ContainerManagementProtocolProxyData proxy = null;
+ List<ContainerId> containerIds = new ArrayList<ContainerId>();
+ containerIds.add(containerId);
try {
proxy = cmProxy.getProxy(nodeId.toString(), containerId);
- proxy.getContainerManagementProtocol().stopContainer(
- StopContainerRequest.newInstance(containerId));
+ StopContainersResponse response =
+ proxy.getContainerManagementProtocol().stopContainers(
+ StopContainersRequest.newInstance(containerIds));
+ if (response.getFailedRequests() != null
+ && response.getFailedRequests().containsKey(containerId)) {
+ Throwable t = response.getFailedRequests().get(containerId)
+ .deSerialize();
+ parseAndThrowException(t);
+ }
} finally {
if (proxy != null) {
cmProxy.mayBeCloseProxy(proxy);
@@ -285,4 +322,15 @@ public class NMClientImpl extends NMClie
public AtomicBoolean getCleanupRunningContainers() {
return cleanupRunningContainers;
}
+
+ private void parseAndThrowException(Throwable t) throws YarnException,
+ IOException {
+ if (t instanceof YarnException) {
+ throw (YarnException) t;
+ } else if (t instanceof InvalidToken) {
+ throw (InvalidToken) t;
+ } else {
+ throw (IOException) t;
+ }
+ }
}
Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ContainerManagementProtocolPBClientImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ContainerManagementProtocolPBClientImpl.java?rev=1506391&r1=1506390&r2=1506391&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ContainerManagementProtocolPBClientImpl.java (original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ContainerManagementProtocolPBClientImpl.java Wed Jul 24 03:41:03 2013
@@ -30,24 +30,24 @@ import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
import org.apache.hadoop.yarn.api.ContainerManagementProtocolPB;
-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.protocolrecords.impl.pb.GetContainerStatusRequestPBImpl;
-import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.GetContainerStatusResponsePBImpl;
-import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.StartContainerRequestPBImpl;
-import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.StartContainerResponsePBImpl;
-import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.StopContainerRequestPBImpl;
-import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.StopContainerResponsePBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.StartContainersResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.StopContainersRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.GetContainerStatusesRequestPBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.GetContainerStatusesResponsePBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.StartContainersRequestPBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.StartContainersResponsePBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.StopContainersRequestPBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.StopContainersResponsePBImpl;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.ipc.RPCUtil;
-import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainerStatusRequestProto;
-import org.apache.hadoop.yarn.proto.YarnServiceProtos.StartContainerRequestProto;
-import org.apache.hadoop.yarn.proto.YarnServiceProtos.StopContainerRequestProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainerStatusesRequestProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.StartContainersRequestProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.StopContainersRequestProto;
import com.google.protobuf.ServiceException;
@@ -87,14 +87,14 @@ public class ContainerManagementProtocol
}
@Override
- public GetContainerStatusResponse getContainerStatus(
- GetContainerStatusRequest request) throws YarnException,
- IOException {
- GetContainerStatusRequestProto requestProto =
- ((GetContainerStatusRequestPBImpl) request).getProto();
+ public StartContainersResponse
+ startContainers(StartContainersRequest requests) throws YarnException,
+ IOException {
+ StartContainersRequestProto requestProto =
+ ((StartContainersRequestPBImpl) requests).getProto();
try {
- return new GetContainerStatusResponsePBImpl(proxy.getContainerStatus(
- null, requestProto));
+ return new StartContainersResponsePBImpl(proxy.startContainers(null,
+ requestProto));
} catch (ServiceException e) {
RPCUtil.unwrapAndThrowException(e);
return null;
@@ -102,12 +102,12 @@ public class ContainerManagementProtocol
}
@Override
- public StartContainerResponse startContainer(StartContainerRequest request)
+ public StopContainersResponse stopContainers(StopContainersRequest requests)
throws YarnException, IOException {
- StartContainerRequestProto requestProto =
- ((StartContainerRequestPBImpl) request).getProto();
+ StopContainersRequestProto requestProto =
+ ((StopContainersRequestPBImpl) requests).getProto();
try {
- return new StartContainerResponsePBImpl(proxy.startContainer(null,
+ return new StopContainersResponsePBImpl(proxy.stopContainers(null,
requestProto));
} catch (ServiceException e) {
RPCUtil.unwrapAndThrowException(e);
@@ -116,13 +116,13 @@ public class ContainerManagementProtocol
}
@Override
- public StopContainerResponse stopContainer(StopContainerRequest request)
- throws YarnException, IOException {
- StopContainerRequestProto requestProto =
- ((StopContainerRequestPBImpl) request).getProto();
+ public GetContainerStatusesResponse getContainerStatuses(
+ GetContainerStatusesRequest request) throws YarnException, IOException {
+ GetContainerStatusesRequestProto requestProto =
+ ((GetContainerStatusesRequestPBImpl) request).getProto();
try {
- return new StopContainerResponsePBImpl(proxy.stopContainer(null,
- requestProto));
+ return new GetContainerStatusesResponsePBImpl(proxy.getContainerStatuses(
+ null, requestProto));
} catch (ServiceException e) {
RPCUtil.unwrapAndThrowException(e);
return null;