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/09/10 14:59:00 UTC

[12/19] git commit: SLIDER-418 sider version command fails if the config isn't valid

SLIDER-418 sider version command fails if the config isn't valid


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

Branch: refs/heads/develop
Commit: d51ce5a15dfcd8d00a317e1d459b3ac1b097a64f
Parents: a6526a1
Author: Steve Loughran <st...@apache.org>
Authored: Wed Sep 10 12:25:32 2014 +0100
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Sep 10 12:25:32 2014 +0100

----------------------------------------------------------------------
 .../org/apache/slider/client/SliderClient.java  | 37 ++++++++++++++------
 1 file changed, 27 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/d51ce5a1/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 606a53c..ef0e63c 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
@@ -196,9 +196,7 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
       SliderUtils.forceLogin();
       SliderUtils.initProcessSecurity(conf);
     }
-    //create the YARN client
-    yarnClient = new SliderYarnClientImpl();
-    addService(yarnClient);
+
 
     super.serviceInit(conf);
 
@@ -292,13 +290,7 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
     
     AbstractActionArgs coreAction = serviceArgs.getCoreAction();
     if (coreAction.getHadoopServicesRequired()) {
-      // validate the client
-      SliderUtils.validateSliderClientEnvironment(null);
-
-      //here the superclass is inited; getConfig returns a non-null value
-      sliderFileSystem = new SliderFileSystem(getConfig());
-      YARNRegistryClient =
-          new YARNRegistryClient(yarnClient, getUsername(), getConfig());
+      initHadoopBinding();
     }
     int exitCode = EXIT_SUCCESS;
     String clusterName = serviceArgs.getClusterName();
@@ -353,6 +345,31 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
 
     return exitCode;
   }
+
+  /**
+   * Perform everything needed to init the hadoop binding.
+   * This assumes that the service is already  in inited or started state
+   * @throws IOException
+   * @throws SliderException
+   */
+  protected void initHadoopBinding() throws IOException, SliderException {
+    // validate the client
+    SliderUtils.validateSliderClientEnvironment(null);
+    //create the YARN client
+    yarnClient = new SliderYarnClientImpl();
+    yarnClient.init(getConfig());
+    if (getServiceState() == STATE.STARTED) {
+      yarnClient.start();
+    }
+    addService(yarnClient);
+    // create the filesystem
+    sliderFileSystem = new SliderFileSystem(getConfig());
+
+    // and the registry
+    YARNRegistryClient =
+        new YARNRegistryClient(yarnClient, getUsername(), getConfig());
+  }
+
   /**
    * Delete the zookeeper node associated with the calling user and the cluster
    **/