You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by th...@apache.org on 2015/09/25 20:16:38 UTC

[1/2] incubator-apex-core git commit: APEX-147 added more error info when getting the web service and ignore only FileNotFoundException when trying to get permission info

Repository: incubator-apex-core
Updated Branches:
  refs/heads/devel-3 3d30347a0 -> 70d42741d


APEX-147 added more error info when getting the web service and ignore only FileNotFoundException when trying to get permission info


Project: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/commit/381ee948
Tree: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/tree/381ee948
Diff: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/diff/381ee948

Branch: refs/heads/devel-3
Commit: 381ee94854e264461e167357284c9ff5392fb871
Parents: 507fac3
Author: David Yan <da...@datatorrent.com>
Authored: Tue Sep 22 20:18:23 2015 -0700
Committer: David Yan <da...@datatorrent.com>
Committed: Fri Sep 25 09:29:25 2015 -0700

----------------------------------------------------------------------
 .../datatorrent/stram/client/StramAgent.java    | 23 ++++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/381ee948/engine/src/main/java/com/datatorrent/stram/client/StramAgent.java
----------------------------------------------------------------------
diff --git a/engine/src/main/java/com/datatorrent/stram/client/StramAgent.java b/engine/src/main/java/com/datatorrent/stram/client/StramAgent.java
index adb438a..2b5968c 100644
--- a/engine/src/main/java/com/datatorrent/stram/client/StramAgent.java
+++ b/engine/src/main/java/com/datatorrent/stram/client/StramAgent.java
@@ -15,6 +15,7 @@
  */
 package com.datatorrent.stram.client;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.Map;
 
@@ -26,6 +27,7 @@ import javax.ws.rs.core.UriBuilder;
 import com.sun.jersey.api.client.Client;
 import com.sun.jersey.api.client.ClientResponse;
 
+import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
 import org.slf4j.Logger;
@@ -318,6 +320,7 @@ public class StramAgent extends FSAgent
     return info == null ? getAppsRoot() + "/" + appId : info.appPath;
   }
 
+  // Note that this method only works if the app is running.  We might want to deprecate this method.
   public String getUser(String appid)
   {
     StramWebServicesInfo info = getWebServicesInfo(appid);
@@ -331,7 +334,16 @@ public class StramAgent extends FSAgent
     try {
       yarnClient.init(conf);
       yarnClient.start();
+
       ApplicationReport ar = yarnClient.getApplicationReport(ConverterUtils.toApplicationId(appId));
+      if (ar == null) {
+        LOG.warn("YARN does not have record for this application {}", appId);
+        return null;
+      } else if (ar.getYarnApplicationState() != YarnApplicationState.RUNNING) {
+        LOG.debug("Application {} is not running (state: {})", appId, ar.getYarnApplicationState());
+        return null;
+      }
+
       String trackingUrl = ar.getTrackingUrl();
       if (!trackingUrl.startsWith("http://")
               && !trackingUrl.startsWith("https://")) {
@@ -350,7 +362,7 @@ public class StramAgent extends FSAgent
       url += WebServices.PATH;
     }
     catch (Exception ex) {
-      //LOG.error("Caught exception when retrieving web services info", ex);
+      LOG.error("Caught exception when retrieving web services info", ex);
       return null;
     }
     finally {
@@ -412,11 +424,8 @@ public class StramAgent extends FSAgent
         is = fileSystem.open(new Path(appPath, "permissions.json"));
         permissionsInfo = new JSONObject(IOUtils.toString(is));
       }
-      catch (JSONException ex) {
-        LOG.error("Error reading from the permissions info. Ignoring", ex);
-      }
-      catch (IOException ex) {
-        // ignore
+      catch (FileNotFoundException ex) {
+        // ignore if file is not found
       }
       finally {
         IOUtils.closeQuietly(is);
@@ -424,7 +433,7 @@ public class StramAgent extends FSAgent
       return new StramWebServicesInfo(appMasterUrl, version, appPath, user, secToken, permissionsInfo);
     }
     catch (Exception ex) {
-      LOG.debug("Caught exception when retrieving web service info for app " + appId, ex);
+      LOG.warn("Caught exception when retrieving web service info for app {}", appId, ex);
       return null;
     }
   }


[2/2] incubator-apex-core git commit: Merge branch 'APEX-147' of https://github.com/davidyan74/incubator-apex-core into devel-3

Posted by th...@apache.org.
Merge branch 'APEX-147' of https://github.com/davidyan74/incubator-apex-core into devel-3


Project: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/commit/70d42741
Tree: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/tree/70d42741
Diff: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/diff/70d42741

Branch: refs/heads/devel-3
Commit: 70d42741d6cf057352be9bbc204e872c9c26ac47
Parents: 3d30347 381ee94
Author: Thomas Weise <th...@datatorrent.com>
Authored: Fri Sep 25 11:13:52 2015 -0700
Committer: Thomas Weise <th...@datatorrent.com>
Committed: Fri Sep 25 11:13:52 2015 -0700

----------------------------------------------------------------------
 .../datatorrent/stram/client/StramAgent.java    | 23 ++++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/70d42741/engine/src/main/java/com/datatorrent/stram/client/StramAgent.java
----------------------------------------------------------------------