hadoop-yarn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vino...@apache.org
Subject svn commit: r1562180 - in /hadoop/common/branches/branch-2/hadoop-yarn-project: ./ hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ hadoop-yarn/hadoop-yar...
Date Tue, 28 Jan 2014 19:49:41 GMT
Author: vinodkv
Date: Tue Jan 28 19:49:41 2014
New Revision: 1562180

URL: http://svn.apache.org/r1562180
Log:
YARN-1007. Enhance History Reader interface for Containers. Contributed by Mayank Bansal.
svn merge --ignore-ancestry -c 1556723 ../YARN-321

Modified:
    hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryReader.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/MemoryApplicationHistoryStore.java
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestMemoryApplicationHistoryStore.java

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt?rev=1562180&r1=1562179&r2=1562180&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt Tue Jan 28 19:49:41 2014
@@ -474,6 +474,9 @@ Branch YARN-321: Generic ApplicationHist
   YARN-956. Added a testable in-memory HistoryStorage. (Mayank Bansal via
   vinodkv)
 
+  YARN-1007. Enhance History Reader interface for Containers. (Mayank Bansal via
+  devaraj)
+
 Release 2.2.0 - 2013-10-13
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryReader.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryReader.java?rev=1562180&r1=1562179&r2=1562180&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryReader.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryReader.java
Tue Jan 28 19:49:41 2014
@@ -94,4 +94,16 @@ public interface ApplicationHistoryReade
    */
   ContainerHistoryData getAMContainer(ApplicationAttemptId appAttemptId)
       throws IOException;
+  
+  /**
+   * This method returns Map{@link ContainerId,@link ContainerHistoryData} for
+   * specified {@link ApplicationAttemptId}.
+   * 
+   * @param {@link ApplicationAttemptId}
+   * @return Map{@link ContainerId, @link ContainerHistoryData} for
+   *         ApplicationAttemptId
+   * @throws {@link IOException}
+   */
+  Map<ContainerId, ContainerHistoryData> getContainers(
+      ApplicationAttemptId appAttemptId) throws IOException;
 }

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/MemoryApplicationHistoryStore.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/MemoryApplicationHistoryStore.java?rev=1562180&r1=1562179&r2=1562180&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/MemoryApplicationHistoryStore.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/MemoryApplicationHistoryStore.java
Tue Jan 28 19:49:41 2014
@@ -161,4 +161,17 @@ public class MemoryApplicationHistorySto
       }
     }
   }
+
+  @Override
+  public Map<ContainerId, ContainerHistoryData> getContainers(
+      ApplicationAttemptId appAttemptId) throws IOException {
+    HashMap<ContainerId, ContainerHistoryData> containers =
+        new HashMap<ContainerId, ContainerHistoryData>();
+    for (ContainerId container : containerData.keySet()) {
+      if (container.getApplicationAttemptId().equals(appAttemptId)) {
+        containers.put(container, containerData.get(container));
+      }
+    }
+    return containers;
+  }
 }

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestMemoryApplicationHistoryStore.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestMemoryApplicationHistoryStore.java?rev=1562180&r1=1562179&r2=1562180&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestMemoryApplicationHistoryStore.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestMemoryApplicationHistoryStore.java
Tue Jan 28 19:49:41 2014
@@ -18,6 +18,7 @@
 
 package org.apache.hadoop.yarn.server.applicationhistoryservice;
 
+import java.io.IOException;
 import java.util.HashMap;
 
 import junit.framework.Assert;
@@ -67,12 +68,21 @@ public class TestMemoryApplicationHistor
     memstore.writeContainer(container);
   }
 
+  public ContainerHistoryData writeContainer(ApplicationAttemptId appAttemptId,
+      int containerId) throws Throwable {
+    ContainerHistoryData container = new ContainerHistoryDataPBImpl();
+    container
+      .setContainerId(ContainerId.newInstance(appAttemptId, containerId));
+    memstore.writeContainer(container);
+    return container;
+  }
+  
   @After
   public void tearDown() {
   }
 
   @Test
-  public void testReadApplication() {
+  public void testReadApplication() throws Throwable {
     HashMap<ApplicationId, ApplicationHistoryData> map =
         (HashMap<ApplicationId, ApplicationHistoryData>) memstore
           .getAllApplications();
@@ -98,5 +108,13 @@ public class TestMemoryApplicationHistor
           .newInstance(ApplicationId.newInstance(1234, 1), 1), 1));
     Assert.assertEquals("container_1234_0001_01_000001", amContainer
       .getContainerId().toString());
+    ContainerHistoryData container2 =
+        writeContainer(appAttempt.getApplicationAttemptId(), 2);
+    HashMap<ContainerId, ContainerHistoryData> containers =
+        (HashMap<ContainerId, ContainerHistoryData>) memstore
+          .getContainers(appAttempt.getApplicationAttemptId());
+    Assert.assertEquals(2, containers.size());
+    Assert.assertEquals("container_1234_0001_01_000002", containers.get(
+      container2.getContainerId()).getContainerId().toString());
   }
 }



Mime
View raw message