hadoop-yarn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zjs...@apache.org
Subject svn commit: r1559004 [4/4] - in /hadoop/common/branches/YARN-321/hadoop-yarn-project: ./ hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ hadoop-...
Date Fri, 17 Jan 2014 03:26:55 GMT
Modified: hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java?rev=1559004&r1=1559003&r2=1559004&view=diff
==============================================================================
--- hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java (original)
+++ hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java Fri Jan 17 03:26:53 2014
@@ -69,7 +69,7 @@ public class TestAHSWebServices extends 
       bind(JAXBContextResolver.class);
       bind(AHSWebServices.class);
       bind(GenericExceptionHandler.class);
-      try{
+      try {
         ahManager = mockApplicationHistoryManager();
       } catch (Exception e) {
         Assert.fail();
@@ -99,10 +99,10 @@ public class TestAHSWebServices extends 
 
   public TestAHSWebServices() {
     super(new WebAppDescriptor.Builder(
-        "org.apache.hadoop.yarn.server.applicationhistoryservice.webapp")
-        .contextListenerClass(GuiceServletConfig.class)
-        .filterClass(com.google.inject.servlet.GuiceFilter.class)
-        .contextPath("jersey-guice-filter").servletPath("/").build());
+      "org.apache.hadoop.yarn.server.applicationhistoryservice.webapp")
+      .contextListenerClass(GuiceServletConfig.class)
+      .filterClass(com.google.inject.servlet.GuiceFilter.class)
+      .contextPath("jersey-guice-filter").servletPath("/").build());
   }
 
   @Before
@@ -116,15 +116,16 @@ public class TestAHSWebServices extends 
     WebResource r = resource();
     String responseStr = "";
     try {
-      responseStr = r.path("ws").path("v1").path("applicationhistory")
-          .path("bogus").accept(MediaType.APPLICATION_JSON).get(String.class);
+      responseStr =
+          r.path("ws").path("v1").path("applicationhistory").path("bogus")
+            .accept(MediaType.APPLICATION_JSON).get(String.class);
       fail("should have thrown exception on invalid uri");
     } catch (UniformInterfaceException ue) {
       ClientResponse response = ue.getResponse();
       assertEquals(Status.NOT_FOUND, response.getClientResponseStatus());
 
       WebServicesTestUtils.checkStringMatch(
-          "error string exists and shouldn't", "", responseStr);
+        "error string exists and shouldn't", "", responseStr);
     }
   }
 
@@ -139,7 +140,7 @@ public class TestAHSWebServices extends 
       ClientResponse response = ue.getResponse();
       assertEquals(Status.NOT_FOUND, response.getClientResponseStatus());
       WebServicesTestUtils.checkStringMatch(
-          "error string exists and shouldn't", "", responseStr);
+        "error string exists and shouldn't", "", responseStr);
     }
   }
 
@@ -148,25 +149,26 @@ public class TestAHSWebServices extends 
     WebResource r = resource();
     String responseStr = "";
     try {
-      responseStr = r.path("ws").path("v1").path("applicationhistory")
-          .accept(MediaType.TEXT_PLAIN).get(String.class);
+      responseStr =
+          r.path("ws").path("v1").path("applicationhistory")
+            .accept(MediaType.TEXT_PLAIN).get(String.class);
       fail("should have thrown exception on invalid uri");
     } catch (UniformInterfaceException ue) {
       ClientResponse response = ue.getResponse();
       assertEquals(Status.INTERNAL_SERVER_ERROR,
-          response.getClientResponseStatus());
+        response.getClientResponseStatus());
       WebServicesTestUtils.checkStringMatch(
-          "error string exists and shouldn't", "", responseStr);
+        "error string exists and shouldn't", "", responseStr);
     }
   }
 
   @Test
   public void testAppsQuery() throws Exception {
     WebResource r = resource();
-    ClientResponse response = r.path("ws").path("v1")
-        .path("applicationhistory").path("apps")
-        .queryParam("state", YarnApplicationState.FINISHED.toString())
-        .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+    ClientResponse response =
+        r.path("ws").path("v1").path("applicationhistory").path("apps")
+          .queryParam("state", YarnApplicationState.FINISHED.toString())
+          .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
     assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
     JSONObject json = response.getEntity(JSONObject.class);
     assertEquals("incorrect number of elements", 1, json.length());
@@ -180,9 +182,10 @@ public class TestAHSWebServices extends 
   public void testSingleApp() throws Exception {
     ApplicationId appId = ApplicationId.newInstance(0, 1);
     WebResource r = resource();
-    ClientResponse response = r.path("ws").path("v1")
-        .path("applicationhistory").path("apps").path(appId.toString())
-        .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+    ClientResponse response =
+        r.path("ws").path("v1").path("applicationhistory").path("apps")
+          .path(appId.toString()).accept(MediaType.APPLICATION_JSON)
+          .get(ClientResponse.class);
     assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
     JSONObject json = response.getEntity(JSONObject.class);
     assertEquals("incorrect number of elements", 1, json.length());
@@ -194,19 +197,18 @@ public class TestAHSWebServices extends 
     assertEquals("test user", app.get("user"));
     assertEquals("test type", app.get("type"));
     assertEquals(FinalApplicationStatus.UNDEFINED.toString(),
-        app.get("finalAppStatus"));
-    assertEquals(YarnApplicationState.FINISHED.toString(),
-        app.get("appState"));
+      app.get("finalAppStatus"));
+    assertEquals(YarnApplicationState.FINISHED.toString(), app.get("appState"));
   }
 
   @Test
   public void testMultipleAttempts() throws Exception {
     ApplicationId appId = ApplicationId.newInstance(0, 1);
     WebResource r = resource();
-    ClientResponse response = r.path("ws").path("v1")
-        .path("applicationhistory").path("apps").path(appId.toString())
-        .path("appattempts").accept(MediaType.APPLICATION_JSON)
-        .get(ClientResponse.class);
+    ClientResponse response =
+        r.path("ws").path("v1").path("applicationhistory").path("apps")
+          .path(appId.toString()).path("appattempts")
+          .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
     assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
     JSONObject json = response.getEntity(JSONObject.class);
     assertEquals("incorrect number of elements", 1, json.length());
@@ -222,23 +224,22 @@ public class TestAHSWebServices extends 
     ApplicationAttemptId appAttemptId =
         ApplicationAttemptId.newInstance(appId, 1);
     WebResource r = resource();
-    ClientResponse response = r.path("ws").path("v1")
-        .path("applicationhistory").path("apps").path(appId.toString())
-        .path("appattempts").path(appAttemptId.toString())
-        .accept(MediaType.APPLICATION_JSON)
-        .get(ClientResponse.class);
+    ClientResponse response =
+        r.path("ws").path("v1").path("applicationhistory").path("apps")
+          .path(appId.toString()).path("appattempts")
+          .path(appAttemptId.toString()).accept(MediaType.APPLICATION_JSON)
+          .get(ClientResponse.class);
     assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
     JSONObject json = response.getEntity(JSONObject.class);
     assertEquals("incorrect number of elements", 1, json.length());
     JSONObject appAttempt = json.getJSONObject("appAttempt");
-    assertEquals(appAttemptId.toString(),
-        appAttempt.getString("appAttemptId"));
+    assertEquals(appAttemptId.toString(), appAttempt.getString("appAttemptId"));
     assertEquals(appAttemptId.toString(), appAttempt.getString("host"));
     assertEquals(appAttemptId.toString(),
-        appAttempt.getString("diagnosticsInfo"));
+      appAttempt.getString("diagnosticsInfo"));
     assertEquals("test tracking url", appAttempt.getString("trackingUrl"));
     assertEquals(YarnApplicationAttemptState.FINISHED.toString(),
-        appAttempt.get("appAttemptState"));
+      appAttempt.get("appAttemptState"));
   }
 
   @Test
@@ -247,11 +248,11 @@ public class TestAHSWebServices extends 
     ApplicationAttemptId appAttemptId =
         ApplicationAttemptId.newInstance(appId, 1);
     WebResource r = resource();
-    ClientResponse response = r.path("ws").path("v1")
-        .path("applicationhistory").path("apps").path(appId.toString())
-        .path("appattempts").path(appAttemptId.toString())
-        .path("containers").accept(MediaType.APPLICATION_JSON)
-        .get(ClientResponse.class);
+    ClientResponse response =
+        r.path("ws").path("v1").path("applicationhistory").path("apps")
+          .path(appId.toString()).path("appattempts")
+          .path(appAttemptId.toString()).path("containers")
+          .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
     assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
     JSONObject json = response.getEntity(JSONObject.class);
     assertEquals("incorrect number of elements", 1, json.length());
@@ -268,29 +269,27 @@ public class TestAHSWebServices extends 
         ApplicationAttemptId.newInstance(appId, 1);
     ContainerId containerId = ContainerId.newInstance(appAttemptId, 1);
     WebResource r = resource();
-    ClientResponse response = r.path("ws").path("v1")
-        .path("applicationhistory").path("apps").path(appId.toString())
-        .path("appattempts").path(appAttemptId.toString())
-        .path("containers").path(containerId.toString())
-        .accept(MediaType.APPLICATION_JSON)
-        .get(ClientResponse.class);
+    ClientResponse response =
+        r.path("ws").path("v1").path("applicationhistory").path("apps")
+          .path(appId.toString()).path("appattempts")
+          .path(appAttemptId.toString()).path("containers")
+          .path(containerId.toString()).accept(MediaType.APPLICATION_JSON)
+          .get(ClientResponse.class);
     assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
     JSONObject json = response.getEntity(JSONObject.class);
     assertEquals("incorrect number of elements", 1, json.length());
     JSONObject container = json.getJSONObject("container");
     assertEquals(containerId.toString(), container.getString("containerId"));
-    assertEquals(containerId.toString(),
-        container.getString("diagnosticsInfo"));
+    assertEquals(containerId.toString(), container.getString("diagnosticsInfo"));
     assertEquals("0", container.getString("allocatedMB"));
     assertEquals("0", container.getString("allocatedVCores"));
     assertEquals(NodeId.newInstance("localhost", 0).toString(),
-        container.getString("assignedNodeId"));
+      container.getString("assignedNodeId"));
     assertEquals(Priority.newInstance(containerId.getId()).toString(),
-        container.getString("priority"));
+      container.getString("priority"));
     assertEquals("http://localhost:0/log", container.getString("logUrl"));
     assertEquals(ContainerState.COMPLETE.toString(),
-        container.getString("containerState"));
+      container.getString("containerState"));
   }
 
 }
-

Modified: hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/ApplicationContext.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/ApplicationContext.java?rev=1559004&r1=1559003&r2=1559004&view=diff
==============================================================================
--- hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/ApplicationContext.java (original)
+++ hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/ApplicationContext.java Fri Jan 17 03:26:53 2014
@@ -36,10 +36,11 @@ public interface ApplicationContext {
   /**
    * This method returns Application {@link ApplicationReport} for the specified
    * {@link ApplicationId}.
-   * @param appId 
+   * 
+   * @param appId
    * 
    * @return {@link ApplicationReport} for the ApplicationId.
-   * @throws IOException 
+   * @throws IOException
    */
   @Public
   @Unstable
@@ -59,7 +60,8 @@ public interface ApplicationContext {
    * Application can have multiple application attempts
    * {@link ApplicationAttemptReport}. This method returns the all
    * {@link ApplicationAttemptReport}s for the Application.
-   * @param appId 
+   * 
+   * @param appId
    * 
    * @return all {@link ApplicationAttemptReport}s for the Application.
    * @throws IOException
@@ -73,7 +75,8 @@ public interface ApplicationContext {
    * This method returns {@link ApplicationAttemptReport} for specified
    * {@link ApplicationId}.
    * 
-   * @param appAttemptId {@link ApplicationAttemptId}
+   * @param appAttemptId
+   *          {@link ApplicationAttemptId}
    * @return {@link ApplicationAttemptReport} for ApplicationAttemptId
    * @throws IOException
    */
@@ -86,7 +89,8 @@ public interface ApplicationContext {
    * This method returns {@link ContainerReport} for specified
    * {@link ContainerId}.
    * 
-   * @param containerId {@link ContainerId}
+   * @param containerId
+   *          {@link ContainerId}
    * @return {@link ContainerReport} for ContainerId
    * @throws IOException
    */
@@ -98,7 +102,8 @@ public interface ApplicationContext {
    * This method returns {@link ContainerReport} for specified
    * {@link ApplicationAttemptId}.
    * 
-   * @param appAttemptId {@link ApplicationAttemptId}
+   * @param appAttemptId
+   *          {@link ApplicationAttemptId}
    * @return {@link ContainerReport} for ApplicationAttemptId
    * @throws IOException
    */

Modified: hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java?rev=1559004&r1=1559003&r2=1559004&view=diff
==============================================================================
--- hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java (original)
+++ hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java Fri Jan 17 03:26:53 2014
@@ -91,17 +91,19 @@ public class AppAttemptBlock extends Htm
         && appAttempt.getRpcPort() < 65536) {
       node = appAttempt.getHost() + ":" + appAttempt.getRpcPort();
     }
-    info("Application Attempt Overview").
-        _("State", appAttempt.getAppAttemptState()).
-        _("Master Container",
-            appAttempt.getAmContainerId() == null ? "#" : root_url("container",
-                appAttempt.getAmContainerId()),
-            String.valueOf(appAttempt.getAmContainerId())).
-        _("Node:", node).
-        _("Tracking URL:",
-            appAttempt.getTrackingUrl() == null ? "#" : root_url(appAttempt
-                .getTrackingUrl()), "History").
-        _("Diagnostics Info:", appAttempt.getDiagnosticsInfo());
+    info("Application Attempt Overview")
+      ._("State", appAttempt.getAppAttemptState())
+      ._(
+        "Master Container",
+        appAttempt.getAmContainerId() == null ? "#" : root_url("container",
+          appAttempt.getAmContainerId()),
+        String.valueOf(appAttempt.getAmContainerId()))
+      ._("Node:", node)
+      ._(
+        "Tracking URL:",
+        appAttempt.getTrackingUrl() == null ? "#" : root_url(appAttempt
+          .getTrackingUrl()), "History")
+      ._("Diagnostics Info:", appAttempt.getDiagnosticsInfo());
 
     html._(InfoBlock.class);
 
@@ -109,54 +111,49 @@ public class AppAttemptBlock extends Htm
     try {
       containers = appContext.getContainers(appAttemptId).values();
     } catch (IOException e) {
-      html.p()._("Sorry, Failed to get containers for application attempt"
-          + attemptid + ".")._();
+      html
+        .p()
+        ._(
+          "Sorry, Failed to get containers for application attempt" + attemptid
+              + ".")._();
       return;
     }
-    
+
     // Container Table
-    TBODY<TABLE<Hamlet>> tbody = html.
-        table("#containers").
-        thead().
-        tr().
-        th(".id", "Container ID").
-        th(".node", "Node").
-        th(".exitstatus", "Container Exit Status").
-        th(".logs", "Logs")._()._().
-        tbody();
+    TBODY<TABLE<Hamlet>> tbody =
+        html.table("#containers").thead().tr().th(".id", "Container ID")
+          .th(".node", "Node").th(".exitstatus", "Container Exit Status")
+          .th(".logs", "Logs")._()._().tbody();
 
     StringBuilder containersTableData = new StringBuilder("[\n");
     for (ContainerReport containerReport : containers) {
       String logURL = containerReport.getLogUrl();
       logURL = getPartUrl(logURL, "log");
       ContainerInfo container = new ContainerInfo(containerReport);
-      // ConatinerID numerical value parsed by parseHadoopID in yarn.dt.plugins.js
+      // ConatinerID numerical value parsed by parseHadoopID in
+      // yarn.dt.plugins.js
       containersTableData
-          .append("[\"<a href='")
-          .append(url("container", container.getContainerId()))
-          .append("'>")
-          .append(container.getContainerId())
-          .append("</a>\",\"<a href='")
-          .append(container.getAssignedNodeId())
-          .append("'>")
-          .append(StringEscapeUtils.escapeJavaScript(
-              StringEscapeUtils.escapeHtml(container.getAssignedNodeId())))
-          .append("</a>\",\"")
-          .append(container.getContainerExitStatus())
-          .append("\",\"<a href='")
-          .append(logURL == null ? "#" : url(logURL))
-          .append("'>")
-          .append(logURL == null ? "N/A" : "Logs")
-          .append("</a>\"],\n");
+        .append("[\"<a href='")
+        .append(url("container", container.getContainerId()))
+        .append("'>")
+        .append(container.getContainerId())
+        .append("</a>\",\"<a href='")
+        .append(container.getAssignedNodeId())
+        .append("'>")
+        .append(
+          StringEscapeUtils.escapeJavaScript(StringEscapeUtils
+            .escapeHtml(container.getAssignedNodeId()))).append("</a>\",\"")
+        .append(container.getContainerExitStatus()).append("\",\"<a href='")
+        .append(logURL == null ? "#" : url(logURL)).append("'>")
+        .append(logURL == null ? "N/A" : "Logs").append("</a>\"],\n");
     }
     if (containersTableData.charAt(containersTableData.length() - 2) == ',') {
       containersTableData.delete(containersTableData.length() - 2,
-          containersTableData.length() - 1);
+        containersTableData.length() - 1);
     }
     containersTableData.append("]");
-    html.script().$type("text/javascript").
-        _("var containersTableData=" + containersTableData)._();
-
+    html.script().$type("text/javascript")
+      ._("var containersTableData=" + containersTableData)._();
 
     tbody._()._();
   }

Modified: hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppBlock.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppBlock.java?rev=1559004&r1=1559003&r2=1559004&view=diff
==============================================================================
--- hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppBlock.java (original)
+++ hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppBlock.java Fri Jan 17 03:26:53 2014
@@ -76,8 +76,7 @@ public class AppBlock extends HtmlBlock 
     try {
       appReport = appContext.getApplication(appID);
     } catch (IOException e) {
-      String message =
-          "Failed to read the application " + appID + ".";
+      String message = "Failed to read the application " + appID + ".";
       LOG.error(message, e);
       html.p()._(message)._();
       return;
@@ -90,19 +89,20 @@ public class AppBlock extends HtmlBlock 
 
     setTitle(join("Application ", aid));
 
-    info("Application Overview").
-        _("User:", app.getUser()).
-        _("Name:", app.getName()).
-        _("Application Type:", app.getType()).
-        _("State:", app.getAppState()).
-        _("FinalStatus:", app.getFinalAppStatus()).
-        _("Started:", Times.format(app.getStartedTime())).
-        _("Elapsed:", StringUtils.formatTime(
-            Times.elapsed(app.getStartedTime(), app.getFinishedTime()))).
-        _("Tracking URL:",
-            app.getTrackingUrl() == null ? "#" : root_url(app.getTrackingUrl()),
-            "History").
-        _("Diagnostics:", app.getDiagnosticsInfo());
+    info("Application Overview")
+      ._("User:", app.getUser())
+      ._("Name:", app.getName())
+      ._("Application Type:", app.getType())
+      ._("State:", app.getAppState())
+      ._("FinalStatus:", app.getFinalAppStatus())
+      ._("Started:", Times.format(app.getStartedTime()))
+      ._(
+        "Elapsed:",
+        StringUtils.formatTime(Times.elapsed(app.getStartedTime(),
+          app.getFinishedTime())))
+      ._("Tracking URL:",
+        app.getTrackingUrl() == null ? "#" : root_url(app.getTrackingUrl()),
+        "History")._("Diagnostics:", app.getDiagnosticsInfo());
 
     html._(InfoBlock.class);
 
@@ -118,23 +118,19 @@ public class AppBlock extends HtmlBlock 
     }
 
     // Application Attempt Table
-    TBODY<TABLE<Hamlet>> tbody = html.
-        table("#attempts").
-        thead().
-        tr().
-        th(".id", "Attempt ID").
-        th(".started", "Started").
-        th(".node", "Node").
-        th(".logs", "Logs")._()._().
-        tbody();
+    TBODY<TABLE<Hamlet>> tbody =
+        html.table("#attempts").thead().tr().th(".id", "Attempt ID")
+          .th(".started", "Started").th(".node", "Node").th(".logs", "Logs")
+          ._()._().tbody();
 
     StringBuilder attemptsTableData = new StringBuilder("[\n");
     for (ApplicationAttemptReport appAttemptReport : attempts) {
       AppAttemptInfo appAttempt = new AppAttemptInfo(appAttemptReport);
       ContainerReport containerReport;
       try {
-        containerReport = appContext.getAMContainer(appAttemptReport
-            .getApplicationAttemptId());
+        containerReport =
+            appContext.getAMContainer(appAttemptReport
+              .getApplicationAttemptId());
       } catch (IOException e) {
         String message =
             "Failed to read the AM container of the application attempt "
@@ -149,41 +145,40 @@ public class AppBlock extends HtmlBlock 
         ContainerInfo container = new ContainerInfo(containerReport);
         startTime = container.getStartedTime();
         logsLink = containerReport.getLogUrl();
-        logsLink = getPartUrl(logsLink,"log");
+        logsLink = getPartUrl(logsLink, "log");
       }
       String nodeLink = null;
       if (appAttempt.getHost() != null && appAttempt.getRpcPort() >= 0
           && appAttempt.getRpcPort() < 65536) {
         nodeLink = appAttempt.getHost() + ":" + appAttempt.getRpcPort();
       }
-      // AppAttemptID numerical value parsed by parseHadoopID in yarn.dt.plugins.js
+      // AppAttemptID numerical value parsed by parseHadoopID in
+      // yarn.dt.plugins.js
       attemptsTableData
-          .append("[\"<a href='")
-          .append(url("appattempt", appAttempt.getAppAttemptId()))
-          .append("'>")
-          .append(appAttempt.getAppAttemptId())
-          .append("</a>\",\"")
-          .append(startTime)
-          .append("\",\"<a href='")
-          .append(nodeLink == null ? "#" : url(HttpConfig.getSchemePrefix(),
-              nodeLink))
-          .append("'>")
-          .append(nodeLink == null ? "N/A" : StringEscapeUtils.escapeJavaScript(
-              StringEscapeUtils.escapeHtml(nodeLink)))
-          .append("</a>\",\"<a href='")
-          .append(logsLink == null ? "#" : url(logsLink))
-          .append("'>")
-          .append(nodeLink == null ? "N/A" : "Logs")
-          .append("</a>\"],\n");
+        .append("[\"<a href='")
+        .append(url("appattempt", appAttempt.getAppAttemptId()))
+        .append("'>")
+        .append(appAttempt.getAppAttemptId())
+        .append("</a>\",\"")
+        .append(startTime)
+        .append("\",\"<a href='")
+        .append(
+          nodeLink == null ? "#" : url(HttpConfig.getSchemePrefix(), nodeLink))
+        .append("'>")
+        .append(
+          nodeLink == null ? "N/A" : StringEscapeUtils
+            .escapeJavaScript(StringEscapeUtils.escapeHtml(nodeLink)))
+        .append("</a>\",\"<a href='")
+        .append(logsLink == null ? "#" : url(logsLink)).append("'>")
+        .append(nodeLink == null ? "N/A" : "Logs").append("</a>\"],\n");
     }
     if (attemptsTableData.charAt(attemptsTableData.length() - 2) == ',') {
       attemptsTableData.delete(attemptsTableData.length() - 2,
-          attemptsTableData.length() - 1);
+        attemptsTableData.length() - 1);
     }
     attemptsTableData.append("]");
-    html.script().$type("text/javascript").
-        _("var attemptsTableData=" + attemptsTableData)._();
-
+    html.script().$type("text/javascript")
+      ._("var attemptsTableData=" + attemptsTableData)._();
 
     tbody._()._();
   }

Modified: hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppsBlock.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppsBlock.java?rev=1559004&r1=1559003&r2=1559004&view=diff
==============================================================================
--- hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppsBlock.java (original)
+++ hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppsBlock.java Fri Jan 17 03:26:53 2014
@@ -53,22 +53,13 @@ public class AppsBlock extends HtmlBlock
   public void render(Block html) {
     setTitle("Applications");
 
-    TBODY<TABLE<Hamlet>> tbody = html.
-        table("#apps").
-        thead().
-        tr().
-        th(".id", "ID").
-        th(".user", "User").
-        th(".name", "Name").
-        th(".type", "Application Type").
-        th(".queue", "Queue").
-        th(".starttime", "StartTime").
-        th(".finishtime", "FinishTime").
-        th(".state", "State").
-        th(".finalstatus", "FinalStatus").
-        th(".progress", "Progress").
-        th(".ui", "Tracking UI")._()._().
-        tbody();
+    TBODY<TABLE<Hamlet>> tbody =
+        html.table("#apps").thead().tr().th(".id", "ID").th(".user", "User")
+          .th(".name", "Name").th(".type", "Application Type")
+          .th(".queue", "Queue").th(".starttime", "StartTime")
+          .th(".finishtime", "FinishTime").th(".state", "State")
+          .th(".finalstatus", "FinalStatus").th(".progress", "Progress")
+          .th(".ui", "Tracking UI")._()._().tbody();
     Collection<YarnApplicationState> reqAppStates = null;
     String reqStateString = $(APP_STATE);
     if (reqStateString != null && !reqStateString.isEmpty()) {
@@ -83,8 +74,7 @@ public class AppsBlock extends HtmlBlock
     try {
       appReports = appContext.getAllApplications().values();
     } catch (IOException e) {
-      String message =
-          "Failed to read the applications.";
+      String message = "Failed to read the applications.";
       LOG.error(message, e);
       html.p()._(message)._();
       return;
@@ -99,51 +89,53 @@ public class AppsBlock extends HtmlBlock
       String percent = String.format("%.1f", app.getProgress());
       // AppID numerical value parsed by parseHadoopID in yarn.dt.plugins.js
       appsTableData
-          .append("[\"<a href='")
-          .append(url("app", app.getAppId()))
-          .append("'>")
-          .append(app.getAppId())
-          .append("</a>\",\"")
-          .append(
-              StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(
-                  app.getUser())))
-          .append("\",\"")
-          .append(
-              StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(
-                  app.getName())))
-          .append("\",\"")
-          .append(
-              StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(
-                  app.getType())))
-          .append("\",\"")
-          .append(
-              StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(
-                  app.getQueue()))).append("\",\"")
-          .append(app.getStartedTime()).append("\",\"")
-          .append(app.getFinishedTime()).append("\",\"")
-          .append(app.getAppState()).append("\",\"")
-          .append(app.getFinalAppStatus()).append("\",\"")
-          // Progress bar
-          .append("<br title='").append(percent)
-          .append("'> <div class='").append(C_PROGRESSBAR).append("' title='")
-          .append(join(percent, '%')).append("'> ").append("<div class='")
-          .append(C_PROGRESSBAR_VALUE).append("' style='")
-          .append(join("width:", percent, '%')).append("'> </div> </div>")
-          .append("\",\"<a href='");
+        .append("[\"<a href='")
+        .append(url("app", app.getAppId()))
+        .append("'>")
+        .append(app.getAppId())
+        .append("</a>\",\"")
+        .append(
+          StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(app
+            .getUser())))
+        .append("\",\"")
+        .append(
+          StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(app
+            .getName())))
+        .append("\",\"")
+        .append(
+          StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(app
+            .getType())))
+        .append("\",\"")
+        .append(
+          StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(app
+            .getQueue()))).append("\",\"").append(app.getStartedTime())
+        .append("\",\"").append(app.getFinishedTime())
+        .append("\",\"")
+        .append(app.getAppState())
+        .append("\",\"")
+        .append(app.getFinalAppStatus())
+        .append("\",\"")
+        // Progress bar
+        .append("<br title='").append(percent).append("'> <div class='")
+        .append(C_PROGRESSBAR).append("' title='").append(join(percent, '%'))
+        .append("'> ").append("<div class='").append(C_PROGRESSBAR_VALUE)
+        .append("' style='").append(join("width:", percent, '%'))
+        .append("'> </div> </div>").append("\",\"<a href='");
 
-      String trackingURL = app.getTrackingUrl() == null ? "#" : app.getTrackingUrl();
+      String trackingURL =
+          app.getTrackingUrl() == null ? "#" : app.getTrackingUrl();
 
-      appsTableData.append(trackingURL).append("'>")
-          .append("History").append("</a>\"],\n");
+      appsTableData.append(trackingURL).append("'>").append("History")
+        .append("</a>\"],\n");
 
     }
     if (appsTableData.charAt(appsTableData.length() - 2) == ',') {
       appsTableData.delete(appsTableData.length() - 2,
-          appsTableData.length() - 1);
+        appsTableData.length() - 1);
     }
     appsTableData.append("]");
-    html.script().$type("text/javascript").
-        _("var appsTableData=" + appsTableData)._();
+    html.script().$type("text/javascript")
+      ._("var appsTableData=" + appsTableData)._();
 
     tbody._()._();
   }

Modified: hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ContainerBlock.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ContainerBlock.java?rev=1559004&r1=1559003&r2=1559004&view=diff
==============================================================================
--- hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ContainerBlock.java (original)
+++ hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ContainerBlock.java Fri Jan 17 03:26:53 2014
@@ -77,25 +77,28 @@ public class ContainerBlock extends Html
       puts("Container not found: " + containerid);
       return;
     }
-    
+
     ContainerInfo container = new ContainerInfo(containerReport);
     String logURL = containerReport.getLogUrl();
-    logURL = getPartUrl(logURL,"log");
+    logURL = getPartUrl(logURL, "log");
     setTitle(join("Container ", containerid));
 
-    info("Container Overview").
-    _("State:", container.getContainerState()).
-    _("Exit Status:", container.getContainerExitStatus()).
-    _("Node:", container.getAssignedNodeId()).
-    _("Priority:", container.getPriority()).
-    _("Started:", Times.format(container.getStartedTime())).
-    _("Elapsed:", StringUtils.formatTime(
-        Times.elapsed(container.getStartedTime(),
-            container.getFinishedTime()))).
-    _("Resource:", container.getAllocatedMB() + " Memory, " +
-        container.getAllocatedVCores() + " VCores").
-    _("Logs:", logURL == null ? "#" : url(logURL), "Logs").
-    _("Diagnostics:", container.getDiagnosticsInfo());
+    info("Container Overview")
+      ._("State:", container.getContainerState())
+      ._("Exit Status:", container.getContainerExitStatus())
+      ._("Node:", container.getAssignedNodeId())
+      ._("Priority:", container.getPriority())
+      ._("Started:", Times.format(container.getStartedTime()))
+      ._(
+        "Elapsed:",
+        StringUtils.formatTime(Times.elapsed(container.getStartedTime(),
+          container.getFinishedTime())))
+      ._(
+        "Resource:",
+        container.getAllocatedMB() + " Memory, "
+            + container.getAllocatedVCores() + " VCores")
+      ._("Logs:", logURL == null ? "#" : url(logURL), "Logs")
+      ._("Diagnostics:", container.getDiagnosticsInfo());
 
     html._(InfoBlock.class);
   }

Modified: hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java?rev=1559004&r1=1559003&r2=1559004&view=diff
==============================================================================
--- hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java (original)
+++ hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java Fri Jan 17 03:26:53 2014
@@ -55,19 +55,10 @@ public class WebServices {
     this.appContext = appContext;
   }
 
-  public AppsInfo getApps(
-      HttpServletRequest req,
-      HttpServletResponse res,
-      String stateQuery,
-      Set<String> statesQuery,
-      String finalStatusQuery,
-      String userQuery,
-      String queueQuery,
-      String count,
-      String startedBegin,
-      String startedEnd,
-      String finishBegin,
-      String finishEnd,
+  public AppsInfo getApps(HttpServletRequest req, HttpServletResponse res,
+      String stateQuery, Set<String> statesQuery, String finalStatusQuery,
+      String userQuery, String queueQuery, String count, String startedBegin,
+      String startedEnd, String finishBegin, String finishEnd,
       Set<String> applicationTypes) {
     long num = 0;
     boolean checkCount = false;
@@ -107,7 +98,7 @@ public class WebServices {
     }
     if (sBegin > sEnd) {
       throw new BadRequestException(
-          "startedTimeEnd must be greater than startTimeBegin");
+        "startedTimeEnd must be greater than startTimeBegin");
     }
 
     if (finishBegin != null && !finishBegin.isEmpty()) {
@@ -126,7 +117,7 @@ public class WebServices {
     }
     if (fBegin > fEnd) {
       throw new BadRequestException(
-          "finishTimeEnd must be greater than finishTimeBegin");
+        "finishTimeEnd must be greater than finishTimeBegin");
     }
 
     Set<String> appTypes = parseQueries(applicationTypes, false);
@@ -156,14 +147,15 @@ public class WebServices {
         break;
       }
 
-      if (checkAppStates && !appStates.contains(
-          appReport.getYarnApplicationState().toString().toLowerCase())) {
+      if (checkAppStates
+          && !appStates.contains(appReport.getYarnApplicationState().toString()
+            .toLowerCase())) {
         continue;
       }
       if (finalStatusQuery != null && !finalStatusQuery.isEmpty()) {
         FinalApplicationStatus.valueOf(finalStatusQuery);
         if (!appReport.getFinalApplicationStatus().toString()
-            .equalsIgnoreCase(finalStatusQuery)) {
+          .equalsIgnoreCase(finalStatusQuery)) {
           continue;
         }
       }
@@ -177,19 +169,18 @@ public class WebServices {
           continue;
         }
       }
-      if (checkAppTypes && !appTypes.contains(
-          appReport.getApplicationType().trim().toLowerCase())) {
+      if (checkAppTypes
+          && !appTypes.contains(appReport.getApplicationType().trim()
+            .toLowerCase())) {
         continue;
       }
 
       if (checkStart
-          && (appReport.getStartTime() < sBegin ||
-          appReport.getStartTime() > sEnd)) {
+          && (appReport.getStartTime() < sBegin || appReport.getStartTime() > sEnd)) {
         continue;
       }
       if (checkEnd
-          && (appReport.getFinishTime() < fBegin ||
-          appReport.getFinishTime() > fEnd)) {
+          && (appReport.getFinishTime() < fBegin || appReport.getFinishTime() > fEnd)) {
         continue;
       }
       AppInfo app = new AppInfo(appReport);
@@ -200,8 +191,8 @@ public class WebServices {
     return allApps;
   }
 
-  public AppInfo getApp(
-      HttpServletRequest req, HttpServletResponse res, String appId) {
+  public AppInfo getApp(HttpServletRequest req, HttpServletResponse res,
+      String appId) {
     ApplicationId id = parseApplicationId(appId);
     ApplicationReport app = null;
     try {
@@ -215,8 +206,8 @@ public class WebServices {
     return new AppInfo(app);
   }
 
-  public AppAttemptsInfo getAppAttempts(
-      HttpServletRequest req, HttpServletResponse res, String appId) {
+  public AppAttemptsInfo getAppAttempts(HttpServletRequest req,
+      HttpServletResponse res, String appId) {
     ApplicationId id = parseApplicationId(appId);
     Collection<ApplicationAttemptReport> appAttemptReports = null;
     try {
@@ -233,9 +224,8 @@ public class WebServices {
     return appAttemptsInfo;
   }
 
-  public AppAttemptInfo getAppAttempt(
-      HttpServletRequest req, HttpServletResponse res,
-      String appId, String appAttemptId) {
+  public AppAttemptInfo getAppAttempt(HttpServletRequest req,
+      HttpServletResponse res, String appId, String appAttemptId) {
     ApplicationId aid = parseApplicationId(appId);
     ApplicationAttemptId aaid = parseApplicationAttemptId(appAttemptId);
     validateIds(aid, aaid, null);
@@ -246,15 +236,14 @@ public class WebServices {
       throw new WebApplicationException(e);
     }
     if (appAttempt == null) {
-      throw new NotFoundException(
-          "app attempt with id: " + appAttemptId + " not found");
+      throw new NotFoundException("app attempt with id: " + appAttemptId
+          + " not found");
     }
     return new AppAttemptInfo(appAttempt);
   }
 
-  public ContainersInfo getContainers(
-      HttpServletRequest req, HttpServletResponse res,
-      String appId, String appAttemptId) {
+  public ContainersInfo getContainers(HttpServletRequest req,
+      HttpServletResponse res, String appId, String appAttemptId) {
     ApplicationId aid = parseApplicationId(appId);
     ApplicationAttemptId aaid = parseApplicationAttemptId(appAttemptId);
     validateIds(aid, aaid, null);
@@ -272,9 +261,9 @@ public class WebServices {
     return containersInfo;
   }
 
-  public ContainerInfo getContainer(
-      HttpServletRequest req, HttpServletResponse res,
-      String appId, String appAttemptId, String containerId) {
+  public ContainerInfo getContainer(HttpServletRequest req,
+      HttpServletResponse res, String appId, String appAttemptId,
+      String containerId) {
     ApplicationId aid = parseApplicationId(appId);
     ApplicationAttemptId aaid = parseApplicationAttemptId(appAttemptId);
     ContainerId cid = parseContainerId(containerId);
@@ -286,18 +275,19 @@ public class WebServices {
       throw new WebApplicationException(e);
     }
     if (container == null) {
-      throw new NotFoundException(
-          "container with id: " + containerId + " not found");
+      throw new NotFoundException("container with id: " + containerId
+          + " not found");
     }
     return new ContainerInfo(container);
   }
+
   protected void init(HttpServletResponse response) {
     // clear content type
     response.setContentType(null);
   }
 
-  protected static Set<String> parseQueries(
-      Set<String> queries, boolean isState) {
+  protected static Set<String>
+      parseQueries(Set<String> queries, boolean isState) {
     Set<String> params = new HashSet<String>();
     if (!queries.isEmpty()) {
       for (String query : queries) {
@@ -313,9 +303,9 @@ public class WebServices {
                   YarnApplicationState[] stateArray =
                       YarnApplicationState.values();
                   String allAppStates = Arrays.toString(stateArray);
-                  throw new BadRequestException(
-                      "Invalid application-state " + paramStr.trim()
-                          + " specified. It should be one of " + allAppStates);
+                  throw new BadRequestException("Invalid application-state "
+                      + paramStr.trim() + " specified. It should be one of "
+                      + allAppStates);
                 }
               }
               params.add(paramStr.trim().toLowerCase());
@@ -341,8 +331,8 @@ public class WebServices {
   protected static ApplicationAttemptId parseApplicationAttemptId(
       String appAttemptId) {
     if (appAttemptId == null || appAttemptId.isEmpty()) {
-      throw new NotFoundException(
-          "appAttemptId, " + appAttemptId + ", is empty or null");
+      throw new NotFoundException("appAttemptId, " + appAttemptId
+          + ", is empty or null");
     }
     ApplicationAttemptId aaid =
         ConverterUtils.toApplicationAttemptId(appAttemptId);
@@ -354,8 +344,8 @@ public class WebServices {
 
   protected static ContainerId parseContainerId(String containerId) {
     if (containerId == null || containerId.isEmpty()) {
-      throw new NotFoundException(
-          "containerId, " + containerId + ", is empty or null");
+      throw new NotFoundException("containerId, " + containerId
+          + ", is empty or null");
     }
     ContainerId cid = ConverterUtils.toContainerId(containerId);
     if (cid == null) {
@@ -365,8 +355,7 @@ public class WebServices {
   }
 
   protected void validateIds(ApplicationId appId,
-      ApplicationAttemptId appAttemptId,
-      ContainerId containerId) {
+      ApplicationAttemptId appAttemptId, ContainerId containerId) {
     if (!appAttemptId.getApplicationId().equals(appId)) {
       throw new NotFoundException("appId and appAttemptId don't match");
     }

Modified: hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/dao/AppAttemptsInfo.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/dao/AppAttemptsInfo.java?rev=1559004&r1=1559003&r2=1559004&view=diff
==============================================================================
--- hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/dao/AppAttemptsInfo.java (original)
+++ hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/dao/AppAttemptsInfo.java Fri Jan 17 03:26:53 2014
@@ -44,4 +44,3 @@ public class AppAttemptsInfo {
   }
 
 }
-

Modified: hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/RMApplicationHistoryWriter.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/RMApplicationHistoryWriter.java?rev=1559004&r1=1559003&r2=1559004&view=diff
==============================================================================
--- hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/RMApplicationHistoryWriter.java (original)
+++ hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/RMApplicationHistoryWriter.java Fri Jan 17 03:26:53 2014
@@ -63,8 +63,8 @@ import org.apache.hadoop.yarn.server.res
 @Unstable
 public class RMApplicationHistoryWriter extends CompositeService {
 
-  public static final Log LOG =
-      LogFactory.getLog(RMApplicationHistoryWriter.class);
+  public static final Log LOG = LogFactory
+    .getLog(RMApplicationHistoryWriter.class);
 
   private Dispatcher dispatcher;
   private ApplicationHistoryWriter writer;
@@ -75,27 +75,29 @@ public class RMApplicationHistoryWriter 
   }
 
   @Override
-  protected synchronized void serviceInit(
-      Configuration conf) throws Exception {
+  protected synchronized void serviceInit(Configuration conf) throws Exception {
 
-    historyServiceEnabled = conf.getBoolean(
-      YarnConfiguration.YARN_HISTORY_SERVICE_ENABLED,
-      YarnConfiguration.DEFAULT_YARN_HISTORY_SERVICE_ENABLED);
+    historyServiceEnabled =
+        conf.getBoolean(YarnConfiguration.YARN_HISTORY_SERVICE_ENABLED,
+          YarnConfiguration.DEFAULT_YARN_HISTORY_SERVICE_ENABLED);
 
     writer = createApplicationHistoryStore(conf);
     addIfService(writer);
 
     dispatcher = createDispatcher(conf);
-    dispatcher.register(
-        WritingHistoryEventType.class, new ForwardingEventHandler());
+    dispatcher.register(WritingHistoryEventType.class,
+      new ForwardingEventHandler());
     addIfService(dispatcher);
     super.serviceInit(conf);
   }
 
   protected Dispatcher createDispatcher(Configuration conf) {
-    MultiThreadedDispatcher dispatcher = new MultiThreadedDispatcher(conf.getInt(
-        YarnConfiguration.RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE,
-        YarnConfiguration.DEFAULT_RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE));
+    MultiThreadedDispatcher dispatcher =
+        new MultiThreadedDispatcher(
+          conf
+            .getInt(
+              YarnConfiguration.RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE,
+              YarnConfiguration.DEFAULT_RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE));
     dispatcher.setDrainEventsOnStop();
     return dispatcher;
   }
@@ -108,13 +110,13 @@ public class RMApplicationHistoryWriter 
       try {
         Class<? extends ApplicationHistoryStore> storeClass =
             conf.getClass(YarnConfiguration.RM_HISTORY_WRITER_CLASS,
-                NullApplicationHistoryStore.class,
-                ApplicationHistoryStore.class);
+              NullApplicationHistoryStore.class, ApplicationHistoryStore.class);
         return storeClass.newInstance();
       } catch (Exception e) {
-        String msg = "Could not instantiate ApplicationHistoryWriter: " +
-            conf.get(YarnConfiguration.RM_HISTORY_WRITER_CLASS,
-                NullApplicationHistoryStore.class.getName());
+        String msg =
+            "Could not instantiate ApplicationHistoryWriter: "
+                + conf.get(YarnConfiguration.RM_HISTORY_WRITER_CLASS,
+                  NullApplicationHistoryStore.class.getName());
         LOG.error(msg, e);
         throw new YarnRuntimeException(msg, e);
       }
@@ -155,7 +157,7 @@ public class RMApplicationHistoryWriter 
             (WritingApplicationAttemptStartEvent) event;
         try {
           writer.applicationAttemptStarted(waasEvent
-              .getApplicationAttemptStartData());
+            .getApplicationAttemptStartData());
           LOG.info("Stored the start data of application attempt "
               + waasEvent.getApplicationAttemptId());
         } catch (IOException e) {
@@ -168,12 +170,13 @@ public class RMApplicationHistoryWriter 
             (WritingApplicationAttemptFinishEvent) event;
         try {
           writer.applicationAttemptFinished(waafEvent
-              .getApplicationAttemptFinishData());
+            .getApplicationAttemptFinishData());
           LOG.info("Stored the finish data of application attempt "
               + waafEvent.getApplicationAttemptId());
         } catch (IOException e) {
-          LOG.error("Error when storing the finish data of application attempt "
-              + waafEvent.getApplicationAttemptId());
+          LOG
+            .error("Error when storing the finish data of application attempt "
+                + waafEvent.getApplicationAttemptId());
         }
         break;
       case CONTAINER_START:
@@ -209,21 +212,19 @@ public class RMApplicationHistoryWriter 
   @SuppressWarnings("unchecked")
   public void applicationStarted(RMApp app) {
     dispatcher.getEventHandler().handle(
-        new WritingApplicationStartEvent(app.getApplicationId(),
-            ApplicationStartData.newInstance(app.getApplicationId(),
-                app.getName(), app.getApplicationType(), app.getQueue(),
-                app.getUser(), app.getSubmitTime(), app.getStartTime())));
+      new WritingApplicationStartEvent(app.getApplicationId(),
+        ApplicationStartData.newInstance(app.getApplicationId(), app.getName(),
+          app.getApplicationType(), app.getQueue(), app.getUser(),
+          app.getSubmitTime(), app.getStartTime())));
   }
 
   @SuppressWarnings("unchecked")
   public void applicationFinished(RMApp app) {
     dispatcher.getEventHandler().handle(
-        new WritingApplicationFinishEvent(app.getApplicationId(),
-            ApplicationFinishData.newInstance(app.getApplicationId(),
-                app.getFinishTime(),
-                app.getDiagnostics().toString(),
-                app.getFinalApplicationStatus(),
-                app.createApplicationState())));
+      new WritingApplicationFinishEvent(app.getApplicationId(),
+        ApplicationFinishData.newInstance(app.getApplicationId(),
+          app.getFinishTime(), app.getDiagnostics().toString(),
+          app.getFinalApplicationStatus(), app.createApplicationState())));
   }
 
   @SuppressWarnings("unchecked")
@@ -277,8 +278,8 @@ public class RMApplicationHistoryWriter 
    * EventHandler implementation which forward events to HistoryWriter Making
    * use of it, HistoryWriter can avoid to have a public handle method
    */
-  private final class ForwardingEventHandler
-      implements EventHandler<WritingApplicationHistoryEvent> {
+  private final class ForwardingEventHandler implements
+      EventHandler<WritingApplicationHistoryEvent> {
 
     @Override
     public void handle(WritingApplicationHistoryEvent event) {
@@ -288,8 +289,8 @@ public class RMApplicationHistoryWriter 
   }
 
   @SuppressWarnings({ "rawtypes", "unchecked" })
-  protected static class MultiThreadedDispatcher
-      extends CompositeService implements Dispatcher {
+  protected static class MultiThreadedDispatcher extends CompositeService
+      implements Dispatcher {
 
     private List<AsyncDispatcher> dispatchers =
         new ArrayList<AsyncDispatcher>();

Modified: hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingHistoryEventType.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingHistoryEventType.java?rev=1559004&r1=1559003&r2=1559004&view=diff
==============================================================================
--- hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingHistoryEventType.java (original)
+++ hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingHistoryEventType.java Fri Jan 17 03:26:53 2014
@@ -18,12 +18,7 @@
 
 package org.apache.hadoop.yarn.server.resourcemanager.ahs;
 
-
 public enum WritingHistoryEventType {
-  APP_START,
-  APP_FINISH,
-  APP_ATTEMPT_START,
-  APP_ATTEMPT_FINISH,
-  CONTAINER_START,
-  CONTAINER_FINISH
+  APP_START, APP_FINISH, APP_ATTEMPT_START, APP_ATTEMPT_FINISH,
+  CONTAINER_START, CONTAINER_FINISH
 }
\ No newline at end of file

Modified: hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/TestRMApplicationHistoryWriter.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/TestRMApplicationHistoryWriter.java?rev=1559004&r1=1559003&r2=1559004&view=diff
==============================================================================
--- hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/TestRMApplicationHistoryWriter.java (original)
+++ hadoop/common/branches/YARN-321/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/TestRMApplicationHistoryWriter.java Fri Jan 17 03:26:53 2014
@@ -88,9 +88,12 @@ public class TestRMApplicationHistoryWri
 
       @Override
       protected Dispatcher createDispatcher(Configuration conf) {
-        MultiThreadedDispatcher dispatcher = new MultiThreadedDispatcher(conf.getInt(
-            YarnConfiguration.RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE,
-            YarnConfiguration.DEFAULT_RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE));
+        MultiThreadedDispatcher dispatcher =
+            new MultiThreadedDispatcher(
+              conf
+                .getInt(
+                  YarnConfiguration.RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE,
+                  YarnConfiguration.DEFAULT_RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE));
         dispatcher.setDrainEventsOnStop();
         return dispatcher;
       }
@@ -131,11 +134,11 @@ public class TestRMApplicationHistoryWri
     when(app.getStartTime()).thenReturn(1L);
     when(app.getFinishTime()).thenReturn(2L);
     when(app.getDiagnostics()).thenReturn(
-        new StringBuilder("test diagnostics info"));
+      new StringBuilder("test diagnostics info"));
     when(app.getFinalApplicationStatus()).thenReturn(
-        FinalApplicationStatus.UNDEFINED);
+      FinalApplicationStatus.UNDEFINED);
     when(app.createApplicationState())
-        .thenReturn(YarnApplicationState.FINISHED);
+      .thenReturn(YarnApplicationState.FINISHED);
     return app;
   }
 
@@ -146,26 +149,25 @@ public class TestRMApplicationHistoryWri
     when(appAttempt.getHost()).thenReturn("test host");
     when(appAttempt.getRpcPort()).thenReturn(-100);
     Container container = mock(Container.class);
-    when(container.getId()).thenReturn(
-        ContainerId.newInstance(appAttemptId, 1));
+    when(container.getId())
+      .thenReturn(ContainerId.newInstance(appAttemptId, 1));
     when(appAttempt.getMasterContainer()).thenReturn(container);
     when(appAttempt.getDiagnostics()).thenReturn("test diagnostics info");
     when(appAttempt.getTrackingUrl()).thenReturn("test url");
     when(appAttempt.getFinalApplicationStatus()).thenReturn(
-        FinalApplicationStatus.UNDEFINED);
+      FinalApplicationStatus.UNDEFINED);
     when(appAttempt.createApplicationAttemptState()).thenReturn(
-        YarnApplicationAttemptState.FINISHED);
+      YarnApplicationAttemptState.FINISHED);
     return appAttempt;
   }
 
-  private static RMContainer createRMContainer(
-      ContainerId containerId) {
+  private static RMContainer createRMContainer(ContainerId containerId) {
     RMContainer container = mock(RMContainer.class);
     when(container.getContainerId()).thenReturn(containerId);
     when(container.getAllocatedNode()).thenReturn(
-        NodeId.newInstance("test host", -100));
+      NodeId.newInstance("test host", -100));
     when(container.getAllocatedResource()).thenReturn(
-        Resource.newInstance(-1, -1));
+      Resource.newInstance(-1, -1));
     when(container.getAllocatedPriority()).thenReturn(Priority.UNDEFINED);
     when(container.getStartTime()).thenReturn(0L);
     when(container.getFinishTime()).thenReturn(1L);
@@ -210,22 +212,22 @@ public class TestRMApplicationHistoryWri
     Assert.assertEquals(2L, appHD.getFinishTime());
     Assert.assertEquals("test diagnostics info", appHD.getDiagnosticsInfo());
     Assert.assertEquals(FinalApplicationStatus.UNDEFINED,
-        appHD.getFinalApplicationStatus());
+      appHD.getFinalApplicationStatus());
     Assert.assertEquals(YarnApplicationState.FINISHED,
-        appHD.getYarnApplicationState());
+      appHD.getYarnApplicationState());
   }
 
   @Test
   public void testWriteApplicationAttempt() throws Exception {
-    RMAppAttempt appAttempt = createRMAppAttempt(
-        ApplicationAttemptId.newInstance(
-            ApplicationId.newInstance(0, 1), 1));
+    RMAppAttempt appAttempt =
+        createRMAppAttempt(ApplicationAttemptId.newInstance(
+          ApplicationId.newInstance(0, 1), 1));
     writer.applicationAttemptStarted(appAttempt);
     ApplicationAttemptHistoryData appAttemptHD = null;
     for (int i = 0; i < MAX_RETRIES; ++i) {
       appAttemptHD =
           store.getApplicationAttempt(ApplicationAttemptId.newInstance(
-              ApplicationId.newInstance(0, 1), 1));
+            ApplicationId.newInstance(0, 1), 1));
       if (appAttemptHD != null) {
         break;
       } else {
@@ -235,16 +237,15 @@ public class TestRMApplicationHistoryWri
     Assert.assertNotNull(appAttemptHD);
     Assert.assertEquals("test host", appAttemptHD.getHost());
     Assert.assertEquals(-100, appAttemptHD.getRPCPort());
-    Assert.assertEquals(
-        ContainerId.newInstance(ApplicationAttemptId.newInstance(
-            ApplicationId.newInstance(0, 1), 1), 1),
-        appAttemptHD.getMasterContainerId());
+    Assert.assertEquals(ContainerId.newInstance(
+      ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1), 1),
+      appAttemptHD.getMasterContainerId());
 
     writer.applicationAttemptFinished(appAttempt);
     for (int i = 0; i < MAX_RETRIES; ++i) {
       appAttemptHD =
           store.getApplicationAttempt(ApplicationAttemptId.newInstance(
-              ApplicationId.newInstance(0, 1), 1));
+            ApplicationId.newInstance(0, 1), 1));
       if (appAttemptHD.getYarnApplicationAttemptState() != null) {
         break;
       } else {
@@ -252,26 +253,26 @@ public class TestRMApplicationHistoryWri
       }
     }
     Assert.assertEquals("test diagnostics info",
-        appAttemptHD.getDiagnosticsInfo());
+      appAttemptHD.getDiagnosticsInfo());
     Assert.assertEquals("test url", appAttemptHD.getTrackingURL());
     Assert.assertEquals(FinalApplicationStatus.UNDEFINED,
-        appAttemptHD.getFinalApplicationStatus());
+      appAttemptHD.getFinalApplicationStatus());
     Assert.assertEquals(YarnApplicationAttemptState.FINISHED,
-        appAttemptHD.getYarnApplicationAttemptState());
+      appAttemptHD.getYarnApplicationAttemptState());
   }
 
   @Test
   public void testWriteContainer() throws Exception {
-    RMContainer container = createRMContainer(
-        ContainerId.newInstance(ApplicationAttemptId.newInstance(
-            ApplicationId.newInstance(0, 1), 1), 1));
+    RMContainer container =
+        createRMContainer(ContainerId.newInstance(
+          ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1),
+          1));
     writer.containerStarted(container);
     ContainerHistoryData containerHD = null;
     for (int i = 0; i < MAX_RETRIES; ++i) {
       containerHD =
-          store.getContainer(ContainerId.newInstance(
-              ApplicationAttemptId.newInstance(
-                  ApplicationId.newInstance(0, 1), 1), 1));
+          store.getContainer(ContainerId.newInstance(ApplicationAttemptId
+            .newInstance(ApplicationId.newInstance(0, 1), 1), 1));
       if (containerHD != null) {
         break;
       } else {
@@ -280,18 +281,17 @@ public class TestRMApplicationHistoryWri
     }
     Assert.assertNotNull(containerHD);
     Assert.assertEquals(NodeId.newInstance("test host", -100),
-        containerHD.getAssignedNode());
+      containerHD.getAssignedNode());
     Assert.assertEquals(Resource.newInstance(-1, -1),
-        containerHD.getAllocatedResource());
+      containerHD.getAllocatedResource());
     Assert.assertEquals(Priority.UNDEFINED, containerHD.getPriority());
     Assert.assertEquals(0L, container.getStartTime());
 
     writer.containerFinished(container);
     for (int i = 0; i < MAX_RETRIES; ++i) {
       containerHD =
-          store.getContainer(ContainerId.newInstance(
-              ApplicationAttemptId.newInstance(
-                  ApplicationId.newInstance(0, 1), 1), 1));
+          store.getContainer(ContainerId.newInstance(ApplicationAttemptId
+            .newInstance(ApplicationId.newInstance(0, 1), 1), 1));
       if (containerHD.getContainerState() != null) {
         break;
       } else {
@@ -299,11 +299,11 @@ public class TestRMApplicationHistoryWri
       }
     }
     Assert.assertEquals("test diagnostics info",
-        containerHD.getDiagnosticsInfo());
+      containerHD.getDiagnosticsInfo());
     Assert.assertEquals("test log url", containerHD.getLogURL());
     Assert.assertEquals(-1, containerHD.getContainerExitStatus());
     Assert.assertEquals(ContainerState.COMPLETE,
-        containerHD.getContainerState());
+      containerHD.getContainerState());
   }
 
   @Test
@@ -367,18 +367,23 @@ public class TestRMApplicationHistoryWri
           @Override
           public void applicationStarted(RMApp app) {
           }
+
           @Override
           public void applicationFinished(RMApp app) {
           }
+
           @Override
           public void applicationAttemptStarted(RMAppAttempt appAttempt) {
           }
+
           @Override
           public void applicationAttemptFinished(RMAppAttempt appAttempt) {
           }
+
           @Override
           public void containerStarted(RMContainer container) {
           }
+
           @Override
           public void containerFinished(RMContainer container) {
           }
@@ -410,17 +415,18 @@ public class TestRMApplicationHistoryWri
     am.registerAppAttempt();
 
     int request = 10000;
-    am.allocate("127.0.0.1" , 1024, request, 
-        new ArrayList<ContainerId>());
+    am.allocate("127.0.0.1", 1024, request, new ArrayList<ContainerId>());
     nm.nodeHeartbeat(true);
-    List<Container> allocated = am.allocate(new ArrayList<ResourceRequest>(),
-        new ArrayList<ContainerId>()).getAllocatedContainers();
+    List<Container> allocated =
+        am.allocate(new ArrayList<ResourceRequest>(),
+          new ArrayList<ContainerId>()).getAllocatedContainers();
     int waitCount = 0;
     int allocatedSize = allocated.size();
     while (allocatedSize < request && waitCount++ < 200) {
       Thread.sleep(100);
-      allocated = am.allocate(new ArrayList<ResourceRequest>(),
-          new ArrayList<ContainerId>()).getAllocatedContainers();
+      allocated =
+          am.allocate(new ArrayList<ResourceRequest>(),
+            new ArrayList<ContainerId>()).getAllocatedContainers();
       allocatedSize += allocated.size();
       nm.nodeHeartbeat(true);
     }
@@ -470,27 +476,28 @@ public class TestRMApplicationHistoryWri
             (WritingApplicationHistoryEvent) event;
         switch (ashEvent.getType()) {
           case APP_START:
-            incrementCounts(((WritingApplicationStartEvent) event).getApplicationId());
+            incrementCounts(((WritingApplicationStartEvent) event)
+              .getApplicationId());
             break;
           case APP_FINISH:
             incrementCounts(((WritingApplicationFinishEvent) event)
-                .getApplicationId());
+              .getApplicationId());
             break;
           case APP_ATTEMPT_START:
             incrementCounts(((WritingApplicationAttemptStartEvent) event)
-                .getApplicationAttemptId().getApplicationId());
+              .getApplicationAttemptId().getApplicationId());
             break;
           case APP_ATTEMPT_FINISH:
             incrementCounts(((WritingApplicationAttemptFinishEvent) event)
-                .getApplicationAttemptId().getApplicationId());
+              .getApplicationAttemptId().getApplicationId());
             break;
           case CONTAINER_START:
-            incrementCounts(((WritingContainerStartEvent) event).getContainerId()
-                .getApplicationAttemptId().getApplicationId());
+            incrementCounts(((WritingContainerStartEvent) event)
+              .getContainerId().getApplicationAttemptId().getApplicationId());
             break;
           case CONTAINER_FINISH:
-            incrementCounts(((WritingContainerFinishEvent) event).getContainerId()
-                .getApplicationAttemptId().getApplicationId());
+            incrementCounts(((WritingContainerFinishEvent) event)
+              .getContainerId().getApplicationAttemptId().getApplicationId());
             break;
         }
       }



Mime
View raw message