hadoop-yarn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1387449 - in /hadoop/common/branches/HDFS-3077/hadoop-yarn-project: ./ hadoop-yarn/ hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/ hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanage...
Date Wed, 19 Sep 2012 04:35:05 GMT
Author: todd
Date: Wed Sep 19 04:34:55 2012
New Revision: 1387449

URL: http://svn.apache.org/viewvc?rev=1387449&view=rev
Log:
Merge trunk into branch

Added:
    hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppFinishedAttemptEvent.java
      - copied unchanged from r1387448, hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppFinishedAttemptEvent.java
Modified:
    hadoop/common/branches/HDFS-3077/hadoop-yarn-project/CHANGES.txt
    hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/pom.xml
    hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/src/main/java/org/apache/hadoop/yarn/applications/unmanagedamlauncher/UnmanagedAMLauncher.java
    hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/FSDownload.java
    hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestCompositeService.java
    hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestFSDownload.java
    hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java
    hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java
    hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java
    hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/pom.xml

Modified: hadoop/common/branches/HDFS-3077/hadoop-yarn-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3077/hadoop-yarn-project/CHANGES.txt?rev=1387449&r1=1387448&r2=1387449&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3077/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/branches/HDFS-3077/hadoop-yarn-project/CHANGES.txt Wed Sep 19 04:34:55 2012
@@ -25,6 +25,15 @@ Release 2.0.3-alpha - Unreleased 
 
   IMPROVEMENTS
 
+    YARN-78. Changed UnManagedAM application to use YarnClient. (Bikas Saha via
+    vinodkv)
+
+    YARN-93. Fixed RM to propagate diagnostics from applications that have
+    finished but failed (Jason Lowe via vinodkv). 
+
+    YARN-28. Fixed TestCompositeService to not depend on test-order and thus
+    made it pass on JDK7 (Thomas Graves via vinodkv).
+
   OPTIMIZATIONS
 
   BUG FIXES
@@ -82,7 +91,10 @@ Release 0.23.4 - UNRELEASED
 
   IMPROVEMENTS
 
-     Change package of YarnClient to org.apache.hadoop. (Bikas Saha via vinodkv)
+    Change package of YarnClient to org.apache.hadoop. (Bikas Saha via vinodkv)
+
+    YARN-108. FSDownload can create cache directories with the wrong
+    permissions (Jason Lowe via bobby)
 
   OPTIMIZATIONS
 

Modified: hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/pom.xml
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/pom.xml?rev=1387449&r1=1387448&r2=1387449&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/pom.xml
(original)
+++ hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/pom.xml
Wed Sep 19 04:34:55 2012
@@ -58,6 +58,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-yarn-client</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-mapreduce-client-core</artifactId>
       <scope>test</scope>
     </dependency>

Modified: hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/src/main/java/org/apache/hadoop/yarn/applications/unmanagedamlauncher/UnmanagedAMLauncher.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/src/main/java/org/apache/hadoop/yarn/applications/unmanagedamlauncher/UnmanagedAMLauncher.java?rev=1387449&r1=1387448&r2=1387449&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/src/main/java/org/apache/hadoop/yarn/applications/unmanagedamlauncher/UnmanagedAMLauncher.java
(original)
+++ hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/src/main/java/org/apache/hadoop/yarn/applications/unmanagedamlauncher/UnmanagedAMLauncher.java
Wed Sep 19 04:34:55 2012
@@ -22,7 +22,6 @@ import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStreamReader;
-import java.net.InetSocketAddress;
 import java.util.ArrayList;
 import java.util.EnumSet;
 import java.util.Map;
@@ -37,12 +36,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.ApplicationConstants;
-import org.apache.hadoop.yarn.api.ClientRMProtocol;
-import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest;
-import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse;
-import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationRequest;
 import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse;
-import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationReport;
@@ -51,9 +45,9 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.api.records.Priority;
 import org.apache.hadoop.yarn.api.records.YarnApplicationState;
+import org.apache.hadoop.yarn.client.YarnClientImpl;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
-import org.apache.hadoop.yarn.ipc.YarnRPC;
 import org.apache.hadoop.yarn.util.Records;
 
 /**
@@ -73,11 +67,8 @@ public class UnmanagedAMLauncher {
 
   private Configuration conf;
 
-  // RPC to communicate to RM
-  private YarnRPC rpc;
-
   // Handle to talk to the Resource Manager/Applications Manager
-  private ClientRMProtocol rmClient;
+  private YarnClientImpl rmClient;
 
   // Application master specific info to register a new Application with RM/ASM
   private String appName = "";
@@ -114,7 +105,6 @@ public class UnmanagedAMLauncher {
   public UnmanagedAMLauncher(Configuration conf) throws Exception {
     // Set up RPC
     this.conf = conf;
-    rpc = YarnRPC.create(conf);
   }
 
   public UnmanagedAMLauncher() throws Exception {
@@ -163,25 +153,11 @@ public class UnmanagedAMLauncher {
           "No cmd specified for application master");
     }
 
-    return true;
-  }
-
-  private void connectToRM() throws IOException {
     YarnConfiguration yarnConf = new YarnConfiguration(conf);
-    InetSocketAddress rmAddress = yarnConf.getSocketAddr(
-        YarnConfiguration.RM_ADDRESS, YarnConfiguration.DEFAULT_RM_ADDRESS,
-        YarnConfiguration.DEFAULT_RM_PORT);
-    LOG.info("Connecting to ResourceManager at " + rmAddress);
-    rmClient = ((ClientRMProtocol) rpc.getProxy(ClientRMProtocol.class,
-        rmAddress, conf));
-  }
+    rmClient = new YarnClientImpl();
+    rmClient.init(yarnConf);
 
-  private GetNewApplicationResponse getApplication() throws YarnRemoteException {
-    GetNewApplicationRequest request = Records
-        .newRecord(GetNewApplicationRequest.class);
-    GetNewApplicationResponse response = rmClient.getNewApplication(request);
-    LOG.info("Got new application id=" + response.getApplicationId());
-    return response;
+    return true;
   }
 
   public void launchAM(ApplicationAttemptId attemptId) throws IOException {
@@ -275,80 +251,81 @@ public class UnmanagedAMLauncher {
     }
     amProc.destroy();
   }
-
+  
   public boolean run() throws IOException {
     LOG.info("Starting Client");
-
+    
     // Connect to ResourceManager
-    connectToRM();
-    assert (rmClient != null);
-
-    // Get a new application id
-    GetNewApplicationResponse newApp = getApplication();
-    ApplicationId appId = newApp.getApplicationId();
-
-    // Create launch context for app master
-    LOG.info("Setting up application submission context for ASM");
-    ApplicationSubmissionContext appContext = Records
-        .newRecord(ApplicationSubmissionContext.class);
-
-    // set the application id
-    appContext.setApplicationId(appId);
-    // set the application name
-    appContext.setApplicationName(appName);
-
-    // Set the priority for the application master
-    Priority pri = Records.newRecord(Priority.class);
-    pri.setPriority(amPriority);
-    appContext.setPriority(pri);
-
-    // Set the queue to which this application is to be submitted in the RM
-    appContext.setQueue(amQueue);
-
-    // Set up the container launch context for the application master
-    ContainerLaunchContext amContainer = Records
-        .newRecord(ContainerLaunchContext.class);
-    appContext.setAMContainerSpec(amContainer);
-
-    // unmanaged AM
-    appContext.setUnmanagedAM(true);
-    LOG.info("Setting unmanaged AM");
-
-    // Create the request to send to the applications manager
-    SubmitApplicationRequest appRequest = Records
-        .newRecord(SubmitApplicationRequest.class);
-    appRequest.setApplicationSubmissionContext(appContext);
-
-    // Submit the application to the applications manager
-    LOG.info("Submitting application to ASM");
-    rmClient.submitApplication(appRequest);
-
-    // Monitor the application to wait for launch state
-    ApplicationReport appReport = monitorApplication(appId,
-        EnumSet.of(YarnApplicationState.ACCEPTED));
-    ApplicationAttemptId attemptId = appReport.getCurrentApplicationAttemptId();
-    LOG.info("Launching application with id: " + attemptId);
-
-    // launch AM
-    launchAM(attemptId);
-
-    // Monitor the application for end state
-    appReport = monitorApplication(appId, EnumSet.of(
-        YarnApplicationState.KILLED, YarnApplicationState.FAILED,
-        YarnApplicationState.FINISHED));
-    YarnApplicationState appState = appReport.getYarnApplicationState();
-    FinalApplicationStatus appStatus = appReport.getFinalApplicationStatus();
-
-    LOG.info("App ended with state: " + appReport.getYarnApplicationState()
-        + " and status: " + appStatus);
-    if (YarnApplicationState.FINISHED == appState
-        && FinalApplicationStatus.SUCCEEDED == appStatus) {
-      LOG.info("Application has completed successfully.");
-      return true;
-    } else {
-      LOG.info("Application did finished unsuccessfully." + " YarnState="
-          + appState.toString() + ", FinalStatus=" + appStatus.toString());
-      return false;
+    rmClient.start();
+    try {  
+      // Get a new application id
+      GetNewApplicationResponse newApp = rmClient.getNewApplication();
+      ApplicationId appId = newApp.getApplicationId();
+  
+      // Create launch context for app master
+      LOG.info("Setting up application submission context for ASM");
+      ApplicationSubmissionContext appContext = Records
+          .newRecord(ApplicationSubmissionContext.class);
+  
+      // set the application id
+      appContext.setApplicationId(appId);
+      // set the application name
+      appContext.setApplicationName(appName);
+  
+      // Set the priority for the application master
+      Priority pri = Records.newRecord(Priority.class);
+      pri.setPriority(amPriority);
+      appContext.setPriority(pri);
+  
+      // Set the queue to which this application is to be submitted in the RM
+      appContext.setQueue(amQueue);
+  
+      // Set up the container launch context for the application master
+      ContainerLaunchContext amContainer = Records
+          .newRecord(ContainerLaunchContext.class);
+      appContext.setAMContainerSpec(amContainer);
+  
+      // unmanaged AM
+      appContext.setUnmanagedAM(true);
+      LOG.info("Setting unmanaged AM");
+  
+      // Submit the application to the applications manager
+      LOG.info("Submitting application to ASM");
+      rmClient.submitApplication(appContext);
+  
+      // Monitor the application to wait for launch state
+      ApplicationReport appReport = monitorApplication(appId,
+          EnumSet.of(YarnApplicationState.ACCEPTED));
+      ApplicationAttemptId attemptId = appReport.getCurrentApplicationAttemptId();
+      LOG.info("Launching application with id: " + attemptId);
+  
+      // launch AM
+      launchAM(attemptId);
+  
+      // Monitor the application for end state
+      appReport = monitorApplication(appId, EnumSet.of(
+          YarnApplicationState.KILLED, YarnApplicationState.FAILED,
+          YarnApplicationState.FINISHED));
+      YarnApplicationState appState = appReport.getYarnApplicationState();
+      FinalApplicationStatus appStatus = appReport.getFinalApplicationStatus();
+  
+      LOG.info("App ended with state: " + appReport.getYarnApplicationState()
+          + " and status: " + appStatus);
+      
+      boolean success;
+      if (YarnApplicationState.FINISHED == appState
+          && FinalApplicationStatus.SUCCEEDED == appStatus) {
+        LOG.info("Application has completed successfully.");
+        success = true;
+      } else {
+        LOG.info("Application did finished unsuccessfully." + " YarnState="
+            + appState.toString() + ", FinalStatus=" + appStatus.toString());
+        success = false;
+      }
+      
+      return success;
+    } finally {
+      rmClient.stop();
     }
   }
 
@@ -374,12 +351,7 @@ public class UnmanagedAMLauncher {
       }
 
       // Get application report for the appId we are interested in
-      GetApplicationReportRequest reportRequest = Records
-          .newRecord(GetApplicationReportRequest.class);
-      reportRequest.setApplicationId(appId);
-      GetApplicationReportResponse reportResponse = rmClient
-          .getApplicationReport(reportRequest);
-      ApplicationReport report = reportResponse.getApplicationReport();
+      ApplicationReport report = rmClient.getApplicationReport(appId);
 
       LOG.info("Got application report from ASM for" + ", appId="
           + appId.getId() + ", appAttemptId="

Modified: hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/FSDownload.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/FSDownload.java?rev=1387449&r1=1387448&r2=1387449&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/FSDownload.java
(original)
+++ hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/FSDownload.java
Wed Sep 19 04:34:55 2012
@@ -82,6 +82,13 @@ public class FSDownload implements Calla
     return resource;
   }
 
+  private void createDir(Path path, FsPermission perm) throws IOException {
+    files.mkdir(path, perm, false);
+    if (!perm.equals(files.getUMask().applyUMask(perm))) {
+      files.setPermission(path, perm);
+    }
+  }
+
   private Path copy(Path sCopy, Path dstdir) throws IOException {
     FileSystem sourceFs = sCopy.getFileSystem(conf);
     Path dCopy = new Path(dstdir, sCopy.getName() + ".tmp");
@@ -144,9 +151,9 @@ public class FSDownload implements Calla
     } while (files.util().exists(tmp));
     destDirPath = tmp;
 
-    files.mkdir(destDirPath, cachePerms, false);
+    createDir(destDirPath, cachePerms);
     final Path dst_work = new Path(destDirPath + "_tmp");
-    files.mkdir(dst_work, cachePerms, false);
+    createDir(dst_work, cachePerms);
 
     Path dFinal = files.makeQualified(new Path(dst_work, sCopy.getName()));
     try {

Modified: hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestCompositeService.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestCompositeService.java?rev=1387449&r1=1387448&r2=1387449&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestCompositeService.java
(original)
+++ hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestCompositeService.java
Wed Sep 19 04:34:55 2012
@@ -25,6 +25,7 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.yarn.YarnException;
 import org.apache.hadoop.yarn.service.CompositeService;
 import org.apache.hadoop.yarn.service.Service.STATE;
+import org.junit.Before;
 import org.junit.Test;
 
 public class TestCompositeService {
@@ -33,6 +34,11 @@ public class TestCompositeService {
 
   private static final int FAILED_SERVICE_SEQ_NUMBER = 2;
 
+  @Before
+  public void setup() {
+    CompositeServiceImpl.resetCounter();
+  }
+
   @Test
   public void testCallSequence() {
     ServiceManager serviceManager = new ServiceManager("ServiceManager");
@@ -226,6 +232,10 @@ public class TestCompositeService {
       counter = -1;
     }
 
+    public static void resetCounter() {
+      counter = -1;
+    }
+
     public void setThrowExceptionOnStart(boolean throwExceptionOnStart) {
       this.throwExceptionOnStart = throwExceptionOnStart;
     }

Modified: hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestFSDownload.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestFSDownload.java?rev=1387449&r1=1387448&r2=1387449&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestFSDownload.java
(original)
+++ hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestFSDownload.java
Wed Sep 19 04:34:55 2012
@@ -42,6 +42,7 @@ import junit.framework.Assert;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.CommonConfigurationKeys;
 import org.apache.hadoop.fs.FSDataOutputStream;
 import org.apache.hadoop.fs.FileContext;
 import org.apache.hadoop.fs.FileStatus;
@@ -115,6 +116,7 @@ public class TestFSDownload {
   public void testDownload() throws IOException, URISyntaxException,
       InterruptedException {
     Configuration conf = new Configuration();
+    conf.set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY, "077");
     FileContext files = FileContext.getLocalFSFileContext(conf);
     final Path basedir = files.makeQualified(new Path("target",
       TestFSDownload.class.getSimpleName()));
@@ -162,8 +164,14 @@ public class TestFSDownload {
         Path localized = p.getValue().get();
         assertEquals(sizes[Integer.valueOf(localized.getName())], p.getKey()
             .getSize());
-        FileStatus status = files.getFileStatus(localized);
+
+        FileStatus status = files.getFileStatus(localized.getParent());
         FsPermission perm = status.getPermission();
+        assertEquals("Cache directory permissions are incorrect",
+            new FsPermission((short)0755), perm);
+
+        status = files.getFileStatus(localized);
+        perm = status.getPermission();
         System.out.println("File permission " + perm + 
             " for rsrc vis " + p.getKey().getVisibility().name());
         assert(rsrcVis.containsKey(p.getKey()));

Modified: hadoop/common/branches/HDFS-3077/hadoop-yarn-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/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java?rev=1387449&r1=1387448&r2=1387449&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3077/hadoop-yarn-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/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java
Wed Sep 19 04:34:55 2012
@@ -101,6 +101,8 @@ public class RMAppImpl implements RMApp 
   @SuppressWarnings("rawtypes")
   private EventHandler handler;
   private static final FinalTransition FINAL_TRANSITION = new FinalTransition();
+  private static final AppFinishedTransition FINISHED_TRANSITION =
+      new AppFinishedTransition();
 
   private static final StateMachineFactory<RMAppImpl,
                                            RMAppState,
@@ -150,7 +152,7 @@ public class RMAppImpl implements RMApp 
     .addTransition(RMAppState.RUNNING, RMAppState.FINISHING,
         RMAppEventType.ATTEMPT_FINISHING, new RMAppFinishingTransition())
     .addTransition(RMAppState.RUNNING, RMAppState.FINISHED,
-        RMAppEventType.ATTEMPT_FINISHED, FINAL_TRANSITION)
+        RMAppEventType.ATTEMPT_FINISHED, FINISHED_TRANSITION)
     .addTransition(RMAppState.RUNNING,
         EnumSet.of(RMAppState.SUBMITTED, RMAppState.FAILED),
         RMAppEventType.ATTEMPT_FAILED,
@@ -160,7 +162,7 @@ public class RMAppImpl implements RMApp 
 
      // Transitions from FINISHING state
     .addTransition(RMAppState.FINISHING, RMAppState.FINISHED,
-        RMAppEventType.ATTEMPT_FINISHED, FINAL_TRANSITION)
+        RMAppEventType.ATTEMPT_FINISHED, FINISHED_TRANSITION)
     .addTransition(RMAppState.FINISHING, RMAppState.FINISHED,
         RMAppEventType.KILL, new KillAppAndAttemptTransition())
     // ignorable transitions
@@ -572,6 +574,15 @@ public class RMAppImpl implements RMApp 
     }
   }
 
+  private static class AppFinishedTransition extends FinalTransition {
+    public void transition(RMAppImpl app, RMAppEvent event) {
+      RMAppFinishedAttemptEvent finishedEvent =
+          (RMAppFinishedAttemptEvent)event;
+      app.diagnostics.append(finishedEvent.getDiagnostics());
+      super.transition(app, event);
+    };
+  }
+
   private static class AppKilledTransition extends FinalTransition {
     @Override
     public void transition(RMAppImpl app, RMAppEvent event) {

Modified: hadoop/common/branches/HDFS-3077/hadoop-yarn-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/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java?rev=1387449&r1=1387448&r2=1387449&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3077/hadoop-yarn-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/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java
Wed Sep 19 04:34:55 2012
@@ -56,6 +56,7 @@ import org.apache.hadoop.yarn.server.res
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppFailedAttemptEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppFinishedAttemptEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRejectedEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.event.RMAppAttemptContainerAcquiredEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.event.RMAppAttemptContainerFinishedEvent;
@@ -688,8 +689,8 @@ public class RMAppAttemptImpl implements
       switch (finalAttemptState) {
         case FINISHED:
         {
-          appEvent =
-              new RMAppEvent(applicationId, RMAppEventType.ATTEMPT_FINISHED);
+          appEvent = new RMAppFinishedAttemptEvent(applicationId,
+              appAttempt.getDiagnostics());
         }
         break;
         case KILLED:

Modified: hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java?rev=1387449&r1=1387448&r2=1387449&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java
(original)
+++ hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java
Wed Sep 19 04:34:55 2012
@@ -321,7 +321,8 @@ public class TestRMAppTransitions {
   }
 
   protected RMApp testCreateAppFinished(
-      ApplicationSubmissionContext submissionContext) throws IOException {
+      ApplicationSubmissionContext submissionContext,
+      String diagnostics) throws IOException {
     // unmanaged AMs don't use the FINISHING state
     RMApp application = null;
     if (submissionContext != null && submissionContext.getUnmanagedAM()) {
@@ -330,14 +331,15 @@ public class TestRMAppTransitions {
       application = testCreateAppFinishing(submissionContext);
     }
     // RUNNING/FINISHING => FINISHED event RMAppEventType.ATTEMPT_FINISHED
-    RMAppEvent finishedEvent = 
-        new RMAppEvent(application.getApplicationId(), 
-            RMAppEventType.ATTEMPT_FINISHED);
+    RMAppEvent finishedEvent = new RMAppFinishedAttemptEvent(
+        application.getApplicationId(), diagnostics);
     application.handle(finishedEvent);
     assertAppState(RMAppState.FINISHED, application);
     assertTimesAtFinish(application);
     // finished without a proper unregister implies failed
     assertFinalAppStatus(FinalApplicationStatus.FAILED, application);
+    Assert.assertTrue("Finished app missing diagnostics",
+        application.getDiagnostics().indexOf(diagnostics) != -1);
     return application;
   }
 
@@ -348,11 +350,14 @@ public class TestRMAppTransitions {
 
     // test success path
     LOG.info("--- START: testUnmanagedAppSuccessPath ---");
-    testCreateAppFinished(subContext);
+    final String diagMsg = "some diagnostics";
+    RMApp application = testCreateAppFinished(subContext, diagMsg);
+    Assert.assertTrue("Finished app missing diagnostics",
+        application.getDiagnostics().indexOf(diagMsg) != -1);
 
     // test app fails after 1 app attempt failure
     LOG.info("--- START: testUnmanagedAppFailPath ---");
-    RMApp application = testCreateAppRunning(subContext);
+    application = testCreateAppRunning(subContext);
     RMAppEvent event = new RMAppFailedAttemptEvent(
         application.getApplicationId(), RMAppEventType.ATTEMPT_FAILED, "");
     application.handle(event);
@@ -366,7 +371,10 @@ public class TestRMAppTransitions {
   @Test
   public void testAppSuccessPath() throws IOException {
     LOG.info("--- START: testAppSuccessPath ---");
-    testCreateAppFinished(null);
+    final String diagMsg = "some diagnostics";
+    RMApp application = testCreateAppFinished(null, diagMsg);
+    Assert.assertTrue("Finished application missing diagnostics",
+        application.getDiagnostics().indexOf(diagMsg) != -1);
   }
 
   @Test
@@ -551,7 +559,7 @@ public class TestRMAppTransitions {
   public void testAppFinishedFinished() throws IOException {
     LOG.info("--- START: testAppFinishedFinished ---");
 
-    RMApp application = testCreateAppFinished(null);
+    RMApp application = testCreateAppFinished(null, "");
     // FINISHED => FINISHED event RMAppEventType.KILL
     RMAppEvent event = 
         new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL);
@@ -579,9 +587,8 @@ public class TestRMAppTransitions {
     assertAppState(RMAppState.KILLED, application);
 
     // KILLED => KILLED event RMAppEventType.ATTEMPT_FINISHED
-    event =
-        new RMAppEvent(application.getApplicationId(), 
-            RMAppEventType.ATTEMPT_FINISHED);
+    event = new RMAppFinishedAttemptEvent(
+        application.getApplicationId(), "");
     application.handle(event);
     rmDispatcher.await();
     assertTimesAtFinish(application);

Modified: hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/pom.xml
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/pom.xml?rev=1387449&r1=1387448&r2=1387449&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/pom.xml (original)
+++ hadoop/common/branches/HDFS-3077/hadoop-yarn-project/hadoop-yarn/pom.xml Wed Sep 19 04:34:55
2012
@@ -154,6 +154,18 @@
           </includes>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <properties>
+            <property>
+              <name>listener</name>
+              <value>org.apache.hadoop.test.TimedOutTestsListener</value>
+            </property>
+          </properties>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 
@@ -187,4 +199,4 @@
     <module>hadoop-yarn-site</module>
     <module>hadoop-yarn-client</module>
   </modules>
-</project>
\ No newline at end of file
+</project>



Mime
View raw message