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.records;
020
021import org.apache.hadoop.classification.InterfaceAudience.Private;
022import org.apache.hadoop.classification.InterfaceAudience.Public;
023import org.apache.hadoop.classification.InterfaceStability.Unstable;
024import org.apache.hadoop.yarn.util.Records;
025
026/**
027 * <p>
028 * <code>ContainerReport</code> is a report of an container.
029 * </p>
030 * 
031 * <p>
032 * It includes details such as:
033 * <ul>
034 * <li>{@link ContainerId} of the container.</li>
035 * <li>Allocated Resources to the container.</li>
036 * <li>Assigned Node id.</li>
037 * <li>Assigned Priority.</li>
038 * <li>Creation Time.</li>
039 * <li>Finish Time.</li>
040 * <li>Container Exit Status.</li>
041 * <li>{@link ContainerState} of the container.</li>
042 * <li>Diagnostic information in case of errors.</li>
043 * <li>Log URL.</li>
044 * <li>nodeHttpAddress</li>
045 * </ul>
046 * </p>
047 * 
048 */
049
050@Public
051@Unstable
052public abstract class ContainerReport {
053  @Private
054  @Unstable
055  public static ContainerReport newInstance(ContainerId containerId,
056      Resource allocatedResource, NodeId assignedNode, Priority priority,
057      long creationTime, long finishTime, String diagnosticInfo, String logUrl,
058      int containerExitStatus, ContainerState containerState,
059      String nodeHttpAddress) {
060    ContainerReport report = Records.newRecord(ContainerReport.class);
061    report.setContainerId(containerId);
062    report.setAllocatedResource(allocatedResource);
063    report.setAssignedNode(assignedNode);
064    report.setPriority(priority);
065    report.setCreationTime(creationTime);
066    report.setFinishTime(finishTime);
067    report.setDiagnosticsInfo(diagnosticInfo);
068    report.setLogUrl(logUrl);
069    report.setContainerExitStatus(containerExitStatus);
070    report.setContainerState(containerState);
071    report.setNodeHttpAddress(nodeHttpAddress);
072    return report;
073  }
074
075  /**
076   * Get the <code>ContainerId</code> of the container.
077   * 
078   * @return <code>ContainerId</code> of the container.
079   */
080  @Public
081  @Unstable
082  public abstract ContainerId getContainerId();
083
084  @Public
085  @Unstable
086  public abstract void setContainerId(ContainerId containerId);
087
088  /**
089   * Get the allocated <code>Resource</code> of the container.
090   * 
091   * @return allocated <code>Resource</code> of the container.
092   */
093  @Public
094  @Unstable
095  public abstract Resource getAllocatedResource();
096
097  @Public
098  @Unstable
099  public abstract void setAllocatedResource(Resource resource);
100
101  /**
102   * Get the allocated <code>NodeId</code> where container is running.
103   * 
104   * @return allocated <code>NodeId</code> where container is running.
105   */
106  @Public
107  @Unstable
108  public abstract NodeId getAssignedNode();
109
110  @Public
111  @Unstable
112  public abstract void setAssignedNode(NodeId nodeId);
113
114  /**
115   * Get the allocated <code>Priority</code> of the container.
116   * 
117   * @return allocated <code>Priority</code> of the container.
118   */
119  @Public
120  @Unstable
121  public abstract Priority getPriority();
122
123  @Public
124  @Unstable
125  public abstract void setPriority(Priority priority);
126
127  /**
128   * Get the creation time of the container.
129   * 
130   * @return creation time of the container
131   */
132  @Public
133  @Unstable
134  public abstract long getCreationTime();
135
136  @Public
137  @Unstable
138  public abstract void setCreationTime(long creationTime);
139
140  /**
141   * Get the Finish time of the container.
142   * 
143   * @return Finish time of the container
144   */
145  @Public
146  @Unstable
147  public abstract long getFinishTime();
148
149  @Public
150  @Unstable
151  public abstract void setFinishTime(long finishTime);
152
153  /**
154   * Get the DiagnosticsInfo of the container.
155   * 
156   * @return DiagnosticsInfo of the container
157   */
158  @Public
159  @Unstable
160  public abstract String getDiagnosticsInfo();
161
162  @Public
163  @Unstable
164  public abstract void setDiagnosticsInfo(String diagnosticsInfo);
165
166  /**
167   * Get the LogURL of the container.
168   * 
169   * @return LogURL of the container
170   */
171  @Public
172  @Unstable
173  public abstract String getLogUrl();
174
175  @Public
176  @Unstable
177  public abstract void setLogUrl(String logUrl);
178
179  /**
180   * Get the final <code>ContainerState</code> of the container.
181   * 
182   * @return final <code>ContainerState</code> of the container.
183   */
184  @Public
185  @Unstable
186  public abstract ContainerState getContainerState();
187
188  @Public
189  @Unstable
190  public abstract void setContainerState(ContainerState containerState);
191
192  /**
193   * Get the final <code>exit status</code> of the container.
194   * 
195   * @return final <code>exit status</code> of the container.
196   */
197  @Public
198  @Unstable
199  public abstract int getContainerExitStatus();
200
201  @Public
202  @Unstable
203  public abstract void setContainerExitStatus(int containerExitStatus);
204
205  /**
206   * Get the Node Http address of the container
207   * 
208   * @return the node http address of the container
209   */
210  @Public
211  @Unstable
212  public abstract String getNodeHttpAddress();
213
214  @Private
215  @Unstable
216  public abstract void setNodeHttpAddress(String nodeHttpAddress);
217}