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 oUrl, String diagnostics,
055          YarnApplicationAttemptState state, 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.setOriginalTrackingUrl(oUrl);
063        report.setDiagnostics(diagnostics);
064        report.setYarnApplicationAttemptState(state);
065        report.setAMContainerId(amContainerId);
066        return report;
067      }
068    
069      /**
070       * Get the <em>YarnApplicationAttemptState</em> of the application attempt.
071       * 
072       * @return <em>YarnApplicationAttemptState</em> of the application attempt
073       */
074      @Public
075      @Unstable
076      public abstract YarnApplicationAttemptState getYarnApplicationAttemptState();
077    
078      @Private
079      @Unstable
080      public abstract void setYarnApplicationAttemptState(
081          YarnApplicationAttemptState yarnApplicationAttemptState);
082    
083      /**
084       * Get the <em>RPC port</em> of this attempt <code>ApplicationMaster</code>.
085       * 
086       * @return <em>RPC port</em> of this attempt <code>ApplicationMaster</code>
087       */
088      @Public
089      @Unstable
090      public abstract int getRpcPort();
091    
092      @Private
093      @Unstable
094      public abstract void setRpcPort(int rpcPort);
095    
096      /**
097       * Get the <em>host</em> on which this attempt of
098       * <code>ApplicationMaster</code> is running.
099       * 
100       * @return <em>host</em> on which this attempt of
101       *         <code>ApplicationMaster</code> is running
102       */
103      @Public
104      @Unstable
105      public abstract String getHost();
106    
107      @Private
108      @Unstable
109      public abstract void setHost(String host);
110    
111      /**
112       * Get the <em>diagnositic information</em> of the application attempt in case
113       * of errors.
114       * 
115       * @return <em>diagnositic information</em> of the application attempt in case
116       *         of errors
117       */
118      @Public
119      @Unstable
120      public abstract String getDiagnostics();
121    
122      @Private
123      @Unstable
124      public abstract void setDiagnostics(String diagnostics);
125    
126      /**
127       * Get the <em>tracking url</em> for the application attempt.
128       * 
129       * @return <em>tracking url</em> for the application attempt
130       */
131      @Public
132      @Unstable
133      public abstract String getTrackingUrl();
134    
135      @Private
136      @Unstable
137      public abstract void setTrackingUrl(String url);
138    
139      /**
140       * Get the <em>original tracking url</em> for the application attempt.
141       * 
142       * @return <em>original tracking url</em> for the application attempt
143       */
144      @Public
145      @Unstable
146      public abstract String getOriginalTrackingUrl();
147    
148      @Private
149      @Unstable
150      public abstract void setOriginalTrackingUrl(String oUrl);
151    
152      /**
153       * Get the <code>ApplicationAttemptId</code> of this attempt of the
154       * application
155       * 
156       * @return <code>ApplicationAttemptId</code> of the attempt
157       */
158      @Public
159      @Unstable
160      public abstract ApplicationAttemptId getApplicationAttemptId();
161    
162      @Private
163      @Unstable
164      public abstract void setApplicationAttemptId(
165          ApplicationAttemptId applicationAttemptId);
166    
167      /**
168       * Get the <code>ContainerId</code> of AMContainer for this attempt
169       * 
170       * @return <code>ContainerId</code> of the attempt
171       */
172      @Public
173      @Unstable
174      public abstract ContainerId getAMContainerId();
175    
176      @Private
177      @Unstable
178      public abstract void setAMContainerId(ContainerId amContainerId);
179    }