You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by sm...@apache.org on 2014/08/12 22:48:59 UTC

[6/9] git commit: SLIDER-307 command line --resopt options aren't being picked up

SLIDER-307 command line --resopt options aren't being picked up


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

Branch: refs/heads/feature/SLIDER-285_Restart_AM
Commit: f08b9b19ada1a108c8e942bed815dc02fd1836e5
Parents: 9d78d23
Author: Steve Loughran <st...@apache.org>
Authored: Tue Aug 12 13:25:01 2014 +0100
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Tue Aug 12 13:48:40 2014 -0700

----------------------------------------------------------------------
 .../org/apache/slider/client/SliderClient.java    |  7 +++----
 .../agent/standalone/TestBuildStandaloneAM.groovy | 18 +++++++++++++++---
 .../org/apache/slider/test/SliderTestUtils.groovy |  4 ++++
 3 files changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f08b9b19/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 677caae..03f78be 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
@@ -586,6 +586,7 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
 
     // resource component args
     appConf.merge(cmdLineResourceOptions);
+    resources.merge(cmdLineResourceOptions);
     resources.mergeComponents(buildInfo.getResourceCompOptionMap());
 
     builder.init(providerName, instanceDefinition);
@@ -1854,10 +1855,8 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
    * @throws IOException any problems loading -including a missing file
    */
   @VisibleForTesting
-  public AggregateConf loadPersistedClusterDescription(String clustername) throws
-                                                                           IOException,
-      SliderException,
-                                                                           LockAcquireFailedException {
+  public AggregateConf loadPersistedClusterDescription(String clustername)
+      throws IOException, SliderException, LockAcquireFailedException {
     Path clusterDirectory = sliderFileSystem.buildClusterDirPath(clustername);
     ConfPersister persister = new ConfPersister(sliderFileSystem, clusterDirectory);
     AggregateConf instanceDescription = new AggregateConf();

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f08b9b19/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestBuildStandaloneAM.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestBuildStandaloneAM.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestBuildStandaloneAM.groovy
index 653a751..0665a9a 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestBuildStandaloneAM.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestBuildStandaloneAM.groovy
@@ -33,6 +33,7 @@ import org.apache.slider.core.main.ServiceLauncher
 import org.junit.Test
 
 import static org.apache.slider.common.params.Arguments.ARG_COMP_OPT
+import static org.apache.slider.common.params.Arguments.ARG_RESOURCE_OPT
 import static org.apache.slider.common.params.Arguments.ARG_RES_COMP_OPT
 import static org.apache.slider.providers.agent.AgentKeys.SERVICE_NAME
 
@@ -51,7 +52,7 @@ class TestBuildStandaloneAM extends AgentMiniClusterTestBase {
         SliderActions.ACTION_BUILD,
         clustername,
         [:],
-        [],
+        [ARG_RESOURCE_OPT, "yarn.container.failure.window.years", "4"],
         true,
         false,
         agentDefOptions)
@@ -64,10 +65,19 @@ class TestBuildStandaloneAM extends AgentMiniClusterTestBase {
 
     //but the cluster is still there for the default
     assert 0 == sliderClient.actionExists(clustername, false)
-
+    
+    
+    
+    // verify the YARN registry doesn't know of it
     def serviceRegistryClient = sliderClient.YARNRegistryClient
     ApplicationReport report = serviceRegistryClient.findInstance(clustername)
     assert report == null;
+    
+    // verify that global resource options propagate from the CLI
+    def aggregateConf = sliderClient.loadPersistedClusterDescription(clustername)
+    def windowDays = aggregateConf.resourceOperations.globalOptions.getMandatoryOptionInt(
+        "yarn.container.failure.window.years")
+    assert 4 == windowDays
 
     //and a second attempt will fail as the cluster now exists
     try {
@@ -84,6 +94,8 @@ class TestBuildStandaloneAM extends AgentMiniClusterTestBase {
       assertExceptionDetails(e, SliderExitCodes.EXIT_INSTANCE_EXISTS, "")
     }
 
+    
+    
     //thaw time
     ServiceLauncher<SliderClient> l2 = thawCluster(clustername, [], true)
     SliderClient thawed = l2.service
@@ -95,7 +107,7 @@ class TestBuildStandaloneAM extends AgentMiniClusterTestBase {
   public void testUpdateCluster() throws Throwable {
     String clustername = createMiniCluster("", configuration, 1, true)
 
-    describe "verify that a build cluster can be updated"
+    describe "verify that a built cluster can be updated"
 
     ServiceLauncher<SliderClient> launcher = createOrBuildCluster(
         SliderActions.ACTION_BUILD,

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f08b9b19/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy b/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
index c5a8b36..3fc3e55 100644
--- a/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
@@ -480,6 +480,8 @@ class SliderTestUtils extends Assert {
       List args) {
     ServiceLauncher<SliderClient> serviceLauncher =
         new ServiceLauncher<SliderClient>(SliderClient.name);
+
+    log.debug("slider ${SliderUtils.join(args, " ", false)}")
     serviceLauncher.launchService(conf,
         toArray(args),
         false);
@@ -492,6 +494,8 @@ class SliderTestUtils extends Assert {
       Throwable {
     ServiceLauncher serviceLauncher =
         new ServiceLauncher(serviceClass.name);
+    log.debug("slider ${SliderUtils.join(args, " ", false)}")
+
     serviceLauncher.launchService(conf,
         toArray(args),
         false);