hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vino...@apache.org
Subject svn commit: r1134898 - in /hadoop/mapreduce/branches/MR-279: ./ yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/ yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org...
Date Sun, 12 Jun 2011 10:05:05 GMT
Author: vinodkv
Date: Sun Jun 12 10:05:04 2011
New Revision: 1134898

URL: http://svn.apache.org/viewvc?rev=1134898&view=rev
Log:
Fixing the bug which was causing FAILED jobs to be displayed as COMPLETED on the RM UI. (vinodkv)

Added:
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/events/ApplicationFinishEvent.java
Modified:
    hadoop/mapreduce/branches/MR-279/CHANGES.txt
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMLauncher.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMTracker.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/ApplicationMasterInfo.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/events/ApplicationMasterEvents.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestASMStateMachine.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationMasterLauncher.java

Modified: hadoop/mapreduce/branches/MR-279/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/CHANGES.txt?rev=1134898&r1=1134897&r2=1134898&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/CHANGES.txt (original)
+++ hadoop/mapreduce/branches/MR-279/CHANGES.txt Sun Jun 12 10:05:04 2011
@@ -5,6 +5,9 @@ Trunk (unreleased changes)
 
     MAPREDUCE-279
 
+    Fixing the bug which was causing FAILED jobs to be displayed as COMPLETED
+    on the RM UI. (vinodkv)
+
     Fixing broken link to logs for container on NM web UI. (vinodkv)
 
     Miscellaneous UI fixes + source code formatting for

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMLauncher.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMLauncher.java?rev=1134898&r1=1134897&r2=1134898&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMLauncher.java
(original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMLauncher.java
Sun Jun 12 10:05:04 2011
@@ -47,6 +47,7 @@ import org.apache.hadoop.yarn.api.Contai
 import org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest;
 import org.apache.hadoop.yarn.api.protocolrecords.StopContainerRequest;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
+import org.apache.hadoop.yarn.api.records.ApplicationState;
 import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.ContainerId;
@@ -64,6 +65,7 @@ import org.apache.hadoop.yarn.security.C
 import org.apache.hadoop.yarn.security.client.ClientToAMSecretManager;
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.RMContext;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ASMEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationFinishEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationMasterEvents.AMLauncherEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationMasterEvents.ApplicationEventType;
 
@@ -271,7 +273,8 @@ public class AMLauncher implements Runna
       } catch(IOException ie) {
         LOG.info("Error cleaning master ", ie);
       }
-      handler.handle(new ASMEvent<ApplicationEventType>(ApplicationEventType.FINISH,
master));
+      handler.handle(new ApplicationFinishEvent(master,
+          ApplicationState.COMPLETED)); // Doesn't matter what state you send :) :(
       break;
     default:
       break;

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMTracker.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMTracker.java?rev=1134898&r1=1134897&r2=1134898&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMTracker.java
(original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMTracker.java
Sun Jun 12 10:05:04 2011
@@ -46,6 +46,7 @@ import org.apache.hadoop.yarn.factory.pr
 import org.apache.hadoop.yarn.server.resourcemanager.RMConfig;
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.RMContext;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ASMEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationFinishEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationMasterEvents.ApplicationEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.ApplicationsStore;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.ApplicationsStore.ApplicationStore;
@@ -261,8 +262,9 @@ public class AMTracker extends AbstractS
     masterInfo.getMaster().setDiagnostics(
         remoteApplicationMaster.getDiagnostics());
 
-    rmContext.getDispatcher().getSyncHandler().handle(new ASMEvent<ApplicationEventType>(
-        ApplicationEventType.FINISH, masterInfo));
+    rmContext.getDispatcher().getSyncHandler().handle(
+        new ApplicationFinishEvent(masterInfo, remoteApplicationMaster
+            .getState()));
   }
 
   public ApplicationMasterInfo get(ApplicationId applicationId) {

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/ApplicationMasterInfo.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/ApplicationMasterInfo.java?rev=1134898&r1=1134897&r2=1134898&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/ApplicationMasterInfo.java
(original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/ApplicationMasterInfo.java
Sun Jun 12 10:05:04 2011
@@ -20,6 +20,7 @@ package org.apache.hadoop.yarn.server.re
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.EnumSet;
 import java.util.List;
 
 import org.apache.commons.logging.Log;
@@ -38,12 +39,14 @@ import org.apache.hadoop.yarn.factories.
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.RMContext;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ASMEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationFinishEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationMasterEvents.AMLauncherEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationMasterEvents.ApplicationEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationMasterEvents.ApplicationTrackerEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationMasterEvents.SNEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.ApplicationsStore.ApplicationStore;
 import org.apache.hadoop.yarn.state.InvalidStateTransitonException;
+import org.apache.hadoop.yarn.state.MultipleArcTransition;
 import org.apache.hadoop.yarn.state.SingleArcTransition;
 import org.apache.hadoop.yarn.state.StateMachine;
 import org.apache.hadoop.yarn.state.StateMachineFactory;
@@ -93,125 +96,108 @@ public class ApplicationMasterInfo imple
   <ApplicationMasterInfo, ApplicationState, ApplicationEventType, ASMEvent<ApplicationEventType>>
   (ApplicationState.PENDING)
 
+  // Transitions from PENDING State
   .addTransition(ApplicationState.PENDING, ApplicationState.ALLOCATING,
-  ApplicationEventType.ALLOCATE, allocateTransition)
-  
+      ApplicationEventType.ALLOCATE, allocateTransition)
   .addTransition(ApplicationState.PENDING, ApplicationState.FAILED,
-  ApplicationEventType.FAILED)
-  
-  .addTransition(ApplicationState.PENDING, ApplicationState.KILLED, 
-  ApplicationEventType.KILL)
-
-  .addTransition(ApplicationState.PENDING, ApplicationState.ALLOCATING, 
+      ApplicationEventType.FAILED)
+  .addTransition(ApplicationState.PENDING, ApplicationState.KILLED,
+      ApplicationEventType.KILL)
+  .addTransition(ApplicationState.PENDING, ApplicationState.ALLOCATING,
       ApplicationEventType.RECOVER, allocateTransition)
-    
-  .addTransition(ApplicationState.PENDING, ApplicationState.ALLOCATING, 
-  ApplicationEventType.RELEASED, new ScheduleTransition())
-
-  .addTransition(ApplicationState.EXPIRED_PENDING, ApplicationState.ALLOCATING, 
-  ApplicationEventType.ALLOCATE, allocateTransition)
-  
-  .addTransition(ApplicationState.EXPIRED_PENDING, ApplicationState.ALLOCATING,
-  ApplicationEventType.RECOVER, allocateTransition)
-  
-  .addTransition(ApplicationState.EXPIRED_PENDING, ApplicationState.FAILED,
-  ApplicationEventType.FAILED_MAX_RETRIES, failedTransition)
-  
-  .addTransition(ApplicationState.EXPIRED_PENDING, ApplicationState.KILLED,
-   ApplicationEventType.KILL, killTransition)
- 
-  .addTransition(ApplicationState.ALLOCATING, ApplicationState.ALLOCATED,
-  ApplicationEventType.ALLOCATED, new AllocatedTransition())
-
-  .addTransition(ApplicationState.ALLOCATING, ApplicationState.ALLOCATING,
-  ApplicationEventType.RECOVER, allocateTransition)
-      
-  .addTransition(ApplicationState.ALLOCATING, ApplicationState.KILLED, 
-  ApplicationEventType.KILL, new AllocatingKillTransition())
-
-  .addTransition(ApplicationState.ALLOCATED, ApplicationState.KILLED, 
-  ApplicationEventType.KILL, killTransition)
+  .addTransition(ApplicationState.PENDING, ApplicationState.ALLOCATING,
+      ApplicationEventType.RELEASED, new ScheduleTransition())
 
+   // Transitions from ALLOCATING State
+  .addTransition(ApplicationState.ALLOCATING, ApplicationState.ALLOCATED,
+      ApplicationEventType.ALLOCATED, new AllocatedTransition())
+  .addTransition(ApplicationState.ALLOCATING,
+      ApplicationState.ALLOCATING, ApplicationEventType.RECOVER,
+      allocateTransition)
+  .addTransition(ApplicationState.ALLOCATING, ApplicationState.KILLED,
+      ApplicationEventType.KILL, new AllocatingKillTransition())
+
+  // Transitions from ALLOCATED State
+  .addTransition(ApplicationState.ALLOCATED, ApplicationState.KILLED,
+      ApplicationEventType.KILL, killTransition)
   .addTransition(ApplicationState.ALLOCATED, ApplicationState.LAUNCHING,
-  ApplicationEventType.LAUNCH, launchTransition)
-
+      ApplicationEventType.LAUNCH, launchTransition)
   .addTransition(ApplicationState.ALLOCATED, ApplicationState.LAUNCHING,
-  ApplicationEventType.RECOVER, new RecoverLaunchTransition())
-      
+      ApplicationEventType.RECOVER, new RecoverLaunchTransition())
+
+  // Transitions from LAUNCHING State
   .addTransition(ApplicationState.LAUNCHING, ApplicationState.LAUNCHED,
-  ApplicationEventType.LAUNCHED, launchedTransition)
-  
+      ApplicationEventType.LAUNCHED, launchedTransition)
   .addTransition(ApplicationState.LAUNCHING, ApplicationState.PENDING,
-  ApplicationEventType.LAUNCH_FAILED, failedLaunchTransition)
-  
-  /** we cant say if the application was launched or not on a recovery, so for now 
-   * we assume it was launched and wait for its restart.
-   */
+      ApplicationEventType.LAUNCH_FAILED, failedLaunchTransition)
+  // We cant say if the application was launched or not on a recovery, so
+  // for now we assume it was launched and wait for its restart.
   .addTransition(ApplicationState.LAUNCHING, ApplicationState.LAUNCHED,
-  ApplicationEventType.RECOVER, new RecoverLaunchedTransition())
-  
+      ApplicationEventType.RECOVER, new RecoverLaunchedTransition())
   .addTransition(ApplicationState.LAUNCHING, ApplicationState.KILLED,
-   ApplicationEventType.KILL, killTransition)
-   
-  .addTransition(ApplicationState.LAUNCHED, ApplicationState.CLEANUP, 
-  ApplicationEventType.KILL, killTransition)
-  
-  .addTransition(ApplicationState.LAUNCHED, ApplicationState.FAILED,
-  ApplicationEventType.EXPIRE, expireTransition)
-  
-  .addTransition(ApplicationState.LAUNCHED, ApplicationState.RUNNING, 
-  ApplicationEventType.REGISTERED, new RegisterTransition())
-    
-  .addTransition(ApplicationState.LAUNCHED, ApplicationState.LAUNCHED,
-   ApplicationEventType.RECOVER)
+      ApplicationEventType.KILL, killTransition)
 
-  /* for now we assume that acting on expiry is synchronous and we do not 
-   * have to wait for cleanup acks from scheduler negotiator and launcher.
-   */
-  .addTransition(ApplicationState.LAUNCHED, ApplicationState.EXPIRED_PENDING,
+  // Transitions from LAUNCHED State
+  .addTransition(ApplicationState.LAUNCHED, ApplicationState.CLEANUP,
+      ApplicationEventType.KILL, killTransition)
+  .addTransition(ApplicationState.LAUNCHED, ApplicationState.FAILED,
       ApplicationEventType.EXPIRE, expireTransition)
-      
-  .addTransition(ApplicationState.RUNNING,  ApplicationState.EXPIRED_PENDING, 
-  ApplicationEventType.EXPIRE, expireTransition)
-  
-  .addTransition(ApplicationState.RUNNING, ApplicationState.COMPLETED,
-  ApplicationEventType.FINISH, new DoneTransition())
-
+   .addTransition(ApplicationState.LAUNCHED, ApplicationState.RUNNING,
+      ApplicationEventType.REGISTERED, new RegisterTransition())
+  .addTransition(ApplicationState.LAUNCHED, ApplicationState.LAUNCHED,
+      ApplicationEventType.RECOVER)
+  // for now we assume that acting on expiry is synchronous and we do not
+  // have to wait for cleanup acks from scheduler negotiator and launcher.
+  .addTransition(ApplicationState.LAUNCHED,
+      ApplicationState.EXPIRED_PENDING, ApplicationEventType.EXPIRE,
+      expireTransition)
+
+  // Transitions from RUNNING State
+  .addTransition(ApplicationState.RUNNING,
+      ApplicationState.EXPIRED_PENDING, ApplicationEventType.EXPIRE,
+      expireTransition)
+  .addTransition(ApplicationState.RUNNING,
+      EnumSet.of(ApplicationState.COMPLETED, ApplicationState.FAILED),
+      ApplicationEventType.FINISH, new DoneTransition())
+      // TODO: For now, no KILLED above. As all kills come to RM directly.
   .addTransition(ApplicationState.RUNNING, ApplicationState.RUNNING,
-  ApplicationEventType.STATUSUPDATE, statusUpdatetransition)
-
+      ApplicationEventType.STATUSUPDATE, statusUpdatetransition)
   .addTransition(ApplicationState.RUNNING, ApplicationState.KILLED,
-   ApplicationEventType.KILL, killTransition)
-
+      ApplicationEventType.KILL, killTransition)
   .addTransition(ApplicationState.RUNNING, ApplicationState.RUNNING, 
-  ApplicationEventType.RECOVER, new RecoverRunningTransition())
-  
-  .addTransition(ApplicationState.COMPLETED, ApplicationState.COMPLETED, 
-  ApplicationEventType.EXPIRE)
+      ApplicationEventType.RECOVER, new RecoverRunningTransition())
 
+  // Transitions from EXPIRED_PENDING State
+  .addTransition(ApplicationState.EXPIRED_PENDING,
+      ApplicationState.ALLOCATING, ApplicationEventType.ALLOCATE,
+      allocateTransition)
+  .addTransition(ApplicationState.EXPIRED_PENDING,
+      ApplicationState.ALLOCATING, ApplicationEventType.RECOVER,
+      allocateTransition)
+   .addTransition(ApplicationState.EXPIRED_PENDING,
+      ApplicationState.FAILED, ApplicationEventType.FAILED_MAX_RETRIES,
+      failedTransition)
+   .addTransition(ApplicationState.EXPIRED_PENDING,
+      ApplicationState.KILLED, ApplicationEventType.KILL, killTransition)
+
+  // Transitions from COMPLETED State
   .addTransition(ApplicationState.COMPLETED, ApplicationState.COMPLETED,
-  ApplicationEventType.FINISH)
-  
-  .addTransition(ApplicationState.COMPLETED, ApplicationState.COMPLETED,
-   ApplicationEventType.KILL)
-   
-  .addTransition(ApplicationState.COMPLETED, ApplicationState.COMPLETED,
-  ApplicationEventType.RECOVER)
-  
+      EnumSet.of(ApplicationEventType.EXPIRE,
+          ApplicationEventType.FINISH, ApplicationEventType.KILL,
+          ApplicationEventType.RECOVER))
+
+  // Transitions from FAILED State
   .addTransition(ApplicationState.FAILED, ApplicationState.FAILED,
-      ApplicationEventType.RECOVER)
-  .addTransition(ApplicationState.FAILED, ApplicationState.FAILED, 
-     ApplicationEventType.FINISH)
-  
-  .addTransition(ApplicationState.FAILED, ApplicationState.FAILED, ApplicationEventType.KILL)
-  
+      EnumSet.of(ApplicationEventType.RECOVER, 
+           ApplicationEventType.FINISH,
+           ApplicationEventType.KILL))
+
+  // Transitions from KILLED State
   .addTransition(ApplicationState.KILLED, ApplicationState.KILLED, 
-      ApplicationEventType.RECOVER)
-  
-  .addTransition(ApplicationState.KILLED, ApplicationState.KILLED, ApplicationEventType.KILL)
-  
-  .addTransition(ApplicationState.KILLED, ApplicationState.KILLED,
-      ApplicationEventType.FINISH)
+      EnumSet.of(ApplicationEventType.RECOVER,
+           ApplicationEventType.KILL,
+           ApplicationEventType.FINISH))
+
   .installTopology();
 
 
@@ -307,10 +293,10 @@ public class ApplicationMasterInfo imple
   
   /* the applicaiton master completed successfully */
   private static class DoneTransition implements 
-    SingleArcTransition<ApplicationMasterInfo, ASMEvent<ApplicationEventType>>
{
+    MultipleArcTransition<ApplicationMasterInfo, ASMEvent<ApplicationEventType>,
ApplicationState> {
 
     @Override
-    public void transition(ApplicationMasterInfo masterInfo,
+    public ApplicationState transition(ApplicationMasterInfo masterInfo,
     ASMEvent<ApplicationEventType> event) {
       masterInfo.handler.handle(new ASMEvent<SNEventType>(
         SNEventType.CLEANUP, masterInfo));
@@ -318,6 +304,9 @@ public class ApplicationMasterInfo imple
         AMLauncherEventType.CLEANUP, masterInfo));
       masterInfo.handler.handle(new ASMEvent<ApplicationTrackerEventType>(
       ApplicationTrackerEventType.REMOVE, masterInfo));
+
+      ApplicationFinishEvent finishEvent = (ApplicationFinishEvent) event;
+      return finishEvent.getFinalApplicationState();
     }
   }
   

Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/events/ApplicationFinishEvent.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/events/ApplicationFinishEvent.java?rev=1134898&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/events/ApplicationFinishEvent.java
(added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/events/ApplicationFinishEvent.java
Sun Jun 12 10:05:04 2011
@@ -0,0 +1,37 @@
+/**
+* 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.server.resourcemanager.applicationsmanager.events;
+
+import org.apache.hadoop.yarn.api.records.ApplicationState;
+import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.AppContext;
+import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationMasterEvents.ApplicationEventType;
+
+public class ApplicationFinishEvent extends ASMEvent<ApplicationEventType> {
+  private final ApplicationState finalState;
+
+  public ApplicationFinishEvent(AppContext context,
+      ApplicationState finalState) {
+    super(ApplicationEventType.FINISH, context);
+    this.finalState = finalState;
+  }
+
+  public ApplicationState getFinalApplicationState() {
+    return this.finalState;
+  }
+}
\ No newline at end of file

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/events/ApplicationMasterEvents.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/events/ApplicationMasterEvents.java?rev=1134898&r1=1134897&r2=1134898&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/events/ApplicationMasterEvents.java
(original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/events/ApplicationMasterEvents.java
Sun Jun 12 10:05:04 2011
@@ -47,21 +47,37 @@ public class ApplicationMasterEvents {
   }
   
   public enum ApplicationEventType {
-    ALLOCATE,
+
+    // Source: ApplicationMasterService -> ASM -> AMTracker-self
     REGISTERED,
+    STATUSUPDATE,
+    FINISH, // Also by AMLauncher
+
+    // Source: SchedulerNegotiator.
+    ALLOCATED,
     RELEASED,
+
+    // Source: ASM -> AMTracker
+    ALLOCATE, // Also AMTracker->Self
+    FAILED,
     RECOVER,
+
+    // TODO: Nobody Uses!
     REMOVE,
-    STATUSUPDATE,
-    LAUNCH,
-    LAUNCH_FAILED,
+    CLEANUP,
+
+    // Source: AMLauncher
     LAUNCHED,
-    FAILED,
+    LAUNCH_FAILED,
+
+    // Source: AMTracker: Self-event
+    LAUNCH,
     FAILED_MAX_RETRIES,
-    ALLOCATED,
-    CLEANUP,
-    FINISH, 
+
+    // Source: AMLivelinessMonitor -> AMTracker
     EXPIRE,
+
+    // Source: ClientRMService -> ASM -> AMTracker
     KILL
   };
 }

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestASMStateMachine.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestASMStateMachine.java?rev=1134898&r1=1134897&r2=1134898&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestASMStateMachine.java
(original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestASMStateMachine.java
Sun Jun 12 10:05:04 2011
@@ -39,6 +39,7 @@ import org.apache.hadoop.yarn.factory.pr
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.RMContext;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ASMEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationFinishEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationMasterEvents.AMLauncherEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationMasterEvents.ApplicationEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationMasterEvents.ApplicationTrackerEventType;
@@ -259,8 +260,8 @@ public class TestASMStateMachine extends
 
     Assert.assertEquals(ApplicationState.RUNNING, masterInfo.getState());
 
-    handler.handle(
-        new ASMEvent<ApplicationEventType>(ApplicationEventType.FINISH, masterInfo));
+    handler.handle(new ApplicationFinishEvent(masterInfo,
+        ApplicationState.COMPLETED));
     waitForState(ApplicationState.COMPLETED, masterInfo);
     Assert.assertEquals(ApplicationState.COMPLETED, masterInfo.getState());
     /* check if clean up is called for everyone */

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationMasterLauncher.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationMasterLauncher.java?rev=1134898&r1=1134897&r2=1134898&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationMasterLauncher.java
(original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationMasterLauncher.java
Sun Jun 12 10:05:04 2011
@@ -26,6 +26,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
+import org.apache.hadoop.yarn.api.records.ApplicationState;
 import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
 import org.apache.hadoop.yarn.event.EventHandler;
 import org.apache.hadoop.yarn.factories.RecordFactory;
@@ -35,6 +36,7 @@ import org.apache.hadoop.yarn.security.A
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.RMContext;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ASMEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationFinishEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationMasterEvents.AMLauncherEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationMasterEvents.ApplicationEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemStore;
@@ -93,7 +95,8 @@ public class TestApplicationMasterLaunch
     }
     public void run() {
       cleanedUp.incrementAndGet();
-      asmHandle.handle(new ASMEvent<ApplicationEventType>(ApplicationEventType.FINISH,
null));
+      asmHandle.handle(new ApplicationFinishEvent(null,
+          ApplicationState.COMPLETED));
     }
   }
 



Mime
View raw message