hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vino...@apache.org
Subject svn commit: r1177633 [2/3] - in /hadoop/common/trunk/hadoop-mapreduce-project: ./ hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/ hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/j...
Date Fri, 30 Sep 2011 12:46:34 GMT
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationReport.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationReport.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationReport.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationReport.java Fri Sep 30 12:46:32 2011
@@ -36,13 +36,13 @@ import org.apache.hadoop.yarn.api.Client
  *     <li>Host on which the <code>ApplicationMaster</code>is running.</li>
  *     <li>RPC port of the <code>ApplicationMaster</code>.</li>
  *     <li>Tracking URL.</li>
- *     <li>{@link ApplicationState} of the application.</li>
+ *     <li>{@link YarnApplicationState} of the application.</li>
  *     <li>Diagnostic information in case of errors.</li>
  *     <li>Start time of the application.</li>
  *     <li>Client token of the application (if security is enabled).</li>
  *   </ul>
  * </p>
- * 
+ *
  * @see ClientRMProtocol#getApplicationReport(org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest)
  */
 @Public
@@ -56,7 +56,7 @@ public interface ApplicationReport {
   @Public
   @Stable
   ApplicationId getApplicationId();
-  
+
   @Private
   @Unstable
   void setApplicationId(ApplicationId applicationId);
@@ -68,7 +68,7 @@ public interface ApplicationReport {
   @Public
   @Stable
   String getUser();
-  
+
   @Private
   @Unstable
   void setUser(String user);
@@ -80,7 +80,7 @@ public interface ApplicationReport {
   @Public
   @Stable
   String getQueue();
-  
+
   @Private
   @Unstable
   void setQueue(String queue);
@@ -92,21 +92,21 @@ public interface ApplicationReport {
   @Public
   @Stable
   String getName();
-  
+
   @Private
   @Unstable
   void setName(String name);
 
   /**
-   * Get the <em>host</em> on which the <code>ApplicationMaster</code> 
+   * Get the <em>host</em> on which the <code>ApplicationMaster</code>
    * is running.
-   * @return <em>host</em> on which the <code>ApplicationMaster</code> 
+   * @return <em>host</em> on which the <code>ApplicationMaster</code>
    *         is running
    */
   @Public
   @Stable
   String getHost();
-  
+
   @Private
   @Unstable
   void setHost(String host);
@@ -118,47 +118,47 @@ public interface ApplicationReport {
   @Public
   @Stable
   int getRpcPort();
-  
+
   @Private
   @Unstable
   void setRpcPort(int rpcPort);
 
   /**
-   * Get the <em>client token</em> for communicating with the 
+   * Get the <em>client token</em> for communicating with the
    * <code>ApplicationMaster</code>.
-   * @return <em>client token</em> for communicating with the 
+   * @return <em>client token</em> for communicating with the
    * <code>ApplicationMaster</code>
    */
   @Public
   @Stable
   String getClientToken();
-  
+
   @Private
   @Unstable
   void setClientToken(String clientToken);
 
   /**
-   * Get the <code>ApplicationState</code> of the application.
-   * @return <code>ApplicationState</code> of the application
+   * Get the <code>YarnApplicationState</code> of the application.
+   * @return <code>YarnApplicationState</code> of the application
    */
   @Public
   @Stable
-  ApplicationState getState();
-  
+  YarnApplicationState getYarnApplicationState();
+
   @Private
   @Unstable
-  void setState(ApplicationState state);
+  void setYarnApplicationState(YarnApplicationState state);
 
   /**
-   * Get  the <em>diagnositic information</em> of the application in case of 
+   * Get  the <em>diagnositic information</em> of the application in case of
    * errors.
-   * @return <em>diagnositic information</em> of the application in case 
+   * @return <em>diagnositic information</em> of the application in case
    *         of errors
    */
   @Public
   @Stable
   String getDiagnostics();
-  
+
   @Private
   @Unstable
   void setDiagnostics(String diagnostics);
@@ -170,11 +170,11 @@ public interface ApplicationReport {
   @Public
   @Stable
   String getTrackingUrl();
-  
+
   @Private
   @Unstable
   void setTrackingUrl(String url);
-  
+
   /**
    * Get the <em>start time</em> of the application.
    * @return <em>start time</em> of the application
@@ -182,7 +182,7 @@ public interface ApplicationReport {
   @Public
   @Stable
   long getStartTime();
-  
+
   @Private
   @Unstable
   void setStartTime(long startTime);
@@ -194,8 +194,21 @@ public interface ApplicationReport {
   @Public
   @Stable
   long getFinishTime();
-  
+
   @Private
   @Unstable
   void setFinishTime(long finishTime);
+
+
+  /**
+   * Get the <em>final finish status</em> of the application.
+   */
+  @Public
+  @Stable
+  FinalApplicationStatus getFinalApplicationStatus();
+
+  @Private
+  @Unstable
+  void setFinalApplicationStatus(FinalApplicationStatus finishState);
+
 }

Added: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/FinalApplicationStatus.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/FinalApplicationStatus.java?rev=1177633&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/FinalApplicationStatus.java (added)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/FinalApplicationStatus.java Fri Sep 30 12:46:32 2011
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.api.records;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+
+/**
+ * Enumeration of various final states of an <code>Application</code>.
+ */
+@Public
+@Stable
+public enum FinalApplicationStatus {
+
+  /** Undefined state when either the application has not yet finished */
+  UNDEFINED,
+
+  /** Application which finished successfully. */
+  SUCCEEDED,
+
+  /** Application which failed. */
+  FAILED,
+
+  /** Application which was terminated by a user or admin. */
+  KILLED
+}

Added: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnApplicationState.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnApplicationState.java?rev=1177633&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnApplicationState.java (added)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnApplicationState.java Fri Sep 30 12:46:32 2011
@@ -0,0 +1,47 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.hadoop.yarn.api.records;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+
+/**
+ * Ennumeration of various states of an <code>ApplicationMaster</code>.
+ */
+@Public
+@Stable
+public enum YarnApplicationState {
+  /** Application which was just created. */
+  NEW,
+
+  /** Application which has been submitted. */
+  SUBMITTED,
+
+  /** Application which is currently running. */
+  RUNNING,
+
+  /** Application which finished successfully. */
+  FINISHED,
+
+  /** Application which failed. */
+  FAILED,
+
+  /** Application which was terminated by a user or admin. */
+  KILLED
+}

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationMasterPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationMasterPBImpl.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationMasterPBImpl.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationMasterPBImpl.java Fri Sep 30 12:46:32 2011
@@ -19,31 +19,28 @@
 package org.apache.hadoop.yarn.api.records.impl.pb;
 
 
-import java.util.List;
-
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationMaster;
-import org.apache.hadoop.yarn.api.records.ApplicationState;
 import org.apache.hadoop.yarn.api.records.ApplicationStatus;
 import org.apache.hadoop.yarn.api.records.ProtoBase;
+import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationMasterProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationMasterProtoOrBuilder;
-import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationStateProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationStatusProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.YarnApplicationStateProto;
 import org.apache.hadoop.yarn.util.ProtoUtils;
 
 
-    
 public class ApplicationMasterPBImpl extends ProtoBase<ApplicationMasterProto> implements ApplicationMaster {
   ApplicationMasterProto proto = ApplicationMasterProto.getDefaultInstance();
   ApplicationMasterProto.Builder builder = null;
   boolean viaProto = false;
-  
+
   private ApplicationId applicationId = null;
   private ApplicationStatus applicationStatus = null;
-  
-  
+
+
   public ApplicationMasterPBImpl() {
     builder = ApplicationMasterProto.newBuilder();
   }
@@ -52,9 +49,9 @@ public class ApplicationMasterPBImpl ext
     this.proto = proto;
     viaProto = true;
   }
-  
+
   public ApplicationMasterProto getProto() {
-  
+
       mergeLocalToProto();
     proto = viaProto ? proto : builder.build();
     viaProto = true;
@@ -72,24 +69,24 @@ public class ApplicationMasterPBImpl ext
   }
 
   private void mergeLocalToProto() {
-    if (viaProto) 
+    if (viaProto)
       maybeInitBuilder();
     mergeLocalToBuilder();
     proto = builder.build();
-    
+
     viaProto = true;
   }
-  
+
   private void maybeInitBuilder() {
     if (viaProto || builder == null) {
       builder = ApplicationMasterProto.newBuilder(proto);
     }
     viaProto = false;
   }
-    
-  
+
+
   @Override
-  public ApplicationState getState() {
+  public YarnApplicationState getState() {
     ApplicationMasterProtoOrBuilder p = viaProto ? proto : builder;
     if (!p.hasState()) {
       return null;
@@ -98,7 +95,7 @@ public class ApplicationMasterPBImpl ext
   }
 
   @Override
-  public void setState(ApplicationState state) {
+  public void setState(YarnApplicationState state) {
     maybeInitBuilder();
     if (state == null) {
       builder.clearState();
@@ -124,7 +121,7 @@ public class ApplicationMasterPBImpl ext
     }
     builder.setHost((host));
   }
-  
+
   @Override
   public ApplicationId getApplicationId() {
     ApplicationMasterProtoOrBuilder p = viaProto ? proto : builder;
@@ -135,7 +132,7 @@ public class ApplicationMasterPBImpl ext
       return null;
     }
     applicationId = convertFromProtoFormat(p.getApplicationId());
-    
+
     return applicationId;
   }
 
@@ -145,7 +142,7 @@ public class ApplicationMasterPBImpl ext
     if (applicationId == null)
       builder.clearApplicationId();
     this.applicationId = applicationId;
-    
+
   }
   @Override
   public int getRpcPort() {
@@ -179,7 +176,7 @@ public class ApplicationMasterPBImpl ext
       return null;
     }
     this.applicationStatus = convertFromProtoFormat(p.getStatus());
-    
+
     return this.applicationStatus;
   }
 
@@ -189,7 +186,7 @@ public class ApplicationMasterPBImpl ext
     if (status == null)
       builder.clearStatus();
     this.applicationStatus = status;
-    
+
   }
   @Override
   public String getClientToken() {
@@ -209,7 +206,7 @@ public class ApplicationMasterPBImpl ext
     }
     builder.setClientToken((clientToken));
   }
-  
+
   @Override
   public int getAMFailCount() {
     ApplicationMasterProtoOrBuilder p = viaProto ? proto : builder;
@@ -250,11 +247,11 @@ public class ApplicationMasterPBImpl ext
     builder.setDiagnostics(diagnostics);
   }
 
-  private ApplicationStateProto convertToProtoFormat(ApplicationState e) {
+  private YarnApplicationStateProto convertToProtoFormat(YarnApplicationState e) {
     return ProtoUtils.convertToProtoFormat(e);
   }
 
-  private ApplicationState convertFromProtoFormat(ApplicationStateProto e) {
+  private YarnApplicationState convertFromProtoFormat(YarnApplicationStateProto e) {
     return ProtoUtils.convertFromProtoFormat(e);
   }
 
@@ -274,4 +271,4 @@ public class ApplicationMasterPBImpl ext
     return ((ApplicationStatusPBImpl)t).getProto();
   }
 
-}  
+}

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationReportPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationReportPBImpl.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationReportPBImpl.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationReportPBImpl.java Fri Sep 30 12:46:32 2011
@@ -18,17 +18,19 @@
 
 package org.apache.hadoop.yarn.api.records.impl.pb;
 
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.ApplicationState;
+import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.apache.hadoop.yarn.api.records.ProtoBase;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationReportProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationReportProtoOrBuilder;
-import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationStateProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.FinalApplicationStatusProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.YarnApplicationStateProto;
 import org.apache.hadoop.yarn.util.ProtoUtils;
 
-public class ApplicationReportPBImpl extends ProtoBase<ApplicationReportProto> 
+public class ApplicationReportPBImpl extends ProtoBase<ApplicationReportProto>
 implements ApplicationReport {
   ApplicationReportProto proto = ApplicationReportProto.getDefaultInstance();
   ApplicationReportProto.Builder builder = null;
@@ -39,7 +41,7 @@ implements ApplicationReport {
   public ApplicationReportPBImpl() {
     builder = ApplicationReportProto.newBuilder();
   }
-  
+
   public ApplicationReportPBImpl(ApplicationReportProto proto) {
     this.proto = proto;
     viaProto = true;
@@ -87,12 +89,12 @@ implements ApplicationReport {
   }
 
   @Override
-  public ApplicationState getState() {
+  public YarnApplicationState getYarnApplicationState() {
     ApplicationReportProtoOrBuilder p = viaProto ? proto : builder;
-    if (!p.hasState()) {
+    if (!p.hasYarnApplicationState()) {
       return null;
     }
-    return convertFromProtoFormat(p.getState());
+    return convertFromProtoFormat(p.getYarnApplicationState());
   }
 
   @Override
@@ -139,6 +141,27 @@ implements ApplicationReport {
   }
 
   @Override
+  public long getStartTime() {
+    ApplicationReportProtoOrBuilder p = viaProto ? proto : builder;
+    return p.getStartTime();
+  }
+
+  @Override
+  public long getFinishTime() {
+    ApplicationReportProtoOrBuilder p = viaProto ? proto : builder;
+    return p.getFinishTime();
+  }
+
+  @Override
+  public FinalApplicationStatus getFinalApplicationStatus() {
+    ApplicationReportProtoOrBuilder p = viaProto ? proto : builder;
+    if (!p.hasFinalApplicationStatus()) {
+      return null;
+    }	
+    return convertFromProtoFormat(p.getFinalApplicationStatus());
+  }
+
+  @Override
   public void setApplicationId(ApplicationId applicationId) {
     maybeInitBuilder();
     if (applicationId == null)
@@ -177,13 +200,13 @@ implements ApplicationReport {
   }
 
   @Override
-  public void setState(ApplicationState state) {
+  public void setYarnApplicationState(YarnApplicationState state) {
     maybeInitBuilder();
     if (state == null) {
-      builder.clearState();
+      builder.clearYarnApplicationState();
       return;
     }
-    builder.setState(convertToProtoFormat(state));
+    builder.setYarnApplicationState(convertToProtoFormat(state));
   }
 
   @Override
@@ -233,35 +256,33 @@ implements ApplicationReport {
   }
 
   @Override
-  public ApplicationReportProto getProto() {
-    mergeLocalToProto();
-    proto = viaProto ? proto : builder.build();
-    viaProto = true;
-    return proto;
-  }
-
-  @Override
-  public long getStartTime() {
-    ApplicationReportProtoOrBuilder p = viaProto ? proto : builder;
-    return p.getStartTime();
-  }
-
-  @Override
   public void setStartTime(long startTime) {
     maybeInitBuilder();
     builder.setStartTime(startTime);
   }
 
   @Override
-  public long getFinishTime() {
-    ApplicationReportProtoOrBuilder p = viaProto ? proto : builder;
-    return p.getFinishTime();
+  public void setFinishTime(long finishTime) {
+    maybeInitBuilder();
+    builder.setFinishTime(finishTime);
   }
 
   @Override
-  public void setFinishTime(long finishTime) {
+  public void setFinalApplicationStatus(FinalApplicationStatus finishState) {
     maybeInitBuilder();
-    builder.setFinishTime(finishTime);
+    if (finishState == null) {
+      builder.clearFinalApplicationStatus();
+      return;
+    }
+    builder.setFinalApplicationStatus(convertToProtoFormat(finishState));
+  }
+
+  @Override
+  public ApplicationReportProto getProto() {
+    mergeLocalToProto();
+    proto = viaProto ? proto : builder.build();
+    viaProto = true;
+    return proto;
   }
 
   private void mergeLocalToBuilder() {
@@ -291,16 +312,25 @@ implements ApplicationReport {
     return ((ApplicationIdPBImpl) t).getProto();
   }
 
-  private ApplicationState convertFromProtoFormat(ApplicationStateProto s) {
+  private ApplicationIdPBImpl convertFromProtoFormat(
+      ApplicationIdProto applicationId) {
+    return new ApplicationIdPBImpl(applicationId);
+  }
+
+  private YarnApplicationState convertFromProtoFormat(YarnApplicationStateProto s) {
     return ProtoUtils.convertFromProtoFormat(s);
   }
 
-  private ApplicationStateProto convertToProtoFormat(ApplicationState s) {
+  private YarnApplicationStateProto convertToProtoFormat(YarnApplicationState s) {
     return ProtoUtils.convertToProtoFormat(s);
   }
 
-  private ApplicationIdPBImpl convertFromProtoFormat(
-      ApplicationIdProto applicationId) {
-    return new ApplicationIdPBImpl(applicationId);
+  private FinalApplicationStatus convertFromProtoFormat(FinalApplicationStatusProto s) {
+    return ProtoUtils.convertFromProtoFormat(s);
   }
+
+  private FinalApplicationStatusProto convertToProtoFormat(FinalApplicationStatus s) {
+    return ProtoUtils.convertToProtoFormat(s);
+  }
+
 }

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/ProtoUtils.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/ProtoUtils.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/ProtoUtils.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/ProtoUtils.java Fri Sep 30 12:46:32 2011
@@ -20,24 +20,26 @@ package org.apache.hadoop.yarn.util;
 
 import java.nio.ByteBuffer;
 
-import org.apache.hadoop.yarn.api.records.ApplicationState;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.api.records.ContainerState;
 import org.apache.hadoop.yarn.api.records.LocalResourceType;
 import org.apache.hadoop.yarn.api.records.LocalResourceVisibility;
 import org.apache.hadoop.yarn.api.records.QueueACL;
 import org.apache.hadoop.yarn.api.records.QueueState;
-import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationStateProto;
+import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStateProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.FinalApplicationStatusProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.LocalResourceTypeProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.LocalResourceVisibilityProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.QueueACLProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.QueueStateProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.YarnApplicationStateProto;
 
 import com.google.protobuf.ByteString;
 
 public class ProtoUtils {
-  
-  
+
+
   /*
    * ContainerState
    */
@@ -48,18 +50,29 @@ public class ProtoUtils {
   public static ContainerState convertFromProtoFormat(ContainerStateProto e) {
     return ContainerState.valueOf(e.name().replace(CONTAINER_STATE_PREFIX, ""));
   }
-  
+
 
   /*
-   * ApplicationState
+   * YarnApplicationState
    */
-  public static ApplicationStateProto convertToProtoFormat(ApplicationState e) {
-    return ApplicationStateProto.valueOf(e.name());
+  public static YarnApplicationStateProto convertToProtoFormat(YarnApplicationState e) {
+    return YarnApplicationStateProto.valueOf(e.name());
   }
-  public static ApplicationState convertFromProtoFormat(ApplicationStateProto e) {
-    return ApplicationState.valueOf(e.name());
+  public static YarnApplicationState convertFromProtoFormat(YarnApplicationStateProto e) {
+    return YarnApplicationState.valueOf(e.name());
   }
-  
+
+  /*
+   * FinalApplicationStatus
+   */
+  private static String FINAL_APPLICATION_STATUS_PREFIX = "APP_";
+  public static FinalApplicationStatusProto convertToProtoFormat(FinalApplicationStatus e) {
+    return FinalApplicationStatusProto.valueOf(FINAL_APPLICATION_STATUS_PREFIX + e.name());
+  }
+  public static FinalApplicationStatus convertFromProtoFormat(FinalApplicationStatusProto e) {
+    return FinalApplicationStatus.valueOf(e.name().replace(FINAL_APPLICATION_STATUS_PREFIX, ""));
+  }
+
   /*
    * LocalResourceType
    */
@@ -69,7 +82,7 @@ public class ProtoUtils {
   public static LocalResourceType convertFromProtoFormat(LocalResourceTypeProto e) {
     return LocalResourceType.valueOf(e.name());
   }
-  
+
   /*
    * LocalResourceVisibility
    */
@@ -79,7 +92,7 @@ public class ProtoUtils {
   public static LocalResourceVisibility convertFromProtoFormat(LocalResourceVisibilityProto e) {
     return LocalResourceVisibility.valueOf(e.name());
   }
-  
+
   /*
    * ByteBuffer
    */
@@ -98,7 +111,7 @@ public class ProtoUtils {
     byteBuffer.position(oldPos);
     return bs;
   }
-  
+
   /*
    * QueueState
    */
@@ -109,7 +122,7 @@ public class ProtoUtils {
   public static QueueState convertFromProtoFormat(QueueStateProto e) {
     return QueueState.valueOf(e.name().replace(QUEUE_STATE_PREFIX, ""));
   }
-  
+
   /*
    * QueueACL
    */

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto Fri Sep 30 12:46:32 2011
@@ -76,14 +76,20 @@ message ContainerProto {
   optional ContainerStatusProto container_status = 8;
 }
 
-enum ApplicationStateProto {
+enum YarnApplicationStateProto {
   NEW = 1;
   SUBMITTED = 2;
   RUNNING = 3;
-  RESTARTING = 4;
-  SUCCEEDED = 5;
-  FAILED = 6;
-  KILLED = 7; 
+  FINISHED = 4;
+  FAILED = 5;
+  KILLED = 6;
+}
+
+enum FinalApplicationStatusProto {
+  APP_UNDEFINED = 0;
+  APP_SUCCEEDED = 1;
+  APP_FAILED = 2;
+  APP_KILLED = 3;
 }
 
 message ApplicationStatusProto {
@@ -98,7 +104,7 @@ message ApplicationMasterProto {
   optional int32 rpc_port = 3;
   optional string trackingUrl = 4;
   optional ApplicationStatusProto status = 5;
-  optional ApplicationStateProto state = 6;
+  optional YarnApplicationStateProto state = 6;
   optional string client_token = 7;
   optional int32 containerCount = 8;
   optional int32 amFailCount = 9;
@@ -107,7 +113,7 @@ message ApplicationMasterProto {
 
 message URLProto {
   optional string scheme = 1;
-  optional string host = 2; 
+  optional string host = 2;
   optional int32 port = 3;
   optional string file = 4;
 }
@@ -140,12 +146,13 @@ message ApplicationReportProto {
   optional int32 rpc_port = 6;
   optional string client_token = 7;
   optional ApplicationStatusProto status = 8;
-  optional ApplicationStateProto state = 9;
+  optional YarnApplicationStateProto yarn_application_state = 9;
   optional ContainerProto masterContainer = 10;
   optional string trackingUrl = 11;
   optional string diagnostics = 12 [default = "N/A"];
   optional int64 startTime = 13;
   optional int64 finishTime = 14;
+  optional FinalApplicationStatusProto final_application_status = 15;
 }
 
 message NodeIdProto {
@@ -195,7 +202,7 @@ message AMResponseProto {
 message ApplicationSubmissionContextProto {
   optional ApplicationIdProto application_id = 1;
   optional string application_name = 2 [default = "N/A"];
-  optional string user = 3; 
+  optional string user = 3;
   optional string queue = 4 [default = "default"];
   optional PriorityProto priority = 5;
   optional ContainerLaunchContextProto am_container_spec = 6;

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto Fri Sep 30 12:46:32 2011
@@ -42,7 +42,7 @@ message FinishApplicationMasterRequestPr
   optional ApplicationAttemptIdProto application_attempt_id = 1;
   optional string diagnostics = 2;
   optional string tracking_url = 3;
-  optional string final_state = 4;
+  optional FinalApplicationStatusProto final_application_status = 4;
 }
 
 message FinishApplicationMasterResponseProto {
@@ -115,7 +115,7 @@ message GetClusterNodesRequestProto {
 }
 
 message GetClusterNodesResponseProto {
-  repeated NodeReportProto nodeReports = 1; 
+  repeated NodeReportProto nodeReports = 1;
 }
 
 message GetQueueInfoRequestProto {
@@ -133,7 +133,7 @@ message GetQueueUserAclsInfoRequestProto
 }
 
 message GetQueueUserAclsInfoResponseProto {
-  repeated QueueUserACLInfoProto queueUserAcls = 1; 
+  repeated QueueUserACLInfoProto queueUserAcls = 1;
 }
 
 //////////////////////////////////////////////////////

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BuilderUtils.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BuilderUtils.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BuilderUtils.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BuilderUtils.java Fri Sep 30 12:46:32 2011
@@ -24,9 +24,10 @@ import java.util.List;
 
 import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.ApplicationState;
+import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.ContainerState;
@@ -69,12 +70,12 @@ public class BuilderUtils {
     }
   }
 
-  public static class ResourceRequestComparator 
+  public static class ResourceRequestComparator
   implements java.util.Comparator<org.apache.hadoop.yarn.api.records.ResourceRequest> {
     @Override
     public int compare(org.apache.hadoop.yarn.api.records.ResourceRequest r1,
         org.apache.hadoop.yarn.api.records.ResourceRequest r2) {
-      
+
       // Compare priority, host and capability
       int ret = r1.getPriority().compareTo(r2.getPriority());
       if (ret == 0) {
@@ -198,12 +199,12 @@ public class BuilderUtils {
       String nodeHttpAddress, Resource resource, Priority priority) {
     ContainerId containerID =
         newContainerId(recordFactory, appAttemptId, containerId);
-    return newContainer(containerID, nodeId, nodeHttpAddress, 
+    return newContainer(containerID, nodeId, nodeHttpAddress,
         resource, priority);
   }
 
   public static Container newContainer(ContainerId containerId,
-      NodeId nodeId, String nodeHttpAddress, 
+      NodeId nodeId, String nodeHttpAddress,
       Resource resource, Priority priority) {
     Container container = recordFactory.newRecordInstance(Container.class);
     container.setId(containerId);
@@ -242,8 +243,9 @@ public class BuilderUtils {
 
   public static ApplicationReport newApplicationReport(
       ApplicationId applicationId, String user, String queue, String name,
-      String host, int rpcPort, String clientToken, ApplicationState state,
-      String diagnostics, String url, long startTime, long finishTime) {
+      String host, int rpcPort, String clientToken, YarnApplicationState state,
+      String diagnostics, String url, long startTime, long finishTime,
+      FinalApplicationStatus finalStatus) {
     ApplicationReport report = recordFactory
         .newRecordInstance(ApplicationReport.class);
     report.setApplicationId(applicationId);
@@ -253,20 +255,21 @@ public class BuilderUtils {
     report.setHost(host);
     report.setRpcPort(rpcPort);
     report.setClientToken(clientToken);
-    report.setState(state);
+    report.setYarnApplicationState(state);
     report.setDiagnostics(diagnostics);
     report.setTrackingUrl(url);
     report.setStartTime(startTime);
     report.setFinishTime(finishTime);
+    report.setFinalApplicationStatus(finalStatus);
     return report;
   }
-  
+
   public static Resource newResource(int memory) {
     Resource resource = recordFactory.newRecordInstance(Resource.class);
     resource.setMemory(memory);
     return resource;
   }
-  
+
   public static URL newURL(String scheme, String host, int port, String file) {
     URL url = recordFactory.newRecordInstance(URL.class);
     url.setScheme(scheme);

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ConverterUtils.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ConverterUtils.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ConverterUtils.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ConverterUtils.java Fri Sep 30 12:46:32 2011
@@ -33,7 +33,9 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.api.records.URL;
+import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.apache.hadoop.yarn.factories.RecordFactory;
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
 
@@ -181,4 +183,5 @@ public class ConverterUtils {
           + applicationAttmeptIdStr, n);
     }
   }
+  
 }

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/MockApps.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/MockApps.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/MockApps.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/MockApps.java Fri Sep 30 12:46:32 2011
@@ -24,7 +24,8 @@ import java.util.List;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.ApplicationState;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
+import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.apache.hadoop.yarn.util.Records;
 
 import com.google.common.collect.Iterators;
@@ -39,8 +40,8 @@ public class MockApps {
       "I18nApp<☯>");
   static final Iterator<String> USERS = Iterators.cycle("dorothy", "tinman",
       "scarecrow", "glinda", "nikko", "toto", "winkie", "zeke", "gulch");
-  static final Iterator<ApplicationState> STATES = Iterators.cycle(
-      ApplicationState.values());
+  static final Iterator<YarnApplicationState> STATES = Iterators.cycle(
+      YarnApplicationState.values());
   static final Iterator<String> QUEUES = Iterators.cycle("a.a1", "a.a2",
       "b.b1", "b.b2", "b.b3", "c.c1.c11", "c.c1.c12", "c.c1.c13",
       "c.c2", "c.c3", "c.c4");
@@ -74,46 +75,47 @@ public class MockApps {
 
   public static ApplicationReport newApp(int i) {
     final ApplicationId id = newAppID(i);
-    final ApplicationState state = newAppState();
+    final YarnApplicationState state = newAppState();
     final String user = newUserName();
     final String name = newAppName();
     final String queue = newQueue();
+    final FinalApplicationStatus finishState = FinalApplicationStatus.UNDEFINED;
     return new ApplicationReport() {
       @Override public ApplicationId getApplicationId() { return id; }
       @Override public String getUser() { return user; }
       @Override public String getName() { return name; }
-      @Override public ApplicationState getState() { return state; }
+      @Override public YarnApplicationState getYarnApplicationState() { return state; }
       @Override public String getQueue() { return queue; }
       @Override public String getTrackingUrl() { return ""; }
-      @Override
+      @Override public FinalApplicationStatus getFinalApplicationStatus() { return finishState; }
       public void setApplicationId(ApplicationId applicationId) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
       public void setTrackingUrl(String url) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
       public void setName(String name) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
       public void setQueue(String queue) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
-      public void setState(ApplicationState state) {
+      public void setYarnApplicationState(YarnApplicationState state) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
       public void setUser(String user) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
       public String getDiagnostics() {
@@ -123,7 +125,7 @@ public class MockApps {
       @Override
       public void setDiagnostics(String diagnostics) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
       public String getHost() {
@@ -133,7 +135,7 @@ public class MockApps {
       @Override
       public void setHost(String host) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
       public int getRpcPort() {
@@ -143,7 +145,7 @@ public class MockApps {
       @Override
       public void setRpcPort(int rpcPort) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
       public String getClientToken() {
@@ -153,9 +155,8 @@ public class MockApps {
       @Override
       public void setClientToken(String clientToken) {
         // TODO Auto-generated method stub
-        
+
       }
-      
       @Override
       public long getStartTime() {
         // TODO Auto-generated method stub
@@ -175,7 +176,11 @@ public class MockApps {
       @Override
       public void setFinishTime(long finishTime) {
         // TODO Auto-generated method stub
-        
+
+      }
+      @Override
+      public void setFinalApplicationStatus(FinalApplicationStatus finishState) {
+		// TODO Auto-generated method stub
       }
     };
   }
@@ -194,9 +199,10 @@ public class MockApps {
     return id;
   }
 
-  public static ApplicationState newAppState() {
+  public static YarnApplicationState newAppState() {
     synchronized(STATES) {
       return STATES.next();
     }
   }
+
 }

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ApplicationMasterService.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ApplicationMasterService.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ApplicationMasterService.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ApplicationMasterService.java Fri Sep 30 12:46:32 2011
@@ -75,7 +75,7 @@ public class ApplicationMasterService ex
       new ConcurrentHashMap<ApplicationAttemptId, AMResponse>();
   private final AMResponse reboot = recordFactory.newRecordInstance(AMResponse.class);
   private final RMContext rmContext;
-  
+
   public ApplicationMasterService(RMContext rmContext,
       ApplicationTokenSecretManager appTokenManager, YarnScheduler scheduler) {
     super(ApplicationMasterService.class.getName());
@@ -105,12 +105,12 @@ public class ApplicationMasterService ex
     this.server =
       rpc.getServer(AMRMProtocol.class, this, masterServiceAddress,
           serverConf, this.appTokenManager,
-          serverConf.getInt(YarnConfiguration.RM_SCHEDULER_CLIENT_THREAD_COUNT, 
+          serverConf.getInt(YarnConfiguration.RM_SCHEDULER_CLIENT_THREAD_COUNT,
               YarnConfiguration.DEFAULT_RM_SCHEDULER_CLIENT_THREAD_COUNT));
     this.server.start();
     super.start();
   }
-  
+
   @Override
   public RegisterApplicationMasterResponse registerApplicationMaster(
       RegisterApplicationMasterRequest request) throws YarnRemoteException {
@@ -123,7 +123,7 @@ public class ApplicationMasterService ex
       String message = "Application doesn't exist in cache "
           + applicationAttemptId;
       LOG.error(message);
-      RMAuditLogger.logFailure(this.rmContext.getRMApps().get(appID).getUser(), 
+      RMAuditLogger.logFailure(this.rmContext.getRMApps().get(appID).getUser(),
           AuditConstants.REGISTER_AM, message, "ApplicationMasterService",
           "Error in registering application master", appID,
           applicationAttemptId);
@@ -141,7 +141,7 @@ public class ApplicationMasterService ex
               .getHost(), request.getRpcPort(), request.getTrackingUrl()));
 
       RMAuditLogger.logSuccess(this.rmContext.getRMApps().get(appID).getUser(),
-          AuditConstants.REGISTER_AM, "ApplicationMasterService", appID, 
+          AuditConstants.REGISTER_AM, "ApplicationMasterService", appID,
           applicationAttemptId);
 
       // Pick up min/max resource from scheduler...
@@ -176,7 +176,7 @@ public class ApplicationMasterService ex
 
       rmContext.getDispatcher().getEventHandler().handle(
           new RMAppAttemptUnregistrationEvent(applicationAttemptId, request
-              .getTrackingUrl(), request.getFinalState(), request
+              .getTrackingUrl(), request.getFinalApplicationStatus(), request
               .getDiagnostics()));
 
       FinishApplicationMasterResponse response = recordFactory
@@ -225,7 +225,7 @@ public class ApplicationMasterService ex
       List<ContainerId> release = request.getReleaseList();
 
       // Send new requests to appAttempt.
-      Allocation allocation = 
+      Allocation allocation =
           this.rScheduler.allocate(appAttemptId, ask, release);
 
       RMApp app = this.rmContext.getRMApps().get(appAttemptId.getApplicationId());

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMApp.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMApp.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMApp.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMApp.java Fri Sep 30 12:46:32 2011
@@ -20,6 +20,7 @@ package org.apache.hadoop.yarn.server.re
 
 import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterRequest;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationReport;
 import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
@@ -28,8 +29,8 @@ import org.apache.hadoop.yarn.server.res
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
 
 /**
- * The read interface to an Application in the ResourceManager. Take a 
- * look at {@link RMAppImpl} for its implementation. This interface 
+ * The read interface to an Application in the ResourceManager. Take a
+ * look at {@link RMAppImpl} for its implementation. This interface
  * exposes methods to access various updates in application status/report.
  */
 public interface RMApp extends EventHandler<RMAppEvent> {
@@ -68,7 +69,7 @@ public interface RMApp extends EventHand
   RMAppAttempt getRMAppAttempt(ApplicationAttemptId appAttemptId);
 
   /**
-   * Each Application is submitted to a queue decided by {@link 
+   * Each Application is submitted to a queue decided by {@link
    * ApplicationSubmissionContext#setQueue(String)}.
    * This method returns the queue to which an application was submitted.
    * @return the queue to which the application was submitted to.
@@ -76,7 +77,7 @@ public interface RMApp extends EventHand
   String getQueue();
 
   /**
-   * The name of the application as set in {@link 
+   * The name of the application as set in {@link
    * ApplicationSubmissionContext#setApplicationName(String)}.
    * @return the name of the application.
    */
@@ -85,7 +86,7 @@ public interface RMApp extends EventHand
   /**
    * {@link RMApp} can have multiple application attempts {@link RMAppAttempt}.
    * This method returns the current {@link RMAppAttempt}.
-   * @return the current {@link RMAppAttempt} 
+   * @return the current {@link RMAppAttempt}
    */
   RMAppAttempt getCurrentAppAttempt();
 
@@ -96,7 +97,7 @@ public interface RMApp extends EventHand
   ApplicationReport createAndGetApplicationReport();
 
   /**
-   * Application level metadata is stored in {@link ApplicationStore} whicn 
+   * Application level metadata is stored in {@link ApplicationStore} whicn
    * can persist the information.
    * @return the {@link ApplicationStore}  for this {@link RMApp}.
    */
@@ -125,12 +126,12 @@ public interface RMApp extends EventHand
    * @return the diagnostics information for the application master.
    */
   StringBuilder getDiagnostics();
-  
+
   /**
-   * The final state of the AM when unregistering as in 
-   * {@link FinishApplicationMasterRequest#setFinalState(String)}.
-   * @return the final state of the AM as set in 
-   * {@link FinishApplicationMasterRequest#setFinalState(String)}.
+   * The final finish state of the AM when unregistering as in
+   * {@link FinishApplicationMasterRequest#setFinishApplicationStatus(FinalApplicationStatus)}.
+   * @return the final finish state of the AM as set in
+   * {@link FinishApplicationMasterRequest#setFinishApplicationStatus(FinalApplicationStatus)}.
    */
-  String getAMFinalState();
+  FinalApplicationStatus getFinalApplicationStatus();
 }

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java Fri Sep 30 12:46:32 2011
@@ -32,9 +32,10 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.yarn.YarnException;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.ApplicationState;
+import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
 import org.apache.hadoop.yarn.api.records.NodeId;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
@@ -94,7 +95,7 @@ public class RMAppImpl implements RMApp 
   private static final StateMachineFactory<RMAppImpl,
                                            RMAppState,
                                            RMAppEventType,
-                                           RMAppEvent> stateMachineFactory 
+                                           RMAppEvent> stateMachineFactory
                                = new StateMachineFactory<RMAppImpl,
                                            RMAppState,
                                            RMAppEventType,
@@ -160,7 +161,7 @@ public class RMAppImpl implements RMApp 
   public RMAppImpl(ApplicationId applicationId, RMContext rmContext,
       Configuration config, String name, String user, String queue,
       ApplicationSubmissionContext submissionContext, String clientTokenStr,
-      ApplicationStore appStore, 
+      ApplicationStore appStore,
       YarnScheduler scheduler, ApplicationMasterService masterService) {
 
     this.applicationId = applicationId;
@@ -194,18 +195,23 @@ public class RMAppImpl implements RMApp 
   }
 
   @Override
-  public String getAMFinalState() {
+  public FinalApplicationStatus getFinalApplicationStatus() {
     this.readLock.lock();
     try {
-      if (currentAttempt != null) {
-        return currentAttempt.getAMFinalState();
+      // finish state is obtained based on the state machine's current state 
+      // as a fall-back in case the application has not been unregistered 
+      // ( or if the app never unregistered itself )
+      // when the report is requested
+      if (currentAttempt != null 
+          && currentAttempt.getFinalApplicationStatus() != null) {
+        return currentAttempt.getFinalApplicationStatus();   
       }
-      return "UNKNOWN";
+      return createFinalApplicationStatus(this.stateMachine.getCurrentState());
     } finally {
       this.readLock.unlock();
     }
   }
-  
+
   @Override
   public RMAppState getState() {
     this.readLock.lock();
@@ -273,25 +279,43 @@ public class RMAppImpl implements RMApp 
     return this.appStore;
   }
 
-  private ApplicationState createApplicationState(RMAppState rmAppState) {
+  private YarnApplicationState createApplicationState(RMAppState rmAppState) {
     switch(rmAppState) {
     case NEW:
-      return ApplicationState.NEW;
+      return YarnApplicationState.NEW;
     case SUBMITTED:
     case ACCEPTED:
-      return ApplicationState.SUBMITTED;
+      return YarnApplicationState.SUBMITTED;
     case RUNNING:
-      return ApplicationState.RUNNING;
+      return YarnApplicationState.RUNNING;
     case FINISHED:
-      return ApplicationState.SUCCEEDED;
+      return YarnApplicationState.FINISHED;
     case KILLED:
-      return ApplicationState.KILLED;
+      return YarnApplicationState.KILLED;
+    case FAILED:
+      return YarnApplicationState.FAILED;
+    }
+    throw new YarnException("Unknown state passed!");
+  }
+
+  private FinalApplicationStatus createFinalApplicationStatus(RMAppState state) {
+    switch(state) {
+    case NEW:
+    case SUBMITTED:
+    case ACCEPTED:
+    case RUNNING:
+      return FinalApplicationStatus.UNDEFINED;    
+    // finished without a proper final state is the same as failed  
+    case FINISHED:
     case FAILED:
-      return ApplicationState.FAILED;
+      return FinalApplicationStatus.FAILED;
+    case KILLED:
+      return FinalApplicationStatus.KILLED;
     }
     throw new YarnException("Unknown state passed!");
   }
 
+  
   @Override
   public ApplicationReport createAndGetApplicationReport() {
     this.readLock.lock();
@@ -301,6 +325,7 @@ public class RMAppImpl implements RMApp 
       String trackingUrl = "N/A";
       String host = "N/A";
       int rpcPort = -1;
+      FinalApplicationStatus finishState = getFinalApplicationStatus();
       if (this.currentAttempt != null) {
         trackingUrl = this.currentAttempt.getTrackingUrl();
         clientToken = this.currentAttempt.getClientToken();
@@ -310,8 +335,8 @@ public class RMAppImpl implements RMApp 
       return BuilderUtils.newApplicationReport(this.applicationId, this.user,
           this.queue, this.name, host, rpcPort, clientToken,
           createApplicationState(this.stateMachine.getCurrentState()),
-          this.diagnostics.toString(), trackingUrl, 
-          this.startTime, this.finishTime);
+          this.diagnostics.toString(), trackingUrl,
+          this.startTime, this.finishTime, finishState);
     } finally {
       this.readLock.unlock();
     }
@@ -432,7 +457,7 @@ public class RMAppImpl implements RMApp 
     @SuppressWarnings("unchecked")
     @Override
     public void transition(RMAppImpl app, RMAppEvent event) {
-      app.handler.handle(new RMAppAttemptEvent(app.currentAttempt.getAppAttemptId(), 
+      app.handler.handle(new RMAppAttemptEvent(app.currentAttempt.getAppAttemptId(),
           RMAppAttemptEventType.KILL));
       super.transition(app, event);
     }
@@ -465,7 +490,7 @@ public class RMAppImpl implements RMApp 
       }
       app.finishTime = System.currentTimeMillis();
       app.handler.handle(
-          new RMAppManagerEvent(app.applicationId, 
+          new RMAppManagerEvent(app.applicationId,
           RMAppManagerEventType.APP_COMPLETED));
     };
   }
@@ -481,7 +506,7 @@ public class RMAppImpl implements RMApp 
 
     @Override
     public RMAppState transition(RMAppImpl app, RMAppEvent event) {
-      
+
       RMAppFailedAttemptEvent failedEvent = ((RMAppFailedAttemptEvent)event);
       if (app.attempts.size() == app.maxRetries) {
         String msg = "Application " + app.getApplicationId()
@@ -495,7 +520,7 @@ public class RMAppImpl implements RMApp 
         return RMAppState.FAILED;
       }
 
-      app.createNewAttempt();     
+      app.createNewAttempt();
       return initialState;
     }
 

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttempt.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttempt.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttempt.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttempt.java Fri Sep 30 12:46:32 2011
@@ -22,6 +22,7 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.ContainerStatus;
@@ -32,8 +33,8 @@ import org.apache.hadoop.yarn.server.res
 
 /**
  * Interface to an Application Attempt in the Resource Manager.
- * A {@link RMApp} can have multiple app attempts based on 
- * {@link YarnConfiguration#RM_AM_MAX_RETRIES}. For specific 
+ * A {@link RMApp} can have multiple app attempts based on
+ * {@link YarnConfiguration#RM_AM_MAX_RETRIES}. For specific
  * implementation take a look at {@link RMAppAttemptImpl}.
  */
 public interface RMAppAttempt extends EventHandler<RMAppAttemptEvent> {
@@ -49,7 +50,7 @@ public interface RMAppAttempt extends Ev
    * @return the state {@link RMAppAttemptState} of this {@link RMAppAttempt}
    */
   RMAppAttemptState getAppAttemptState();
-  
+
   /**
    * The host on which the {@link RMAppAttempt} is running/ran on.
    * @return the host on which the {@link RMAppAttempt} ran/is running on.
@@ -88,11 +89,12 @@ public interface RMAppAttempt extends Ev
   float getProgress();
 
   /**
-   * The final state set by the AM.
-   * @return the final state that is set by the AM when unregistering itself.
+   * The final status set by the AM.
+   * @return the final status that is set by the AM when unregistering itself. Can return a null 
+   * if the AM has not unregistered itself. 
    */
-  String getAMFinalState();
-  
+  FinalApplicationStatus getFinalApplicationStatus();
+
   /**
    * Nodes on which the containers for this {@link RMAppAttempt} ran.
    * @return the set of nodes that ran any containers from this {@link RMAppAttempt}
@@ -100,16 +102,16 @@ public interface RMAppAttempt extends Ev
   Set<NodeId> getRanNodes();
 
   /**
-   * Return a list of the last set of finished containers, resetting the 
+   * Return a list of the last set of finished containers, resetting the
    * finished containers to empty.
    * @return the list of just finished containers, re setting the finished containers.
    */
   List<ContainerStatus> pullJustFinishedContainers();
 
   /**
-   * Return the list of last set of finished containers. This does not reset the 
+   * Return the list of last set of finished containers. This does not reset the
    * finished containers.
-   * @return the list of just finished contianers, this does not reset the 
+   * @return the list of just finished contianers, this does not reset the
    * finished containers.
    */
   List<ContainerStatus> getJustFinishedContainers();

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java Fri Sep 30 12:46:32 2011
@@ -31,6 +31,7 @@ import java.util.concurrent.locks.Reentr
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
 import org.apache.hadoop.yarn.api.records.Container;
@@ -99,9 +100,9 @@ public class RMAppAttemptImpl implements
   private final ApplicationSubmissionContext submissionContext;
 
   //nodes on while this attempt's containers ran
-  private final Set<NodeId> ranNodes = 
+  private final Set<NodeId> ranNodes =
     new HashSet<NodeId>();
-  private final List<ContainerStatus> justFinishedContainers = 
+  private final List<ContainerStatus> justFinishedContainers =
     new ArrayList<ContainerStatus>();
   private Container masterContainer;
 
@@ -109,7 +110,9 @@ public class RMAppAttemptImpl implements
   private String host = "N/A";
   private int rpcPort;
   private String trackingUrl = "N/A";
-  private String finalState = "N/A";
+  // Set to null initially. Will eventually get set 
+  // if an RMAppAttemptUnregistrationEvent occurs
+  private FinalApplicationStatus finalStatus = null;
   private final StringBuilder diagnostics = new StringBuilder();
 
   private static final StateMachineFactory<RMAppAttemptImpl,
@@ -150,7 +153,7 @@ public class RMAppAttemptImpl implements
       .addTransition(RMAppAttemptState.ALLOCATED,
           RMAppAttemptState.ALLOCATED,
           RMAppAttemptEventType.CONTAINER_ACQUIRED,
-          new ContainerAcquiredTransition())       
+          new ContainerAcquiredTransition())
       .addTransition(RMAppAttemptState.ALLOCATED, RMAppAttemptState.LAUNCHED,
           RMAppAttemptEventType.LAUNCHED, new AMLaunchedTransition())
       .addTransition(RMAppAttemptState.ALLOCATED, RMAppAttemptState.FAILED,
@@ -266,12 +269,12 @@ public class RMAppAttemptImpl implements
   public ApplicationSubmissionContext getSubmissionContext() {
     return this.submissionContext;
   }
-  
+
   @Override
-  public String getAMFinalState() {
+  public FinalApplicationStatus getFinalApplicationStatus() {
     this.readLock.lock();
     try {
-      return this.finalState;
+      return this.finalStatus;
     } finally {
       this.readLock.unlock();
     }
@@ -430,9 +433,9 @@ public class RMAppAttemptImpl implements
 
     @Override
     public void transition(RMAppAttemptImpl appAttempt,
-        RMAppAttemptEvent event) {      
+        RMAppAttemptEvent event) {
     }
-    
+
   }
 
   private static final class AttemptStartedTransition extends BaseTransition {
@@ -459,23 +462,23 @@ public class RMAppAttemptImpl implements
         RMAppAttemptEvent event) {
 
       RMAppAttemptRejectedEvent rejectedEvent = (RMAppAttemptRejectedEvent) event;
-      
+
       // Save the diagnostic message
       String message = rejectedEvent.getMessage();
       appAttempt.setDiagnostics(message);
-      
+
       // Send the rejection event to app
       appAttempt.eventHandler.handle(
           new RMAppRejectedEvent(
-              rejectedEvent.getApplicationAttemptId().getApplicationId(), 
+              rejectedEvent.getApplicationAttemptId().getApplicationId(),
               message)
           );
     }
   }
 
-  private static final List<ContainerId> EMPTY_CONTAINER_RELEASE_LIST = 
+  private static final List<ContainerId> EMPTY_CONTAINER_RELEASE_LIST =
       new ArrayList<ContainerId>();
-  private static final List<ResourceRequest> EMPTY_CONTAINER_REQUEST_LIST = 
+  private static final List<ResourceRequest> EMPTY_CONTAINER_REQUEST_LIST =
     new ArrayList<ResourceRequest>();
 
   private static final class ScheduleTransition extends BaseTransition {
@@ -540,23 +543,23 @@ public class RMAppAttemptImpl implements
       switch (finalAttemptState) {
         case FINISHED:
         {
-          appEvent = 
+          appEvent =
               new RMAppEvent(applicationId, RMAppEventType.ATTEMPT_FINISHED);
         }
         break;
         case KILLED:
         {
-          appEvent = 
-              new RMAppFailedAttemptEvent(applicationId, 
-                  RMAppEventType.ATTEMPT_KILLED, 
+          appEvent =
+              new RMAppFailedAttemptEvent(applicationId,
+                  RMAppEventType.ATTEMPT_KILLED,
                   "Application killed by user.");
         }
         break;
         case FAILED:
         {
-          appEvent = 
-              new RMAppFailedAttemptEvent(applicationId, 
-                  RMAppEventType.ATTEMPT_FAILED, 
+          appEvent =
+              new RMAppFailedAttemptEvent(applicationId,
+                  RMAppEventType.ATTEMPT_FAILED,
                   appAttempt.getDiagnostics());
         }
         break;
@@ -566,7 +569,7 @@ public class RMAppAttemptImpl implements
         }
         break;
       }
-      
+
       appAttempt.eventHandler.handle(appEvent);
       appAttempt.eventHandler.handle(new AppRemovedSchedulerEvent(appAttempt
           .getAppAttemptId(), finalAttemptState));
@@ -657,7 +660,7 @@ public class RMAppAttemptImpl implements
 
       RMAppAttemptContainerFinishedEvent finishEvent =
           ((RMAppAttemptContainerFinishedEvent)event);
-      
+
       // UnRegister from AMLivelinessMonitor
       appAttempt.rmContext.getAMLivelinessMonitor().unregister(
           appAttempt.getAppAttemptId());
@@ -666,7 +669,7 @@ public class RMAppAttemptImpl implements
       ContainerStatus status = finishEvent.getContainerStatus();
       appAttempt.diagnostics.append("AM Container for " +
           appAttempt.getAppAttemptId() + " exited with " +
-          " exitCode: " + status.getExitStatus() + 
+          " exitCode: " + status.getExitStatus() +
           " due to: " +  status.getDiagnostics() + "." +
           "Failing this attempt.");
 
@@ -730,10 +733,9 @@ public class RMAppAttemptImpl implements
 
       RMAppAttemptUnregistrationEvent unregisterEvent
         = (RMAppAttemptUnregistrationEvent) event;
-      unregisterEvent.getFinalState();
       appAttempt.diagnostics.append(unregisterEvent.getDiagnostics());
       appAttempt.trackingUrl = unregisterEvent.getTrackingUrl();
-      appAttempt.finalState = unregisterEvent.getFinalState();
+      appAttempt.finalStatus = unregisterEvent.getFinalApplicationStatus();
 
       // Tell the app and the scheduler
       super.transition(appAttempt, event);
@@ -761,7 +763,7 @@ public class RMAppAttemptImpl implements
 
       RMAppAttemptContainerFinishedEvent containerFinishedEvent
         = (RMAppAttemptContainerFinishedEvent) event;
-      ContainerStatus containerStatus = 
+      ContainerStatus containerStatus =
           containerFinishedEvent.getContainerStatus();
 
       // Is this container the AmContainer? If the finished container is same as
@@ -771,7 +773,7 @@ public class RMAppAttemptImpl implements
         // Setup diagnostic message
         appAttempt.diagnostics.append("AM Container for " +
             appAttempt.getAppAttemptId() + " exited with " +
-            " exitCode: " + containerStatus.getExitStatus() + 
+            " exitCode: " + containerStatus.getExitStatus() +
             " due to: " +  containerStatus.getDiagnostics() + "." +
             "Failing this attempt.");
 

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/event/RMAppAttemptUnregistrationEvent.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/event/RMAppAttemptUnregistrationEvent.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/event/RMAppAttemptUnregistrationEvent.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/event/RMAppAttemptUnregistrationEvent.java Fri Sep 30 12:46:32 2011
@@ -19,20 +19,21 @@
 package org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.event;
 
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptEventType;
 
 public class RMAppAttemptUnregistrationEvent extends RMAppAttemptEvent {
 
   private final String trackingUrl;
-  private final String finalState;
+  private final FinalApplicationStatus finalStatus;
   private final String diagnostics;
 
   public RMAppAttemptUnregistrationEvent(ApplicationAttemptId appAttemptId,
-      String trackingUrl, String finalState, String diagnostics) {
+      String trackingUrl, FinalApplicationStatus finalStatus, String diagnostics) {
     super(appAttemptId, RMAppAttemptEventType.UNREGISTERED);
     this.trackingUrl = trackingUrl;
-    this.finalState = finalState;
+    this.finalStatus = finalStatus;
     this.diagnostics = diagnostics;
   }
 
@@ -40,12 +41,12 @@ public class RMAppAttemptUnregistrationE
     return this.trackingUrl;
   }
 
-  public String getFinalState() {
-    return this.finalState;
+  public FinalApplicationStatus getFinalApplicationStatus() {
+    return this.finalStatus;
   }
 
   public String getDiagnostics() {
     return this.diagnostics;
   }
 
-}
\ No newline at end of file
+}

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java Fri Sep 30 12:46:32 2011
@@ -50,6 +50,7 @@ class AppsBlock extends HtmlBlock {
             th(".name", "Name").
             th(".queue", "Queue").
             th(".state", "State").
+            th(".finalstatus", "FinalStatus").
             th(".progress", "Progress").
             th(".ui", "Tracking UI").
             th(".note", "Note")._()._().
@@ -70,8 +71,8 @@ class AppsBlock extends HtmlBlock {
           td(app.getUser().toString()).
           td(app.getName().toString()).
           td(app.getQueue().toString()).
-          td(app.getState() == RMAppState.FINISHED ? app.getAMFinalState() : 
-            app.getState().toString()).
+          td(app.getState().toString()).
+          td(app.getFinalApplicationStatus().toString()).
           td().
             br().$title(percent)._(). // for sorting
             div(_PROGRESSBAR).

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java Fri Sep 30 12:46:32 2011
@@ -89,9 +89,8 @@ public class RmController extends Contro
     ResponseInfo info = info("Application Overview").
       _("User:", app.getUser()).
       _("Name:", app.getName()).
-      _("State:", (app.getState() == RMAppState.FINISHED ?
-        app.getAMFinalState() : app.getState().toString())
-      ).
+      _("State:", app.getState().toString()).
+      _("FinalStatus:", app.getFinalApplicationStatus().toString()).
       _("Started:", Times.format(app.getStartTime())).
       _("Elapsed:", StringUtils.formatTime(
         Times.elapsed(app.getStartTime(), app.getFinishTime()))).

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockAM.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockAM.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockAM.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockAM.java Fri Sep 30 12:46:32 2011
@@ -30,7 +30,7 @@ import org.apache.hadoop.yarn.api.protoc
 import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterRequest;
 import org.apache.hadoop.yarn.api.records.AMResponse;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
-import org.apache.hadoop.yarn.api.records.Container;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.Priority;
 import org.apache.hadoop.yarn.api.records.Resource;
@@ -47,11 +47,11 @@ public class MockAM {
   private final ApplicationAttemptId attemptId;
   private final RMContext context;
   private final AMRMProtocol amRMProtocol;
-  
+
   private final List<ResourceRequest> requests = new ArrayList<ResourceRequest>();
   private final List<ContainerId> releases = new ArrayList<ContainerId>();
 
-  MockAM(RMContext context, AMRMProtocol amRMProtocol, 
+  MockAM(RMContext context, AMRMProtocol amRMProtocol,
       ApplicationAttemptId attemptId) {
     this.context = context;
     this.amRMProtocol = amRMProtocol;
@@ -85,7 +85,7 @@ public class MockAM {
     amRMProtocol.registerApplicationMaster(req);
   }
 
-  public void addRequests(String[] hosts, int memory, int priority, 
+  public void addRequests(String[] hosts, int memory, int priority,
       int containers) throws Exception {
     requests.addAll(createReq(hosts, memory, priority, containers));
   }
@@ -97,33 +97,33 @@ public class MockAM {
     return response;
   }
 
-  public AMResponse allocate( 
-      String host, int memory, int numContainers, 
+  public AMResponse allocate(
+      String host, int memory, int numContainers,
       List<ContainerId> releases) throws Exception {
-    List reqs = createReq(new String[]{host}, memory, 1, numContainers);
+    List<ResourceRequest> reqs = createReq(new String[]{host}, memory, 1, numContainers);
     return allocate(reqs, releases);
   }
 
-  public List<ResourceRequest> createReq(String[] hosts, int memory, int priority, 
+  public List<ResourceRequest> createReq(String[] hosts, int memory, int priority,
       int containers) throws Exception {
     List<ResourceRequest> reqs = new ArrayList<ResourceRequest>();
     for (String host : hosts) {
-      ResourceRequest hostReq = createResourceReq(host, memory, priority, 
+      ResourceRequest hostReq = createResourceReq(host, memory, priority,
           containers);
       reqs.add(hostReq);
-      ResourceRequest rackReq = createResourceReq("default-rack", memory, 
+      ResourceRequest rackReq = createResourceReq("default-rack", memory,
           priority, containers);
       reqs.add(rackReq);
     }
-    
-    ResourceRequest offRackReq = createResourceReq("*", memory, priority, 
+
+    ResourceRequest offRackReq = createResourceReq("*", memory, priority,
         containers);
     reqs.add(offRackReq);
     return reqs;
-    
+
   }
 
-  public ResourceRequest createResourceReq(String resource, int memory, int priority, 
+  public ResourceRequest createResourceReq(String resource, int memory, int priority,
       int containers) throws Exception {
     ResourceRequest req = Records.newRecord(ResourceRequest.class);
     req.setHostName(resource);
@@ -138,7 +138,7 @@ public class MockAM {
   }
 
   public AMResponse allocate(
-      List<ResourceRequest> resourceRequest, List<ContainerId> releases) 
+      List<ResourceRequest> resourceRequest, List<ContainerId> releases)
       throws Exception {
     AllocateRequest req = BuilderUtils.newAllocateRequest(attemptId,
         ++responseId, 0F, resourceRequest, releases);
@@ -151,7 +151,7 @@ public class MockAM {
     FinishApplicationMasterRequest req = Records.newRecord(FinishApplicationMasterRequest.class);
     req.setAppAttemptId(attemptId);
     req.setDiagnostics("");
-    req.setFinalState("");
+    req.setFinishApplicationStatus(FinalApplicationStatus.SUCCEEDED);
     req.setTrackingUrl("");
     amRMProtocol.finishApplicationMaster(req);
   }

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/MockAsm.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/MockAsm.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/MockAsm.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/MockAsm.java Fri Sep 30 12:46:32 2011
@@ -22,10 +22,11 @@ import java.util.List;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.yarn.MockApps;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationMaster;
 import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.ApplicationState;
+import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.apache.hadoop.yarn.api.records.ApplicationStatus;
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.ContainerId;
@@ -69,7 +70,7 @@ public abstract class MockAsm extends Mo
     }
 
     @Override
-    public ApplicationState getState() {
+    public YarnApplicationState getState() {
       throw new UnsupportedOperationException("Not supported yet.");
     }
 
@@ -119,7 +120,7 @@ public abstract class MockAsm extends Mo
     }
 
     @Override
-    public void setState(ApplicationState state) {
+    public void setState(YarnApplicationState state) {
       throw new UnsupportedOperationException("Not supported yet.");
     }
 
@@ -207,11 +208,11 @@ public abstract class MockAsm extends Mo
     }
     @Override
     public void handle(RMAppEvent event) {
-      throw new UnsupportedOperationException("Not supported yet.");      
+      throw new UnsupportedOperationException("Not supported yet.");
     }
 
     @Override
-    public String getAMFinalState() {
+    public FinalApplicationStatus getFinalApplicationStatus() {
       throw new UnsupportedOperationException("Not supported yet.");
     }
   }
@@ -274,9 +275,14 @@ public abstract class MockAsm extends Mo
       public float getProgress() {
         return (float)Math.random();
       }
+      @Override
+      public FinalApplicationStatus getFinalApplicationStatus() {
+        return FinalApplicationStatus.UNDEFINED;
+      }
+      
     };
   }
-  
+
   public static List<RMApp> newApplications(int n) {
     List<RMApp> list = Lists.newArrayList();
     for (int i = 0; i < n; ++i) {

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java?rev=1177633&r1=1177632&r2=1177633&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java Fri Sep 30 12:46:32 2011
@@ -32,7 +32,7 @@ import org.apache.hadoop.yarn.api.protoc
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationMaster;
 import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.ApplicationState;
+import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.Priority;
@@ -65,7 +65,7 @@ public class TestAMLaunchFailure {
 //  private static final RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
 //  ApplicationsManagerImpl asmImpl;
 //  YarnScheduler scheduler = new DummyYarnScheduler();
-//  ApplicationTokenSecretManager applicationTokenSecretManager = 
+//  ApplicationTokenSecretManager applicationTokenSecretManager =
 //    new ApplicationTokenSecretManager();
 //  private ClientRMService clientService;
 //
@@ -98,7 +98,7 @@ public class TestAMLaunchFailure {
 //        , ApplicationStore appStore)
 //        throws IOException {
 //      // TODO Auto-generated method stub
-//      
+//
 //    }
 //
 //    @Override
@@ -199,7 +199,7 @@ public class TestAMLaunchFailure {
 //    conf.setLong(YarnConfiguration.AM_EXPIRY_INTERVAL, 3000L);
 //    conf.setInt(RMConfig.AM_MAX_RETRIES, 1);
 //    asmImpl.init(conf);
-//    asmImpl.start();  
+//    asmImpl.start();
 //  }
 //
 //  @After
@@ -221,7 +221,7 @@ public class TestAMLaunchFailure {
 //        .newRecordInstance(SubmitApplicationRequest.class);
 //    request.setApplicationSubmissionContext(submissionContext);
 //    clientService.submitApplication(request);
-//    AppAttempt application = context.getApplications().get(appID); 
+//    AppAttempt application = context.getApplications().get(appID);
 //
 //    while (application.getState() != ApplicationState.FAILED) {
 //      LOG.info("Waiting for application to go to FAILED state."



Mime
View raw message