001/** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019package org.apache.hadoop.yarn.api.protocolrecords; 020 021import java.util.List; 022import java.util.Map; 023 024import org.apache.hadoop.classification.InterfaceAudience.Private; 025import org.apache.hadoop.classification.InterfaceAudience.Public; 026import org.apache.hadoop.classification.InterfaceStability.Stable; 027import org.apache.hadoop.classification.InterfaceStability.Unstable; 028import org.apache.hadoop.yarn.api.ContainerManagementProtocol; 029import org.apache.hadoop.yarn.api.records.ContainerId; 030import org.apache.hadoop.yarn.api.records.ContainerStatus; 031import org.apache.hadoop.yarn.api.records.SerializedException; 032import org.apache.hadoop.yarn.util.Records; 033 034/** 035 * The response sent by the <code>NodeManager</code> to the 036 * <code>ApplicationMaster</code> when asked to obtain the 037 * <code>ContainerStatus</code> of requested containers. 038 * 039 * @see ContainerManagementProtocol#getContainerStatuses(GetContainerStatusesRequest) 040 */ 041@Public 042@Stable 043public abstract class GetContainerStatusesResponse { 044 045 @Private 046 @Unstable 047 public static GetContainerStatusesResponse newInstance( 048 List<ContainerStatus> statuses, 049 Map<ContainerId, SerializedException> failedRequests) { 050 GetContainerStatusesResponse response = 051 Records.newRecord(GetContainerStatusesResponse.class); 052 response.setContainerStatuses(statuses); 053 response.setFailedRequests(failedRequests); 054 return response; 055 } 056 057 /** 058 * Get the <code>ContainerStatus</code>es of the requested containers. 059 * 060 * @return <code>ContainerStatus</code>es of the requested containers. 061 */ 062 @Public 063 @Stable 064 public abstract List<ContainerStatus> getContainerStatuses(); 065 066 /** 067 * Set the <code>ContainerStatus</code>es of the requested containers. 068 */ 069 @Private 070 @Unstable 071 public abstract void setContainerStatuses(List<ContainerStatus> statuses); 072 073 /** 074 * Get the containerId-to-exception map in which the exception indicates error 075 * from per container for failed requests 076 */ 077 @Public 078 @Stable 079 public abstract Map<ContainerId, SerializedException> getFailedRequests(); 080 081 /** 082 * Set the containerId-to-exception map in which the exception indicates error 083 * from per container for failed requests 084 */ 085 @Private 086 @Unstable 087 public abstract void setFailedRequests( 088 Map<ContainerId, SerializedException> failedContainers); 089}