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/88a2802c Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/88a2802c Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/88a2802c Branch: refs/heads/develop Commit: 88a2802c908d854c49c97afca78f49e2f2c0d2d0 Parents: 9a47483 Author: Steve Loughran <ste...@apache.org> Authored: Tue Aug 12 13:25:01 2014 +0100 Committer: Steve Loughran <ste...@apache.org> Committed: Tue Aug 12 13:25:01 2014 +0100 ---------------------------------------------------------------------- .../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/88a2802c/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/88a2802c/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/88a2802c/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);