You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by st...@apache.org on 2014/10/23 12:36:42 UTC

[12/13] git commit: SLIDER-460 debug-level logging of exists actions

SLIDER-460 debug-level logging of exists actions


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/75030d23
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/75030d23
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/75030d23

Branch: refs/heads/feature/SLIDER-460-stderr
Commit: 75030d231896be7e8d0b24ad6f79052dbfe6bf53
Parents: e1f84c6
Author: Steve Loughran <st...@apache.org>
Authored: Thu Oct 23 10:39:35 2014 +0100
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Oct 23 11:35:55 2014 +0100

----------------------------------------------------------------------
 .../org/apache/slider/client/SliderClient.java  |  6 ++++--
 .../slider/client/SliderYarnClientImpl.java     | 21 +++++++++++++++++---
 2 files changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/75030d23/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
index 6ea305e..38ba827 100644
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
@@ -1740,7 +1740,7 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
     verifyBindingsDefined();
     SliderUtils.validateClusterName(name);
     boolean checkLive = args.live;
-    log.debug("actionExists({}, {})", name, checkLive);
+    log.debug("actionExists({}, {}, {})", name, checkLive, args.state);
 
     //initial probe for a cluster in the filesystem
     Path clusterDirectory = sliderFileSystem.buildClusterDirPath(name);
@@ -1764,6 +1764,7 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
     if (checkLive) {
       // the app exists, check that it is not in any terminated state
       YarnApplicationState appstate = instance.getYarnApplicationState();
+      log.debug(" current app state = {}", appstate);
       inDesiredState =
             appstate.ordinal() < YarnApplicationState.FINISHED.ordinal();
     } else {
@@ -1773,7 +1774,7 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
       YarnApplicationState desiredState =
           YarnApplicationState.valueOf(state);
       ApplicationReport foundInstance =
-          yarnClient.findClusterInInstanceList(userInstances, name, desiredState);
+          yarnClient.findAppInInstanceList(userInstances, name, desiredState);
       if (foundInstance != null) {
         // found in selected state: success
         inDesiredState = true;
@@ -1791,6 +1792,7 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
       log.debug("State {}", report);
       return EXIT_FALSE;
     } else {
+      log.debug("Application instance is in desired state");
       log.info("Application {} is {}\n{}", name,
           instance.getYarnApplicationState(), report);
       return EXIT_SUCCESS;

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/75030d23/slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java b/slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java
index c793bd1..a00f3b2 100644
--- a/slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java
+++ b/slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java
@@ -274,19 +274,34 @@ public class SliderYarnClientImpl extends YarnClientImpl {
     return found;
   }
 
-  public ApplicationReport findClusterInInstanceList(List<ApplicationReport> instances,
-                                                     String appname,
+  /**
+   * Find an app in the instance list in the desired state 
+   * @param instances instance list
+   * @param appname application name
+   * @param desiredState yarn state desired
+   * @return the match or null for none
+   */
+  public ApplicationReport findAppInInstanceList(List<ApplicationReport> instances,
+      String appname,
       YarnApplicationState desiredState) {
     ApplicationReport found = null;
     ApplicationReport foundAndLive = null;
+    log.debug("Searching {} records for instance name {} in state '{}'",
+        instances.size(), appname, desiredState);
     for (ApplicationReport app : instances) {
       if (app.getName().equals(appname)) {
-        if (app.getYarnApplicationState().equals(desiredState)) {
+
+        YarnApplicationState appstate =
+            app.getYarnApplicationState();
+        log.debug("app ID {} is in state {}", app.getApplicationId(), appstate);
+        if (appstate.equals(desiredState)) {
+          log.debug("match");
           return app;
         }
       }
     }
     // nothing found in desired state
+    log.debug("No match");
     return null;
   }