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