ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srima...@apache.org
Subject git commit: AMBARI-7546. Slider View: Creating slider view should use labels, queue and log aggregation settings - no log-aggregations fix (srimanth)
Date Tue, 30 Sep 2014 20:23:10 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 11405289e -> 753fe29e5


AMBARI-7546. Slider View: Creating slider view should use labels, queue and log aggregation
settings - no log-aggregations fix (srimanth)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/753fe29e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/753fe29e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/753fe29e

Branch: refs/heads/trunk
Commit: 753fe29e555542208b388086b06537da19e2f635
Parents: 1140528
Author: Srimanth Gunturi <sgunturi@hortonworks.com>
Authored: Tue Sep 30 13:22:11 2014 -0700
Committer: Srimanth Gunturi <sgunturi@hortonworks.com>
Committed: Tue Sep 30 13:22:18 2014 -0700

----------------------------------------------------------------------
 .../slider/SliderAppsViewControllerImpl.java    | 40 +++++++++++++-------
 1 file changed, 26 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/753fe29e/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
index eff1359..795d7de 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
@@ -23,6 +23,7 @@ import java.io.FileOutputStream;
 import java.io.FilenameFilter;
 import java.io.IOException;
 import java.io.InputStream;
+import java.lang.reflect.UndeclaredThrowableException;
 import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -137,7 +138,7 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController
{
     }
   }
 
-  private <T> T invokeSliderClientRunnable(final SliderClientContextRunnable<T>
runnable) throws IOException, InterruptedException {
+  private <T> T invokeSliderClientRunnable(final SliderClientContextRunnable<T>
runnable) throws IOException, InterruptedException, YarnException {
     ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
     Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
     try {
@@ -151,19 +152,28 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController
{
       } else {
         sliderUser = UserGroupInformation.getBestUGI(null, getUserToRunAs());
       }
-      T value = sliderUser.doAs(
-          new PrivilegedExceptionAction<T>() {
-            @Override
-            public T run() throws Exception {
-              final SliderClient sliderClient = createSliderClient();
-              try{
-                return runnable.run(sliderClient);
-              }finally{
-                destroySliderClient(sliderClient);
+      try{
+        T value = sliderUser.doAs(
+            new PrivilegedExceptionAction<T>() {
+              @Override
+              public T run() throws Exception {
+                final SliderClient sliderClient = createSliderClient();
+                try{
+                  return runnable.run(sliderClient);
+                }finally{
+                  destroySliderClient(sliderClient);
+                }
               }
-            }
-          });
-      return value;
+            });
+        return value;
+      } catch (UndeclaredThrowableException e) {
+        Throwable cause = e.getCause();
+        if (cause instanceof YarnException) {
+          YarnException ye = (YarnException) cause;
+          throw ye;
+        }
+        throw e;
+      }
     } finally {
       Thread.currentThread().setContextClassLoader(currentClassLoader);
     }
@@ -782,7 +792,9 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController
{
     resourcesObj.addProperty("schema",
         "http://example.org/specification/v2.0.0");
     resourcesObj.add("metadata", new JsonObject());
-    resourcesObj.add("global", clientResourcesObj.get("global").getAsJsonObject());
+    resourcesObj.add("global",
+        clientResourcesObj.has("global") ? clientResourcesObj.get("global")
+            .getAsJsonObject() : new JsonObject());
     JsonObject componentsObj = new JsonObject();
     if (clientComponentsArray != null) {
       for (int i = 0; i < clientComponentsArray.size(); i++) {


Mime
View raw message