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 * {@code ApplicationAttemptReport} is a report of an application attempt. 028 * <p> 029 * It includes details such as: 030 * <ul> 031 * <li>{@link ApplicationAttemptId} of the application.</li> 032 * <li>Host on which the <code>ApplicationMaster</code> of this attempt is 033 * running.</li> 034 * <li>RPC port of the <code>ApplicationMaster</code> of this attempt.</li> 035 * <li>Tracking URL.</li> 036 * <li>Diagnostic information in case of errors.</li> 037 * <li>{@link YarnApplicationAttemptState} of the application attempt.</li> 038 * <li>{@link ContainerId} of the master Container.</li> 039 * </ul> 040 */ 041@Public 042@Unstable 043public abstract class ApplicationAttemptReport { 044 045 @Private 046 @Unstable 047 public static ApplicationAttemptReport newInstance( 048 ApplicationAttemptId applicationAttemptId, String host, int rpcPort, 049 String url, String oUrl, String diagnostics, 050 YarnApplicationAttemptState state, ContainerId amContainerId, 051 long startTime, long finishTime) { 052 ApplicationAttemptReport report = 053 Records.newRecord(ApplicationAttemptReport.class); 054 report.setApplicationAttemptId(applicationAttemptId); 055 report.setHost(host); 056 report.setRpcPort(rpcPort); 057 report.setTrackingUrl(url); 058 report.setOriginalTrackingUrl(oUrl); 059 report.setDiagnostics(diagnostics); 060 report.setYarnApplicationAttemptState(state); 061 report.setAMContainerId(amContainerId); 062 report.setStartTime(startTime); 063 report.setFinishTime(finishTime); 064 return report; 065 } 066 067 public static ApplicationAttemptReport newInstance( 068 ApplicationAttemptId applicationAttemptId, String host, int rpcPort, 069 String url, String oUrl, String diagnostics, 070 YarnApplicationAttemptState state, ContainerId amContainerId) { 071 return newInstance(applicationAttemptId, host, rpcPort, url, oUrl, 072 diagnostics, state, amContainerId, 0L, 0L); 073 } 074 075 /** 076 * Get the <em>YarnApplicationAttemptState</em> of the application attempt. 077 * 078 * @return <em>YarnApplicationAttemptState</em> of the application attempt 079 */ 080 @Public 081 @Unstable 082 public abstract YarnApplicationAttemptState getYarnApplicationAttemptState(); 083 084 @Private 085 @Unstable 086 public abstract void setYarnApplicationAttemptState( 087 YarnApplicationAttemptState yarnApplicationAttemptState); 088 089 /** 090 * Get the <em>RPC port</em> of this attempt <code>ApplicationMaster</code>. 091 * 092 * @return <em>RPC port</em> of this attempt <code>ApplicationMaster</code> 093 */ 094 @Public 095 @Unstable 096 public abstract int getRpcPort(); 097 098 @Private 099 @Unstable 100 public abstract void setRpcPort(int rpcPort); 101 102 /** 103 * Get the <em>host</em> on which this attempt of 104 * <code>ApplicationMaster</code> is running. 105 * 106 * @return <em>host</em> on which this attempt of 107 * <code>ApplicationMaster</code> is running 108 */ 109 @Public 110 @Unstable 111 public abstract String getHost(); 112 113 @Private 114 @Unstable 115 public abstract void setHost(String host); 116 117 /** 118 * Get the <em>diagnositic information</em> of the application attempt in case 119 * of errors. 120 * 121 * @return <em>diagnositic information</em> of the application attempt in case 122 * of errors 123 */ 124 @Public 125 @Unstable 126 public abstract String getDiagnostics(); 127 128 @Private 129 @Unstable 130 public abstract void setDiagnostics(String diagnostics); 131 132 /** 133 * Get the <em>tracking url</em> for the application attempt. 134 * 135 * @return <em>tracking url</em> for the application attempt 136 */ 137 @Public 138 @Unstable 139 public abstract String getTrackingUrl(); 140 141 @Private 142 @Unstable 143 public abstract void setTrackingUrl(String url); 144 145 /** 146 * Get the <em>original tracking url</em> for the application attempt. 147 * 148 * @return <em>original tracking url</em> for the application attempt 149 */ 150 @Public 151 @Unstable 152 public abstract String getOriginalTrackingUrl(); 153 154 @Private 155 @Unstable 156 public abstract void setOriginalTrackingUrl(String oUrl); 157 158 /** 159 * Get the <code>ApplicationAttemptId</code> of this attempt of the 160 * application 161 * 162 * @return <code>ApplicationAttemptId</code> of the attempt 163 */ 164 @Public 165 @Unstable 166 public abstract ApplicationAttemptId getApplicationAttemptId(); 167 168 @Private 169 @Unstable 170 public abstract void setApplicationAttemptId( 171 ApplicationAttemptId applicationAttemptId); 172 173 /** 174 * Get the <code>ContainerId</code> of AMContainer for this attempt 175 * 176 * @return <code>ContainerId</code> of the attempt 177 */ 178 @Public 179 @Unstable 180 public abstract ContainerId getAMContainerId(); 181 182 @Private 183 @Unstable 184 public abstract void setAMContainerId(ContainerId amContainerId); 185 186 @Public 187 @Unstable 188 public abstract long getStartTime(); 189 190 @Private 191 @Unstable 192 public abstract void setStartTime(long startTime); 193 194 /** 195 * Get the <em>finish time</em> of the application. 196 * 197 * @return <em>finish time</em> of the application 198 */ 199 @Public 200 @Unstable 201 public abstract long getFinishTime(); 202 203 @Private 204 @Unstable 205 public abstract void setFinishTime(long finishTime); 206}