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/21 11:32:01 UTC

git commit: SLIDER-426: escalate a stop to a forced kill if the app isn't running yet

Repository: incubator-slider
Updated Branches:
  refs/heads/develop 6a043e03d -> 0b0f7623d


SLIDER-426: escalate a stop to a forced kill if the app isn't running yet


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

Branch: refs/heads/develop
Commit: 0b0f7623d082a28d08bf914dcad6aba5d4a737d5
Parents: 6a043e0
Author: Steve Loughran <st...@apache.org>
Authored: Tue Oct 21 10:31:42 2014 +0100
Committer: Steve Loughran <st...@apache.org>
Committed: Tue Oct 21 10:31:42 2014 +0100

----------------------------------------------------------------------
 .../org/apache/slider/client/SliderClient.java   | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/0b0f7623/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 48fa6c8..41210bd 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
@@ -1895,13 +1895,22 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
                app.getYarnApplicationState());
       return EXIT_SUCCESS;
     }
+
+    // IPC request for a managed shutdown is only possible if the app is running.
+    // so we need to force kill if the app is accepted or submitted
+    if (!forcekill
+        && app.getYarnApplicationState().ordinal() < YarnApplicationState.RUNNING.ordinal()) {
+      log.info("Cluster {} is in a pre-running state {}. Force killing it", clustername,
+          app.getYarnApplicationState());
+      forcekill = true;
+    }
+
     LaunchedApplication application = new LaunchedApplication(yarnClient, app);
     applicationId = application.getApplicationId();
     
     if (forcekill) {
-      //escalating to forced kill
-      application.kill("Forced stop of " + clustername +
-                       ": " + text);
+      // escalating to forced kill
+      application.kill("Forced stop of " + clustername + ": " + text);
     } else {
       try {
         SliderClusterProtocol appMaster = connect(app);
@@ -1938,10 +1947,10 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
 
 // JDK7    } catch (YarnException | IOException e) {
     } catch (YarnException e) {
-      log.warn("Exception while waiting for the cluster {} to shut down: {}",
+      log.warn("Exception while waiting for the application {} to shut down: {}",
                clustername, e);
     } catch ( IOException e) {
-      log.warn("Exception while waiting for the cluster {} to shut down: {}",
+      log.warn("Exception while waiting for the application {} to shut down: {}",
                clustername, e);
     }