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 019 package org.apache.hadoop.yarn.api.records; 020 021 import org.apache.hadoop.classification.InterfaceAudience.Private; 022 import org.apache.hadoop.classification.InterfaceAudience.Public; 023 import org.apache.hadoop.classification.InterfaceStability.Unstable; 024 import 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>Start 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 * </ul> 045 * </p> 046 * 047 */ 048 049 @Public 050 @Unstable 051 public abstract class ContainerReport { 052 @Private 053 @Unstable 054 public static ContainerReport newInstance(ContainerId containerId, 055 Resource allocatedResource, NodeId assignedNode, Priority priority, 056 long startTime, long finishTime, String diagnosticInfo, String logUrl, 057 int containerExitStatus, ContainerState containerState) { 058 ContainerReport report = Records.newRecord(ContainerReport.class); 059 report.setContainerId(containerId); 060 report.setAllocatedResource(allocatedResource); 061 report.setAssignedNode(assignedNode); 062 report.setPriority(priority); 063 report.setStartTime(startTime); 064 report.setFinishTime(finishTime); 065 report.setDiagnosticsInfo(diagnosticInfo); 066 report.setLogUrl(logUrl); 067 report.setContainerExitStatus(containerExitStatus); 068 report.setContainerState(containerState); 069 return report; 070 } 071 072 /** 073 * Get the <code>ContainerId</code> of the container. 074 * 075 * @return <code>ContainerId</code> of the container. 076 */ 077 @Public 078 @Unstable 079 public abstract ContainerId getContainerId(); 080 081 @Public 082 @Unstable 083 public abstract void setContainerId(ContainerId containerId); 084 085 /** 086 * Get the allocated <code>Resource</code> of the container. 087 * 088 * @return allocated <code>Resource</code> of the container. 089 */ 090 @Public 091 @Unstable 092 public abstract Resource getAllocatedResource(); 093 094 @Public 095 @Unstable 096 public abstract void setAllocatedResource(Resource resource); 097 098 /** 099 * Get the allocated <code>NodeId</code> where container is running. 100 * 101 * @return allocated <code>NodeId</code> where container is running. 102 */ 103 @Public 104 @Unstable 105 public abstract NodeId getAssignedNode(); 106 107 @Public 108 @Unstable 109 public abstract void setAssignedNode(NodeId nodeId); 110 111 /** 112 * Get the allocated <code>Priority</code> of the container. 113 * 114 * @return allocated <code>Priority</code> of the container. 115 */ 116 @Public 117 @Unstable 118 public abstract Priority getPriority(); 119 120 @Public 121 @Unstable 122 public abstract void setPriority(Priority priority); 123 124 /** 125 * Get the Start time of the container. 126 * 127 * @return Start time of the container 128 */ 129 @Public 130 @Unstable 131 public abstract long getStartTime(); 132 133 @Public 134 @Unstable 135 public abstract void setStartTime(long startTime); 136 137 /** 138 * Get the Finish time of the container. 139 * 140 * @return Finish time of the container 141 */ 142 @Public 143 @Unstable 144 public abstract long getFinishTime(); 145 146 @Public 147 @Unstable 148 public abstract void setFinishTime(long finishTime); 149 150 /** 151 * Get the DiagnosticsInfo of the container. 152 * 153 * @return DiagnosticsInfo of the container 154 */ 155 @Public 156 @Unstable 157 public abstract String getDiagnosticsInfo(); 158 159 @Public 160 @Unstable 161 public abstract void setDiagnosticsInfo(String diagnosticsInfo); 162 163 /** 164 * Get the LogURL of the container. 165 * 166 * @return LogURL of the container 167 */ 168 @Public 169 @Unstable 170 public abstract String getLogUrl(); 171 172 @Public 173 @Unstable 174 public abstract void setLogUrl(String logUrl); 175 176 /** 177 * Get the final <code>ContainerState</code> of the container. 178 * 179 * @return final <code>ContainerState</code> of the container. 180 */ 181 @Public 182 @Unstable 183 public abstract ContainerState getContainerState(); 184 185 @Public 186 @Unstable 187 public abstract void setContainerState(ContainerState containerState); 188 189 /** 190 * Get the final <code>exit status</code> of the container. 191 * 192 * @return final <code>exit status</code> of the container. 193 */ 194 @Public 195 @Unstable 196 public abstract int getContainerExitStatus(); 197 198 @Public 199 @Unstable 200 public abstract void setContainerExitStatus(int containerExitStatus); 201 202 }