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 2015/11/20 22:07:46 UTC

[01/17] incubator-slider git commit: SLIDER-970: preamble —review and clean up existing functional tests, extracting resources to new file of constants, ResourcePaths.groovy

Repository: incubator-slider
Updated Branches:
  refs/heads/feature/SLIDER-82-pass-3.1 57638ff4e -> 4cc0d0dbd


SLIDER-970: preamble —review and clean up existing functional tests, extracting resources to new file of constants, ResourcePaths.groovy


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

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: f36c0dade1f8b6eb7547704f411f8a9811d4191f
Parents: 57638ff
Author: Steve Loughran <st...@apache.org>
Authored: Wed Nov 18 14:24:14 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Nov 18 14:24:14 2015 +0000

----------------------------------------------------------------------
 .../slider/client/SliderYarnClientImpl.java     |  2 +-
 .../appstate/TestMockAppStateAAPlacement.groovy |  5 +--
 .../apache/slider/funtest/ResourcePaths.groovy  | 37 ++++++++++++++++
 .../funtest/basic/ClusterConnectivityIT.groovy  |  9 ++--
 ...nentConfigsInAppConfigShowUpOnAgentIT.groovy |  3 --
 .../slider/funtest/basic/SyspropsIT.groovy      |  3 +-
 .../funtest/commands/CommandExitCodesIT.groovy  |  1 -
 .../funtest/commands/ListCommandIT.groovy       |  1 -
 .../funtest/commands/SimpleCommandsIT.groovy    |  2 -
 .../AMClientCertStoreRetrievalIT.groovy         | 27 ++++++------
 .../lifecycle/AgentClientInstallIT.groovy       |  7 ---
 .../lifecycle/AgentClusterLifecycleIT.groovy    |  3 +-
 .../funtest/lifecycle/AgentFailures2IT.groovy   |  4 +-
 .../funtest/lifecycle/AgentFailuresIT.groovy    |  4 +-
 .../AgentLaunchFailureIT_Disabled.groovy        |  3 +-
 .../funtest/lifecycle/AgentMinSleepIT.groovy    |  8 ----
 .../funtest/lifecycle/AgentPingSocketIT.groovy  | 17 +++-----
 .../funtest/lifecycle/AgentRegistryIT.groovy    |  4 +-
 .../lifecycle/AppsThroughAgentDemo.groovy       | 45 --------------------
 .../funtest/lifecycle/AppsThroughAgentIT.groovy |  3 +-
 .../AppsThroughAgentQueueAndLabelsIT.groovy     |  4 +-
 .../funtest/lifecycle/AppsUpgradeIT.groovy      |  4 +-
 .../lifecycle/ClusterBuildDestroyIT.groovy      |  3 --
 .../lifecycle/DemoAppsThroughAgent.groovy       | 45 ++++++++++++++++++++
 24 files changed, 123 insertions(+), 121 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/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 867603b..a315345 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
@@ -138,7 +138,7 @@ public class SliderYarnClientImpl extends YarnClientImpl {
 
     List<ApplicationReport> instances = listDeployedInstances(user);
     List<ApplicationReport> results =
-      new ArrayList<ApplicationReport>(instances.size());
+      new ArrayList<>(instances.size());
     for (ApplicationReport report : instances) {
       if (report.getName().equals(appname)) {
         results.add(report);

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAAPlacement.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAAPlacement.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAAPlacement.groovy
index 4eff059..f911515 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAAPlacement.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/appstate/TestMockAppStateAAPlacement.groovy
@@ -307,8 +307,7 @@ class TestMockAppStateAAPlacement extends BaseMockAppStateAATest
     def aaRole = lookupRole(MockFactory.AAROLE_2.name)
     def gpuRole = lookupRole(MockFactory.AAROLE_1_GPU.name)
     appState.reviewRequestAndReleaseNodes()
-    assert aaRole.isAntiAffinePlacement()
-    assert aaRole.isAARequestOutstanding()
-
+    assert aaRole.antiAffinePlacement
+    assert aaRole.AARequestOutstanding
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/ResourcePaths.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/ResourcePaths.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/ResourcePaths.groovy
new file mode 100644
index 0000000..c93753d
--- /dev/null
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/ResourcePaths.groovy
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.slider.funtest
+
+/**
+ * The various resources used for test runs
+ */
+interface ResourcePaths {
+
+  String SLIDER_CORE_TEST_SRC= "../slider-core/src/test"
+  String SLIDER_CORE_APP_PACKAGES = "$SLIDER_CORE_TEST_SRC/app_packages"
+  String COMMAND_LOG_RESOURCES = "$SLIDER_CORE_APP_PACKAGES/test_command_log/resources.json"
+  String COMMAND_LOG_RESOURCES_QUEUE_LABELS = "$SLIDER_CORE_APP_PACKAGES/test_command_log/resources_queue_labels.json"
+  String COMMAND_LOG_RESOURCES_NO_ROLE = "$SLIDER_CORE_APP_PACKAGES/test_command_log/resources_no_role.json"
+  String COMMAND_LOG_APPCONFIG_NO_HB = "$SLIDER_CORE_APP_PACKAGES/test_command_log/appConfig_no_hb.json"
+  String COMMAND_LOG_APPCONFIG_FAST_NO_REG = "$SLIDER_CORE_APP_PACKAGES/test_command_log/appConfig_fast_no_reg.json"
+
+  static String PING_RESOURCES = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/nc_ping_cmd/resources.json"
+  static String PING_META = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/nc_ping_cmd/metainfo.json"
+  static String PING_APPCONFIG = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/nc_ping_cmd/appConfig.json"
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/basic/ClusterConnectivityIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/basic/ClusterConnectivityIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/basic/ClusterConnectivityIT.groovy
index 9826e97..5d069bc 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/basic/ClusterConnectivityIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/basic/ClusterConnectivityIT.groovy
@@ -37,7 +37,6 @@ import org.junit.Test
  */
 class ClusterConnectivityIT extends CommandTestBase {
 
-
   public static final int CONNECT_TIMEOUT = 2000
 
   @Test
@@ -60,7 +59,7 @@ class ClusterConnectivityIT extends CommandTestBase {
     tuples.each {
       telnet(it.hostText, it.port)
     }
-    
+
   }
 
   @Test
@@ -73,7 +72,7 @@ class ClusterConnectivityIT extends CommandTestBase {
       telnet(rmAddr.hostName, rmAddr.port)
     }
   }
-  
+
   @Test
   public void testRMBinding() throws Throwable {
     SliderYarnClientImpl yarnClient = new SliderYarnClientImpl()
@@ -83,10 +82,10 @@ class ClusterConnectivityIT extends CommandTestBase {
           YarnConfiguration.RESOURCEMANAGER_CONNECT_MAX_WAIT_MS,5000)
       SLIDER_CONFIG.setInt(
           YarnConfiguration.RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS,50)
-      
+
       yarnClient.init(SLIDER_CONFIG)
       yarnClient.start();
-      def instances = yarnClient.listInstances("")
+      def instances = yarnClient.listDeployedInstances("")
       instances.each {it -> log.info("Instance $it.applicationId")}
     } finally {
       yarnClient.stop()

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/basic/ComponentConfigsInAppConfigShowUpOnAgentIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/basic/ComponentConfigsInAppConfigShowUpOnAgentIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/basic/ComponentConfigsInAppConfigShowUpOnAgentIT.groovy
index cf74bbf..91797f9 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/basic/ComponentConfigsInAppConfigShowUpOnAgentIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/basic/ComponentConfigsInAppConfigShowUpOnAgentIT.groovy
@@ -23,9 +23,6 @@ import groovy.util.logging.Slf4j
 
 import org.apache.slider.common.tools.SliderUtils
 import org.apache.slider.funtest.framework.AgentCommandTestBase
-import org.apache.slider.common.params.SliderActions
-import org.apache.slider.client.SliderClient
-import org.apache.slider.common.SliderExitCodes
 import org.apache.slider.funtest.framework.SliderShell
 import org.junit.After
 import org.junit.Before

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/basic/SyspropsIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/basic/SyspropsIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/basic/SyspropsIT.groovy
index 728920e..e53c875 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/basic/SyspropsIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/basic/SyspropsIT.groovy
@@ -36,11 +36,10 @@ import org.junit.Test
 @Slf4j
 class SyspropsIT extends SliderTestUtils{
 
-
   @Test
   public void testDumpSysprops() throws Throwable {
     def sysprops = System.properties
-    TreeSet<String> sorted = new TreeSet<String>();
+    TreeSet<String> sorted = new TreeSet<>();
     sysprops.keys().each { String it -> sorted.add(it)}
     sorted.each { String  key ->
       log.info("$key=\"${sysprops[key]}\"")

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandExitCodesIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandExitCodesIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandExitCodesIT.groovy
index 73912e6..666342e 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandExitCodesIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/CommandExitCodesIT.groovy
@@ -20,7 +20,6 @@ package org.apache.slider.funtest.commands
 
 import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
-import org.apache.slider.common.SliderExitCodes
 import org.apache.slider.core.main.LauncherExitCodes
 import org.apache.slider.funtest.framework.CommandTestBase
 import org.junit.Test

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/ListCommandIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/ListCommandIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/ListCommandIT.groovy
index 916117c..b378110 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/ListCommandIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/ListCommandIT.groovy
@@ -22,7 +22,6 @@ import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
 import org.apache.slider.core.main.LauncherExitCodes
 import org.apache.slider.funtest.framework.CommandTestBase
-import org.junit.BeforeClass
 import org.junit.Test
 
 @CompileStatic

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/SimpleCommandsIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/SimpleCommandsIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/SimpleCommandsIT.groovy
index 75d0634..e22c5f2 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/SimpleCommandsIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/commands/SimpleCommandsIT.groovy
@@ -20,9 +20,7 @@ package org.apache.slider.funtest.commands
 
 import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
-import org.apache.bigtop.itest.shell.Shell
 import org.apache.slider.funtest.framework.CommandTestBase
-import org.apache.slider.funtest.framework.SliderShell
 import org.apache.slider.common.params.SliderActions
 import org.junit.Test
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AMClientCertStoreRetrievalIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AMClientCertStoreRetrievalIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AMClientCertStoreRetrievalIT.groovy
index 950dc68..05adebd 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AMClientCertStoreRetrievalIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AMClientCertStoreRetrievalIT.groovy
@@ -33,7 +33,6 @@ import org.apache.slider.funtest.framework.AgentCommandTestBase
 import org.apache.slider.funtest.framework.FuntestProperties
 import org.apache.slider.funtest.framework.SliderShell
 import org.junit.After
-import org.junit.Assert
 import org.junit.Test
 
 import javax.net.ssl.TrustManager
@@ -47,7 +46,6 @@ import java.security.cert.Certificate
 import java.security.cert.CertificateException
 import java.security.cert.X509Certificate
 import com.google.common.io.Files
-import java.io.File
 
 @CompileStatic
 @Slf4j
@@ -107,7 +105,8 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
     String password = "welcome";
 
     // ensure file doesn't exist
-    new File(filename).delete();
+    def keystoreFile = new File(filename)
+    keystoreFile.delete();
 
     shell = slider(EXIT_SUCCESS,
                    [
@@ -118,7 +117,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
                        ARG_PASSWORD, password
                    ])
 
-    assert new File(filename).exists()
+    assert keystoreFile.exists()
 
     KeyStore keystore = loadKeystoreFromFile(filename, password.toCharArray())
 
@@ -126,7 +125,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
 
     filename = myTempDir.canonicalPath + File.separator + "test.truststore"
     // ensure file doesn't exist
-    new File(filename).delete();
+    keystoreFile.delete();
 
     shell = slider(EXIT_SUCCESS,
                    [
@@ -137,7 +136,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
                        ARG_PASSWORD, password
                    ])
 
-    assert new File(filename).exists()
+    assert keystoreFile.exists()
 
     KeyStore truststore = loadKeystoreFromFile(filename, password.toCharArray())
 
@@ -164,7 +163,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
     log.info("Created credential provider $providerString for test")
 
     // ensure file doesn't exist
-    new File(filename).delete();
+    keystoreFile.delete();
 
     shell = slider(EXIT_SUCCESS,
       [
@@ -176,7 +175,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
         ARG_PROVIDER, providerString
       ])
 
-    assert new File(filename).exists()
+    assert keystoreFile.exists()
 
     keystore = loadKeystoreFromFile(filename, password.toCharArray())
 
@@ -184,7 +183,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
 
     filename = myTempDir.canonicalPath + File.separator + "test.truststore"
     // ensure file doesn't exist
-    new File(filename).delete();
+    keystoreFile.delete();
 
     shell = slider(EXIT_SUCCESS,
       [
@@ -196,7 +195,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
         ARG_PROVIDER, providerString
       ])
 
-    assert new File(filename).exists()
+    assert keystoreFile.exists()
 
     truststore = loadKeystoreFromFile(filename, password.toCharArray())
 
@@ -207,7 +206,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
   private static void validateKeystore(KeyStore keystore) {
     Certificate certificate = keystore.getCertificate(
       keystore.aliases().nextElement());
-    Assert.assertNotNull(certificate);
+    assert certificate
 
     String hostname = InetAddress.localHost.canonicalHostName;
 
@@ -217,9 +216,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
       // Get subject
       Principal principal = x509cert.getSubjectDN();
       String subjectDn = principal.getName();
-      Assert.assertEquals("wrong DN",
-        "CN=" + hostname + ", OU=" + APPLICATION_NAME + ", OU=client",
-        subjectDn);
+      assert subjectDn == "CN=" + hostname + ", OU=" + APPLICATION_NAME + ", OU=client"
 
     }
   }
@@ -229,7 +226,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
     // obtain server cert
     Certificate certificate = keystore.getCertificate(
         keystore.aliases().nextElement());
-    Assert.assertNotNull(certificate);
+    assert certificate
 
     // validate keystore cert using trust store
       TrustManagerFactory trustManagerFactory =

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentClientInstallIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentClientInstallIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentClientInstallIT.groovy
index deb2d97..6d1f759 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentClientInstallIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentClientInstallIT.groovy
@@ -21,19 +21,12 @@ package org.apache.slider.funtest.lifecycle
 import groovy.io.FileType
 import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
-import org.apache.hadoop.yarn.api.records.YarnApplicationState
-import org.apache.slider.api.ClusterDescription
-import org.apache.slider.api.StatusKeys
-import org.apache.slider.client.SliderClient
 import org.apache.slider.common.SliderExitCodes
-import org.apache.slider.common.SliderXmlConfKeys
 import org.apache.slider.common.params.Arguments
 import org.apache.slider.common.params.SliderActions
 import org.apache.slider.funtest.framework.AgentCommandTestBase
 import org.apache.slider.funtest.framework.FuntestProperties
 import org.apache.slider.funtest.framework.SliderShell
-import org.junit.After
-import org.junit.Before
 import org.junit.Test
 
 @CompileStatic

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentClusterLifecycleIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentClusterLifecycleIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentClusterLifecycleIT.groovy
index ca9f71b..faeb0a1 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentClusterLifecycleIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentClusterLifecycleIT.groovy
@@ -28,6 +28,7 @@ import org.apache.slider.common.SliderExitCodes
 import org.apache.slider.common.SliderXmlConfKeys
 import org.apache.slider.common.params.Arguments
 import org.apache.slider.common.params.SliderActions
+import org.apache.slider.funtest.ResourcePaths
 import org.apache.slider.funtest.framework.AgentCommandTestBase
 import org.apache.slider.funtest.framework.FuntestProperties
 import org.apache.slider.funtest.framework.SliderShell
@@ -43,7 +44,7 @@ public class AgentClusterLifecycleIT extends AgentCommandTestBase
 
   static String CLUSTER = "test-agent-cluster-lifecycle"
 
-  static String APP_RESOURCE2 = "../slider-core/src/test/app_packages/test_command_log/resources_no_role.json"
+  static String APP_RESOURCE2 = ResourcePaths.COMMAND_LOG_RESOURCES_NO_ROLE
 
 
   @Before

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailures2IT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailures2IT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailures2IT.groovy
index 39b5d6c..d73eb76 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailures2IT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailures2IT.groovy
@@ -23,6 +23,7 @@ import groovy.util.logging.Slf4j
 import org.apache.slider.common.SliderExitCodes
 import org.apache.slider.common.params.Arguments
 import org.apache.slider.common.params.SliderActions
+import org.apache.slider.funtest.ResourcePaths
 import org.apache.slider.funtest.framework.AgentCommandTestBase
 import org.apache.slider.funtest.framework.FuntestProperties
 import org.apache.slider.funtest.framework.SliderShell
@@ -36,8 +37,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
 
   private static String COMMAND_LOGGER = "COMMAND_LOGGER"
   private static String APPLICATION_NAME = "two-container-fail-heartbeat"
-  private static String APP_TEMPLATE3 =
-    "../slider-core/src/test/app_packages/test_command_log/appConfig_no_hb.json"
+  private static String APP_TEMPLATE3 = ResourcePaths.COMMAND_LOG_APPCONFIG_NO_HB
 
 
   @After

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailuresIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailuresIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailuresIT.groovy
index 7d1be89..cfdff75 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailuresIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentFailuresIT.groovy
@@ -23,6 +23,7 @@ import groovy.util.logging.Slf4j
 import org.apache.slider.common.SliderExitCodes
 import org.apache.slider.common.params.Arguments
 import org.apache.slider.common.params.SliderActions
+import org.apache.slider.funtest.ResourcePaths
 import org.apache.slider.funtest.framework.AgentCommandTestBase
 import org.apache.slider.funtest.framework.FuntestProperties
 import org.apache.slider.funtest.framework.SliderShell
@@ -36,8 +37,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
 
   private static String COMMAND_LOGGER = "COMMAND_LOGGER"
   private static String APPLICATION_NAME = "one-container-fail-register"
-  private static String APP_TEMPLATE2 =
-    "../slider-core/src/test/app_packages/test_command_log/appConfig_fast_no_reg.json"
+  private static String APP_TEMPLATE2 = ResourcePaths.COMMAND_LOG_APPCONFIG_FAST_NO_REG
 
   @After
   public void destroyCluster() {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentLaunchFailureIT_Disabled.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentLaunchFailureIT_Disabled.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentLaunchFailureIT_Disabled.groovy
index 17eaf04..ee22360 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentLaunchFailureIT_Disabled.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentLaunchFailureIT_Disabled.groovy
@@ -21,6 +21,7 @@ package org.apache.slider.funtest.lifecycle
 import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
 import org.apache.slider.common.SliderXmlConfKeys
+import org.apache.slider.funtest.ResourcePaths
 import org.apache.slider.server.appmaster.SliderAppMaster
 
 import static org.apache.slider.api.InternalKeys.*
@@ -41,7 +42,7 @@ public class AgentLaunchFailureIT_Disabled extends AgentCommandTestBase
 
   static String CLUSTER = "test-agent-launchfail"
 
-  static String APP_RESOURCE2 = "../slider-core/src/test/app_packages/test_command_log/resources_no_role.json"
+  static String APP_RESOURCE2 = ResourcePaths.COMMAND_LOG_RESOURCES_NO_ROLE
 
   @Before
   public void prepareCluster() {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentMinSleepIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentMinSleepIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentMinSleepIT.groovy
index e7b0454..b69effa 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentMinSleepIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentMinSleepIT.groovy
@@ -20,18 +20,10 @@ package org.apache.slider.funtest.lifecycle
 
 import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
-import org.apache.hadoop.registry.client.binding.RegistryUtils
-import org.apache.hadoop.registry.client.types.Endpoint
-import org.apache.hadoop.registry.client.types.ServiceRecord
 import org.apache.hadoop.yarn.api.records.YarnApplicationState
 import org.apache.slider.common.SliderExitCodes
-import org.apache.slider.common.SliderKeys
-import org.apache.slider.common.SliderXmlConfKeys
 import org.apache.slider.common.params.Arguments
 import org.apache.slider.common.params.SliderActions
-import org.apache.slider.test.Outcome
-
-import static org.apache.slider.core.registry.info.CustomRegistryConstants.*
 import org.apache.slider.funtest.framework.AgentCommandTestBase
 import org.apache.slider.funtest.framework.FuntestProperties
 import org.apache.slider.funtest.framework.SliderShell

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentPingSocketIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentPingSocketIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentPingSocketIT.groovy
index ce2ed92..b10e792 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentPingSocketIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentPingSocketIT.groovy
@@ -22,18 +22,11 @@ import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
 import groovy.json.*
 import org.apache.hadoop.net.NetUtils
-import org.apache.hadoop.registry.client.binding.RegistryUtils
-import org.apache.hadoop.registry.client.types.Endpoint
-import org.apache.hadoop.registry.client.types.ServiceRecord
 import org.apache.hadoop.yarn.api.records.YarnApplicationState
 import org.apache.slider.common.SliderExitCodes
-import org.apache.slider.common.SliderKeys
-import org.apache.slider.common.SliderXmlConfKeys
 import org.apache.slider.common.params.Arguments
 import org.apache.slider.common.params.SliderActions
-import org.apache.slider.test.Outcome
-
-import static org.apache.slider.core.registry.info.CustomRegistryConstants.*
+import org.apache.slider.funtest.ResourcePaths
 import org.apache.slider.funtest.framework.AgentCommandTestBase
 import org.apache.slider.funtest.framework.FuntestProperties
 import org.apache.slider.funtest.framework.SliderShell
@@ -49,9 +42,9 @@ public class AgentPingSocketIT extends AgentCommandTestBase
 
   static String CLUSTER = "test-agent-ping-port"
 
-  static String APP_RESOURCE12 = "../slider-core/src/test/app_packages/test_min_pkg/nc_ping_cmd/resources.json"
-  static String APP_META12 = "../slider-core/src/test/app_packages/test_min_pkg/nc_ping_cmd/metainfo.json"
-  static String APP_TEMPLATE12 = "../slider-core/src/test/app_packages/test_min_pkg/nc_ping_cmd/appConfig.json"
+  static String APP_RESOURCE12 = ResourcePaths.PING_RESOURCES
+  static String APP_META12 = ResourcePaths.PING_META
+  static String APP_TEMPLATE12 = ResourcePaths.PING_APPCONFIG
 
 
   @Before
@@ -68,7 +61,7 @@ public class AgentPingSocketIT extends AgentCommandTestBase
   public void testAgentRegistry() throws Throwable {
     describe("Create a cluster using metainfo, resources, and appConfig that calls nc to listen on a port")
     assumeNotWindows()
-    def clusterpath = buildClusterPath(CLUSTER)
+    buildClusterPath(CLUSTER)
     File launchReportFile = createTempJsonFile();
 
     SliderShell shell = createSliderApplicationMinPkg(CLUSTER,

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentRegistryIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentRegistryIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentRegistryIT.groovy
index ff5e57e..7a03a05 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentRegistryIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentRegistryIT.groovy
@@ -28,6 +28,7 @@ import org.apache.slider.common.SliderExitCodes
 import org.apache.slider.common.SliderKeys
 import org.apache.slider.common.params.Arguments
 import org.apache.slider.common.params.SliderActions
+import org.apache.slider.funtest.ResourcePaths
 import org.apache.slider.test.Outcome
 
 import static org.apache.slider.core.registry.info.CustomRegistryConstants.*
@@ -46,8 +47,7 @@ public class AgentRegistryIT extends AgentCommandTestBase
 
   static String CLUSTER = "test-agent-registry"
 
-  static String APP_RESOURCE2 = "../slider-core/src/test/app_packages/test_command_log/resources_no_role.json"
-
+  static String APP_RESOURCE2 = ResourcePaths.COMMAND_LOG_RESOURCES_NO_ROLE
 
   @Before
   public void prepareCluster() {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentDemo.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentDemo.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentDemo.groovy
deleted file mode 100644
index 3dd7857..0000000
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentDemo.groovy
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.funtest.lifecycle
-
-import groovy.transform.CompileStatic
-import groovy.util.logging.Slf4j
-import org.apache.slider.common.SliderExitCodes
-import org.apache.slider.common.params.Arguments
-import org.apache.slider.common.params.SliderActions
-import org.apache.slider.funtest.framework.AgentCommandTestBase
-import org.apache.slider.funtest.framework.FuntestProperties
-import org.apache.slider.funtest.framework.SliderShell
-import org.junit.Before
-import org.junit.Test
-
-/**
- * For a quick demo of a slider app; this starts the apps through agent test but
- * neglects to tear it down afterwards
- */
-@CompileStatic
-@Slf4j
-public class AppsThroughAgentDemo extends AppsThroughAgentIT {
-
-  @Override
-  void destroyCluster() {
-//    super.destroyCluster()
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentIT.groovy
index 0db775b..060af5d 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentIT.groovy
@@ -76,7 +76,8 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
             application,
             ARG_COMPONENT,
             COMMAND_LOGGER,
-            "2"])
+            "2"
+        ])
 
     // sleep till the new instance starts
     sleep(1000 * 10)

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentQueueAndLabelsIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentQueueAndLabelsIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentQueueAndLabelsIT.groovy
index 5758feb..666efff 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentQueueAndLabelsIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsThroughAgentQueueAndLabelsIT.groovy
@@ -25,6 +25,7 @@ import org.apache.slider.api.StatusKeys
 import org.apache.slider.common.SliderExitCodes
 import org.apache.slider.common.params.Arguments
 import org.apache.slider.common.params.SliderActions
+import org.apache.slider.funtest.ResourcePaths
 import org.apache.slider.funtest.framework.AgentCommandTestBase
 import org.apache.slider.funtest.framework.FuntestProperties
 import org.apache.slider.funtest.framework.SliderShell
@@ -67,8 +68,7 @@ implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
   private static String COMMAND_LOGGER = "COMMAND_LOGGER"
   private static String APPLICATION_NAME = "happy-path-with-queue-labels"
   private static String TARGET_QUEUE = "labeled"
-  private static String APP_RESOURCE4 =
-      "../slider-core/src/test/app_packages/test_command_log/resources_queue_labels.json"
+  private static String APP_RESOURCE4 = ResourcePaths.COMMAND_LOG_RESOURCES_QUEUE_LABELS
 
   @After
   public void destroyCluster() {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsUpgradeIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsUpgradeIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsUpgradeIT.groovy
index 9fc8e6a..fa8b7a5 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsUpgradeIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AppsUpgradeIT.groovy
@@ -25,6 +25,7 @@ import org.apache.slider.api.StatusKeys
 import org.apache.slider.common.SliderExitCodes
 import org.apache.slider.common.params.Arguments
 import org.apache.slider.common.params.SliderActions
+import org.apache.slider.funtest.ResourcePaths
 import org.apache.slider.funtest.framework.AgentCommandTestBase
 import org.apache.slider.funtest.framework.FuntestProperties
 import org.apache.slider.funtest.framework.SliderShell
@@ -49,8 +50,7 @@ public class AppsUpgradeIT extends AgentCommandTestBase
   implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
   private static String COMMAND_LOGGER = "COMMAND_LOGGER"
   private static String APPLICATION_NAME = "app-upgrade-happy-path"
-  private static String APP_RESOURCE =
-      "../slider-core/src/test/app_packages/test_command_log/resources.json"
+  private static String APP_RESOURCE = ResourcePaths.COMMAND_LOG_RESOURCES
 
   @After
   public void destroyCluster() {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/ClusterBuildDestroyIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/ClusterBuildDestroyIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/ClusterBuildDestroyIT.groovy
index f03fb63..66bc10b 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/ClusterBuildDestroyIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/ClusterBuildDestroyIT.groovy
@@ -37,13 +37,10 @@ import org.junit.Test
 public class ClusterBuildDestroyIT extends AgentCommandTestBase
     implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
 
-
   static String CLUSTER = "test-cluster-build-destroy"
-  
 
   @BeforeClass
   public static void prepareCluster() {
-    
     setupCluster(CLUSTER)
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f36c0dad/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAppsThroughAgent.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAppsThroughAgent.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAppsThroughAgent.groovy
new file mode 100644
index 0000000..8ebb3d2
--- /dev/null
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAppsThroughAgent.groovy
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.slider.funtest.lifecycle
+
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.apache.slider.common.SliderExitCodes
+import org.apache.slider.common.params.Arguments
+import org.apache.slider.common.params.SliderActions
+import org.apache.slider.funtest.framework.AgentCommandTestBase
+import org.apache.slider.funtest.framework.FuntestProperties
+import org.apache.slider.funtest.framework.SliderShell
+import org.junit.Before
+import org.junit.Test
+
+/**
+ * For a quick demo of a slider app; this starts the apps through agent test but
+ * neglects to tear it down afterwards
+ */
+@CompileStatic
+@Slf4j
+public class DemoAppsThroughAgent extends AppsThroughAgentIT {
+
+  @Override
+  void destroyCluster() {
+//    super.destroyCluster()
+  }
+
+}



[02/17] incubator-slider git commit: SLIDER-907: AgentWebPagesIT downgrades on HTTPS RM proxies by skipping all proxied tests, retaining the direct ones

Posted by st...@apache.org.
SLIDER-907: AgentWebPagesIT downgrades on HTTPS RM proxies by skipping all proxied tests, retaining the direct ones


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

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: d4d343a777ffe27a0b2111008b78531312b988dd
Parents: f36c0da
Author: Steve Loughran <st...@apache.org>
Authored: Wed Nov 18 14:25:11 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Nov 18 14:25:11 2015 +0000

----------------------------------------------------------------------
 .../funtest/lifecycle/AgentWebPagesIT.groovy    | 97 +++++++++++---------
 1 file changed, 52 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/d4d343a7/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy
index 62be615..682caf8 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy
@@ -23,13 +23,9 @@ import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
 import org.apache.hadoop.registry.client.api.RegistryOperations
 import org.apache.hadoop.security.UserGroupInformation
-import org.apache.hadoop.yarn.api.ApplicationClientProtocol
-import org.apache.hadoop.yarn.client.ClientRMProxy
-import org.apache.hadoop.yarn.webapp.ForbiddenException
 import org.apache.slider.agent.rest.IpcApiClientTestDelegates
 import org.apache.slider.agent.rest.JerseyTestDelegates
 import org.apache.slider.agent.rest.AbstractRestTestDelegate
-import org.apache.slider.agent.rest.LowLevelRestTestDelegates
 import org.apache.slider.agent.rest.RestAPIClientTestDelegates
 import org.apache.slider.client.SliderClient
 import org.apache.slider.client.ipc.SliderApplicationIpcClient
@@ -40,6 +36,7 @@ import org.apache.slider.common.SliderXmlConfKeys
 import org.apache.slider.common.params.Arguments
 import org.apache.slider.common.params.SliderActions
 import org.apache.slider.common.tools.ConfigHelper
+import org.apache.slider.funtest.ResourcePaths
 import org.apache.slider.funtest.framework.AgentCommandTestBase
 import org.apache.slider.funtest.framework.FuntestProperties
 import org.apache.slider.funtest.framework.SliderShell
@@ -59,7 +56,7 @@ public class AgentWebPagesIT extends AgentCommandTestBase
 
   static String CLUSTER = "test-agent-web"
 
-  static String APP_RESOURCE2 = "../slider-core/src/test/app_packages/test_command_log/resources_no_role.json"
+  static String APP_RESOURCE2 = ResourcePaths.COMMAND_LOG_RESOURCES_NO_ROLE
 
   @Before
   public void prepareCluster() {
@@ -72,12 +69,11 @@ public class AgentWebPagesIT extends AgentCommandTestBase
   }
 
   @Test
-  @Ignore("SLIDER-907")
   public void testAgentWeb() throws Throwable {
     describe("Web queries & REST operations against an AM")
     
     // verify the ws/ path is open for all HTTP verbs
-    def sliderConfiguration = ConfigHelper.loadSliderConfiguration();
+    ConfigHelper.loadSliderConfiguration();
 
     /*
     Is the back door required? If so, don't test complex verbs via the proxy
@@ -91,7 +87,7 @@ public class AgentWebPagesIT extends AgentCommandTestBase
     def directComplexVerbs = proxyComplexVerbs || SLIDER_CONFIG.getBoolean(
         SliderXmlConfKeys.X_DEV_INSECURE_WS,
         SliderXmlConfKeys.X_DEV_INSECURE_DEFAULT)
-    def clusterpath = buildClusterPath(CLUSTER)
+    buildClusterPath(CLUSTER)
     File launchReportFile = createTempJsonFile();
     SliderShell shell = createTemplatedSliderApplication(CLUSTER,
         APP_TEMPLATE,
@@ -118,63 +114,74 @@ public class AgentWebPagesIT extends AgentCommandTestBase
 
     def proxyAM = report.url
 
+    // decide whether or not to use https
+    def proxyTests = !proxyAM.toLowerCase(Locale.ENGLISH).startsWith("https:")
+
     // here the URL has been published, but it may not be live yet, due to the time
     // it takes the AM to build app state and boostrap the Web UI
 
     def directAM = report.origTrackingUrl;
 
-    describe "Proxy Jersey Tests"
-
     Client jerseyClient = createUGIJerseyClient()
 
-    JerseyTestDelegates proxyJerseyTests =
-        new JerseyTestDelegates(proxyAM, jerseyClient, proxyComplexVerbs)
+    if (proxyTests) {
+      describe "Proxy Jersey Tests"
+
+      JerseyTestDelegates proxyJerseyTests =
+          new JerseyTestDelegates(proxyAM, jerseyClient, proxyComplexVerbs)
+
+      // wait it coming up
+      awaitRestEndpointLive(proxyJerseyTests, instanceLaunchTime)
+
+      proxyJerseyTests.testSuiteGetOperations()
+
+      describe "Proxy SliderRestClient Tests"
+      RestAPIClientTestDelegates proxySliderRestAPI =
+          new RestAPIClientTestDelegates(proxyAM, jerseyClient, proxyComplexVerbs)
+      proxySliderRestAPI.testSuiteAll()
 
-    // wait it coming up
-    awaitRestEndpointLive(proxyJerseyTests, instanceLaunchTime)
 
-    proxyJerseyTests.testSuiteGetOperations()
+      if (UserGroupInformation.securityEnabled) {
+        describe "Insecure Proxy Tests against a secure cluster"
+
+        // these tests use the Jersey client without the Hadoop-specific
+        // SPNEGO
+        JerseyTestDelegates basicJerseyClientTests =
+            new JerseyTestDelegates(proxyAM, createBasicJerseyClient())
+        basicJerseyClientTests.testSuiteGetOperations()
+      }
+
+      // create the Rest client via the registry
+
+      //get a slider client against the cluster
+
+      SliderClient sliderClient = bondToCluster(SLIDER_CONFIG, CLUSTER)
+      RegistryOperations operations = sliderClient.registryOperations;
+      def restClientFactory = new RestClientFactory(
+          operations, jerseyClient,
+          "~", SliderKeys.APP_TYPE, CLUSTER)
+      def sliderApplicationApi = restClientFactory.createSliderAppApiClient();
+      sliderApplicationApi.desiredModel
+      sliderApplicationApi.resolvedModel
+      if (proxyComplexVerbs) {
+        sliderApplicationApi.ping("registry located")
+      }
+
+    } else {
+      describe "skipping tests against HTTPS RM proxy $proxyAM"
+    }
+
 
     describe "Direct Jersey Tests"
     JerseyTestDelegates directJerseyTests =
         new JerseyTestDelegates(directAM, jerseyClient, directComplexVerbs)
     directJerseyTests.testSuiteAll()
 
-    describe "Proxy SliderRestClient Tests"
-    RestAPIClientTestDelegates proxySliderRestAPI =
-        new RestAPIClientTestDelegates(proxyAM, jerseyClient, proxyComplexVerbs)
-    proxySliderRestAPI.testSuiteAll()
-
     describe "Direct SliderRestClient Tests"
     RestAPIClientTestDelegates directSliderRestAPI =
         new RestAPIClientTestDelegates(directAM, jerseyClient, directComplexVerbs)
     directSliderRestAPI.testSuiteAll()
 
-    if (UserGroupInformation.securityEnabled) {
-      describe "Insecure Proxy Tests against a secure cluster"
-
-      // these tests use the Jersey client without the Hadoop-specific
-      // SPNEGO
-      JerseyTestDelegates basicJerseyClientTests =
-          new JerseyTestDelegates(proxyAM, createBasicJerseyClient())
-      basicJerseyClientTests.testSuiteGetOperations()
-    }
-
-    // create the Rest client via the registry
-
-    //get a slider client against the cluster
-
-    SliderClient sliderClient = bondToCluster(SLIDER_CONFIG, CLUSTER)
-    RegistryOperations operations = sliderClient.registryOperations;
-    def restClientFactory = new RestClientFactory(
-        operations, jerseyClient,
-        "~", SliderKeys.APP_TYPE, CLUSTER)
-    def sliderApplicationApi = restClientFactory.createSliderAppApiClient();
-    sliderApplicationApi.desiredModel
-    sliderApplicationApi.resolvedModel
-    if (proxyComplexVerbs) {
-      sliderApplicationApi.ping("registry located")
-    }
 
 
     // maybe execute IPC operations.


[09/17] incubator-slider git commit: SLIDER-970: AASleepIT, test completes, added a demo subclass

Posted by st...@apache.org.
SLIDER-970: AASleepIT, test completes, added a demo subclass


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

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: 3418d72e58b842890231452aa5d02610e722d4f8
Parents: ee6e5f6
Author: Steve Loughran <st...@apache.org>
Authored: Thu Nov 19 18:46:32 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Nov 19 18:50:16 2015 +0000

----------------------------------------------------------------------
 .../test_min_pkg/sleep_cmd/resources.json       |  6 +--
 .../funtest/framework/CommandTestBase.groovy    | 10 ++---
 .../slider/funtest/lifecycle/AASleepIT.groovy   | 31 +++++++++++++--
 .../slider/funtest/lifecycle/DemoAASleep.groovy | 41 ++++++++++++++++++++
 4 files changed, 76 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3418d72e/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
----------------------------------------------------------------------
diff --git a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
index c5d7a2a..1268996 100644
--- a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
+++ b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
@@ -11,12 +11,12 @@
     "SLEEP_100": {
       "yarn.role.priority": "1",
       "yarn.component.instances": "1",
-      "yarn.memory": "256"
+      "yarn.memory": "128"
     },
     "SLEEP_LONG": {
-      "yarn.role.priority": "1",
+      "yarn.role.priority": "2",
       "yarn.component.instances": "0",
-      "yarn.memory": "256",
+      "yarn.memory": "128",
       "yarn.placement.policy": "4"
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3418d72e/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
index 218a081..654ccb3 100644
--- a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
+++ b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
@@ -29,14 +29,14 @@ import org.apache.hadoop.util.Shell
 import org.apache.hadoop.yarn.api.records.YarnApplicationState
 import org.apache.hadoop.yarn.conf.YarnConfiguration
 import org.apache.slider.api.StatusKeys
-import org.apache.slider.common.tools.ConfigHelper
-import org.apache.slider.core.launch.SerializedApplicationReport
-import org.apache.slider.core.main.ServiceLauncher
+import org.apache.slider.client.SliderClient
 import org.apache.slider.common.SliderKeys
 import org.apache.slider.common.SliderXmlConfKeys
 import org.apache.slider.api.ClusterDescription
+import org.apache.slider.common.tools.ConfigHelper
 import org.apache.slider.common.tools.SliderUtils
-import org.apache.slider.client.SliderClient
+import org.apache.slider.core.launch.SerializedApplicationReport
+import org.apache.slider.core.main.ServiceLauncher
 import org.apache.slider.core.persist.ApplicationReportSerDeser
 import org.apache.slider.test.SliderTestUtils
 import org.apache.slider.test.Outcome;
@@ -817,7 +817,7 @@ abstract class CommandTestBase extends SliderTestUtils {
   }  
    
   public static SerializedApplicationReport loadAppReport(File reportFile) {
-    if (reportFile.exists() && reportFile.length()> 0) {
+    if (reportFile.exists() && reportFile.length() > 0) {
       ApplicationReportSerDeser serDeser = new ApplicationReportSerDeser()
       def report = serDeser.fromFile(reportFile)
       return report

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3418d72e/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
index e549b70..464b329 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
@@ -21,9 +21,11 @@ package org.apache.slider.funtest.lifecycle
 import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
 import org.apache.hadoop.yarn.api.records.YarnApplicationState
+import org.apache.slider.api.ResourceKeys
 import org.apache.slider.common.SliderExitCodes
 import org.apache.slider.common.params.Arguments
 import org.apache.slider.common.params.SliderActions
+import org.apache.slider.core.launch.SerializedApplicationReport
 import org.apache.slider.funtest.ResourcePaths
 import org.apache.slider.funtest.framework.AgentCommandTestBase
 import org.apache.slider.funtest.framework.FuntestProperties
@@ -62,13 +64,12 @@ public class AASleepIT extends AgentCommandTestBase
     File launchReportFile = createTempJsonFile();
 
     // TODO: Determine YARN cluster size via an API/CLI Call, maybe use labels too?
-    int yarnClusterSize = 1;
-    int desired = yarnClusterSize + 1
+    int desired = buildDesiredCount(1)
     SliderShell shell = createSliderApplicationMinPkg(CLUSTER,
         TEST_METADATA,
         TEST_RESOURCE,
         ResourcePaths.SLEEP_APPCONFIG,
-        [ARG_RES_COMP_OPT, SLEEP_LONG, Integer.toString(desired)],
+        [ARG_RES_COMP_OPT, SLEEP_LONG, ResourceKeys.COMPONENT_INSTANCES, Integer.toString(desired)],
         launchReportFile)
 
     logShell(shell)
@@ -84,9 +85,13 @@ public class AASleepIT extends AgentCommandTestBase
     assertPathExists(clusterFS, "Cluster directory does not exist", clusterpath)
 
     status(0, CLUSTER)
-    expectLiveContainerCountReached(CLUSTER, SLEEP_100, desired -1 ,
+
+    def expected = buildExpectedCount(desired)
+    expectLiveContainerCountReached(CLUSTER, SLEEP_100, expected,
         CONTAINER_LAUNCH_TIMEOUT)
 
+    operations(CLUSTER, loadAppReport(launchReportFile), desired, expected)
+
     // sleep for some manual test
     describe("You may quickly perform manual tests against the application instance $CLUSTER")
     sleep(1000 * 30)
@@ -104,4 +109,22 @@ public class AASleepIT extends AgentCommandTestBase
     //cluster now missing
     exists(EXIT_UNKNOWN_INSTANCE, CLUSTER)
   }
+
+  protected int buildExpectedCount(int desired) {
+    desired - 1
+  }
+
+  protected int buildDesiredCount(int clustersize) {
+    clustersize + 1
+  }
+
+  protected void operations(String name,
+      SerializedApplicationReport appReport,
+      int desired,
+      int expected ) {
+    // sleep for some manual test
+    describe("You may quickly perform manual tests against the application instance $CLUSTER")
+    sleep(1000 * 30)
+
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/3418d72e/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAASleep.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAASleep.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAASleep.groovy
new file mode 100644
index 0000000..7d0ee46
--- /dev/null
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAASleep.groovy
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.slider.funtest.lifecycle
+
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.apache.slider.core.launch.SerializedApplicationReport
+
+@CompileStatic
+@Slf4j
+class DemoAASleep extends AASleepIT {
+
+  @Override
+  protected void operations(
+      String name,
+      SerializedApplicationReport appReport,
+      int desired,
+      int expected) {
+    super.operations(name, appReport, desired, expected)
+
+    describe("cluster is live at ${appReport.url}")
+
+    sleep(10 * 60 * 1000)
+  }
+}


[13/17] incubator-slider git commit: SLIDER-994 add "nodemap" command to get the (JSON) nodemap of the YARN cluster

Posted by st...@apache.org.
SLIDER-994 add "nodemap" command to get the (JSON) nodemap of the YARN cluster


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

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: cc94e056c3b0e8436932417503e08f33d0a4f0bb
Parents: 0c1977b
Author: Steve Loughran <st...@apache.org>
Authored: Fri Nov 20 19:06:05 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Fri Nov 20 19:06:05 2015 +0000

----------------------------------------------------------------------
 .../apache/slider/api/SliderApplicationApi.java |   7 +-
 .../org/apache/slider/api/proto/Messages.java   | 293 ++++---------------
 .../org/apache/slider/client/SliderClient.java  |  16 +-
 .../client/ipc/SliderApplicationIpcClient.java  |   3 +-
 .../client/ipc/SliderClusterOperations.java     |  24 +-
 .../rest/SliderApplicationApiRestClient.java    |  11 +-
 .../server/appmaster/rpc/SliderIPCService.java  |   9 +-
 .../rest/application/ApplicationResource.java   |  15 +-
 .../resources/LiveNodesRefresher.java           |  11 +-
 .../src/main/proto/SliderClusterMessages.proto  |   8 +-
 .../rest/AbstractAppApiTestDelegates.groovy     |  10 +-
 .../providers/agent/TestAgentAAEcho.groovy      |   4 +
 12 files changed, 112 insertions(+), 299 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/cc94e056/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java b/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java
index 750dba5..d21785f 100644
--- a/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java
+++ b/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java
@@ -22,6 +22,7 @@ import org.apache.slider.api.types.ApplicationLivenessInformation;
 import org.apache.slider.api.types.ComponentInformation;
 import org.apache.slider.api.types.ContainerInformation;
 import org.apache.slider.api.types.NodeInformation;
+import org.apache.slider.api.types.NodeInformationList;
 import org.apache.slider.api.types.PingInformation;
 import org.apache.slider.core.conf.AggregateConf;
 import org.apache.slider.core.conf.ConfTree;
@@ -126,13 +127,13 @@ public interface SliderApplicationApi {
    * @throws IOException on any failure
    */
   ComponentInformation getComponent(String componentName) throws IOException;
-  
+
   /**
    * List all nodes into a map of [name:info]
-   * @return a possibly empty map of nodes
+   * @return a possibly empty list of nodes
    * @throws IOException on any failure
    */
-  Map<String, NodeInformation> getLiveNodes() throws IOException;
+  NodeInformationList getLiveNodes() throws IOException;
 
   /**
    * Get information about a node

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/cc94e056/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java b/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java
index ed056f5..6dd5849 100644
--- a/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java
+++ b/slider-core/src/main/java/org/apache/slider/api/proto/Messages.java
@@ -32389,47 +32389,27 @@ public final class Messages {
   public interface GetLiveNodesResponseProtoOrBuilder
       extends com.google.protobuf.MessageOrBuilder {
 
-    // repeated string names = 1;
-    /**
-     * <code>repeated string names = 1;</code>
-     */
-    java.util.List<java.lang.String>
-    getNamesList();
-    /**
-     * <code>repeated string names = 1;</code>
-     */
-    int getNamesCount();
+    // repeated .org.apache.slider.api.NodeInformationProto nodes = 1;
     /**
-     * <code>repeated string names = 1;</code>
-     */
-    java.lang.String getNames(int index);
-    /**
-     * <code>repeated string names = 1;</code>
-     */
-    com.google.protobuf.ByteString
-        getNamesBytes(int index);
-
-    // repeated .org.apache.slider.api.NodeInformationProto nodes = 2;
-    /**
-     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
      */
     java.util.List<org.apache.slider.api.proto.Messages.NodeInformationProto> 
         getNodesList();
     /**
-     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
      */
     org.apache.slider.api.proto.Messages.NodeInformationProto getNodes(int index);
     /**
-     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
      */
     int getNodesCount();
     /**
-     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
      */
     java.util.List<? extends org.apache.slider.api.proto.Messages.NodeInformationProtoOrBuilder> 
         getNodesOrBuilderList();
     /**
-     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
      */
     org.apache.slider.api.proto.Messages.NodeInformationProtoOrBuilder getNodesOrBuilder(
         int index);
@@ -32487,16 +32467,8 @@ public final class Messages {
             }
             case 10: {
               if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
-                names_ = new com.google.protobuf.LazyStringArrayList();
-                mutable_bitField0_ |= 0x00000001;
-              }
-              names_.add(input.readBytes());
-              break;
-            }
-            case 18: {
-              if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
                 nodes_ = new java.util.ArrayList<org.apache.slider.api.proto.Messages.NodeInformationProto>();
-                mutable_bitField0_ |= 0x00000002;
+                mutable_bitField0_ |= 0x00000001;
               }
               nodes_.add(input.readMessage(org.apache.slider.api.proto.Messages.NodeInformationProto.PARSER, extensionRegistry));
               break;
@@ -32510,9 +32482,6 @@ public final class Messages {
             e.getMessage()).setUnfinishedMessage(this);
       } finally {
         if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
-          names_ = new com.google.protobuf.UnmodifiableLazyStringList(names_);
-        }
-        if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
           nodes_ = java.util.Collections.unmodifiableList(nodes_);
         }
         this.unknownFields = unknownFields.build();
@@ -32546,66 +32515,36 @@ public final class Messages {
       return PARSER;
     }
 
-    // repeated string names = 1;
-    public static final int NAMES_FIELD_NUMBER = 1;
-    private com.google.protobuf.LazyStringList names_;
-    /**
-     * <code>repeated string names = 1;</code>
-     */
-    public java.util.List<java.lang.String>
-        getNamesList() {
-      return names_;
-    }
-    /**
-     * <code>repeated string names = 1;</code>
-     */
-    public int getNamesCount() {
-      return names_.size();
-    }
-    /**
-     * <code>repeated string names = 1;</code>
-     */
-    public java.lang.String getNames(int index) {
-      return names_.get(index);
-    }
-    /**
-     * <code>repeated string names = 1;</code>
-     */
-    public com.google.protobuf.ByteString
-        getNamesBytes(int index) {
-      return names_.getByteString(index);
-    }
-
-    // repeated .org.apache.slider.api.NodeInformationProto nodes = 2;
-    public static final int NODES_FIELD_NUMBER = 2;
+    // repeated .org.apache.slider.api.NodeInformationProto nodes = 1;
+    public static final int NODES_FIELD_NUMBER = 1;
     private java.util.List<org.apache.slider.api.proto.Messages.NodeInformationProto> nodes_;
     /**
-     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
      */
     public java.util.List<org.apache.slider.api.proto.Messages.NodeInformationProto> getNodesList() {
       return nodes_;
     }
     /**
-     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
      */
     public java.util.List<? extends org.apache.slider.api.proto.Messages.NodeInformationProtoOrBuilder> 
         getNodesOrBuilderList() {
       return nodes_;
     }
     /**
-     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
      */
     public int getNodesCount() {
       return nodes_.size();
     }
     /**
-     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
      */
     public org.apache.slider.api.proto.Messages.NodeInformationProto getNodes(int index) {
       return nodes_.get(index);
     }
     /**
-     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+     * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
      */
     public org.apache.slider.api.proto.Messages.NodeInformationProtoOrBuilder getNodesOrBuilder(
         int index) {
@@ -32613,7 +32552,6 @@ public final class Messages {
     }
 
     private void initFields() {
-      names_ = com.google.protobuf.LazyStringArrayList.EMPTY;
       nodes_ = java.util.Collections.emptyList();
     }
     private byte memoizedIsInitialized = -1;
@@ -32634,11 +32572,8 @@ public final class Messages {
     public void writeTo(com.google.protobuf.CodedOutputStream output)
                         throws java.io.IOException {
       getSerializedSize();
-      for (int i = 0; i < names_.size(); i++) {
-        output.writeBytes(1, names_.getByteString(i));
-      }
       for (int i = 0; i < nodes_.size(); i++) {
-        output.writeMessage(2, nodes_.get(i));
+        output.writeMessage(1, nodes_.get(i));
       }
       getUnknownFields().writeTo(output);
     }
@@ -32649,18 +32584,9 @@ public final class Messages {
       if (size != -1) return size;
 
       size = 0;
-      {
-        int dataSize = 0;
-        for (int i = 0; i < names_.size(); i++) {
-          dataSize += com.google.protobuf.CodedOutputStream
-            .computeBytesSizeNoTag(names_.getByteString(i));
-        }
-        size += dataSize;
-        size += 1 * getNamesList().size();
-      }
       for (int i = 0; i < nodes_.size(); i++) {
         size += com.google.protobuf.CodedOutputStream
-          .computeMessageSize(2, nodes_.get(i));
+          .computeMessageSize(1, nodes_.get(i));
       }
       size += getUnknownFields().getSerializedSize();
       memoizedSerializedSize = size;
@@ -32685,8 +32611,6 @@ public final class Messages {
       org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto other = (org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto) obj;
 
       boolean result = true;
-      result = result && getNamesList()
-          .equals(other.getNamesList());
       result = result && getNodesList()
           .equals(other.getNodesList());
       result = result &&
@@ -32702,10 +32626,6 @@ public final class Messages {
       }
       int hash = 41;
       hash = (19 * hash) + getDescriptorForType().hashCode();
-      if (getNamesCount() > 0) {
-        hash = (37 * hash) + NAMES_FIELD_NUMBER;
-        hash = (53 * hash) + getNamesList().hashCode();
-      }
       if (getNodesCount() > 0) {
         hash = (37 * hash) + NODES_FIELD_NUMBER;
         hash = (53 * hash) + getNodesList().hashCode();
@@ -32820,11 +32740,9 @@ public final class Messages {
 
       public Builder clear() {
         super.clear();
-        names_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-        bitField0_ = (bitField0_ & ~0x00000001);
         if (nodesBuilder_ == null) {
           nodes_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x00000002);
+          bitField0_ = (bitField0_ & ~0x00000001);
         } else {
           nodesBuilder_.clear();
         }
@@ -32855,16 +32773,10 @@ public final class Messages {
       public org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto buildPartial() {
         org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto result = new org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto(this);
         int from_bitField0_ = bitField0_;
-        if (((bitField0_ & 0x00000001) == 0x00000001)) {
-          names_ = new com.google.protobuf.UnmodifiableLazyStringList(
-              names_);
-          bitField0_ = (bitField0_ & ~0x00000001);
-        }
-        result.names_ = names_;
         if (nodesBuilder_ == null) {
-          if (((bitField0_ & 0x00000002) == 0x00000002)) {
+          if (((bitField0_ & 0x00000001) == 0x00000001)) {
             nodes_ = java.util.Collections.unmodifiableList(nodes_);
-            bitField0_ = (bitField0_ & ~0x00000002);
+            bitField0_ = (bitField0_ & ~0x00000001);
           }
           result.nodes_ = nodes_;
         } else {
@@ -32885,21 +32797,11 @@ public final class Messages {
 
       public Builder mergeFrom(org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto other) {
         if (other == org.apache.slider.api.proto.Messages.GetLiveNodesResponseProto.getDefaultInstance()) return this;
-        if (!other.names_.isEmpty()) {
-          if (names_.isEmpty()) {
-            names_ = other.names_;
-            bitField0_ = (bitField0_ & ~0x00000001);
-          } else {
-            ensureNamesIsMutable();
-            names_.addAll(other.names_);
-          }
-          onChanged();
-        }
         if (nodesBuilder_ == null) {
           if (!other.nodes_.isEmpty()) {
             if (nodes_.isEmpty()) {
               nodes_ = other.nodes_;
-              bitField0_ = (bitField0_ & ~0x00000002);
+              bitField0_ = (bitField0_ & ~0x00000001);
             } else {
               ensureNodesIsMutable();
               nodes_.addAll(other.nodes_);
@@ -32912,7 +32814,7 @@ public final class Messages {
               nodesBuilder_.dispose();
               nodesBuilder_ = null;
               nodes_ = other.nodes_;
-              bitField0_ = (bitField0_ & ~0x00000002);
+              bitField0_ = (bitField0_ & ~0x00000001);
               nodesBuilder_ = 
                 com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
                    getNodesFieldBuilder() : null;
@@ -32954,106 +32856,13 @@ public final class Messages {
       }
       private int bitField0_;
 
-      // repeated string names = 1;
-      private com.google.protobuf.LazyStringList names_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-      private void ensureNamesIsMutable() {
-        if (!((bitField0_ & 0x00000001) == 0x00000001)) {
-          names_ = new com.google.protobuf.LazyStringArrayList(names_);
-          bitField0_ |= 0x00000001;
-         }
-      }
-      /**
-       * <code>repeated string names = 1;</code>
-       */
-      public java.util.List<java.lang.String>
-          getNamesList() {
-        return java.util.Collections.unmodifiableList(names_);
-      }
-      /**
-       * <code>repeated string names = 1;</code>
-       */
-      public int getNamesCount() {
-        return names_.size();
-      }
-      /**
-       * <code>repeated string names = 1;</code>
-       */
-      public java.lang.String getNames(int index) {
-        return names_.get(index);
-      }
-      /**
-       * <code>repeated string names = 1;</code>
-       */
-      public com.google.protobuf.ByteString
-          getNamesBytes(int index) {
-        return names_.getByteString(index);
-      }
-      /**
-       * <code>repeated string names = 1;</code>
-       */
-      public Builder setNames(
-          int index, java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureNamesIsMutable();
-        names_.set(index, value);
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>repeated string names = 1;</code>
-       */
-      public Builder addNames(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureNamesIsMutable();
-        names_.add(value);
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>repeated string names = 1;</code>
-       */
-      public Builder addAllNames(
-          java.lang.Iterable<java.lang.String> values) {
-        ensureNamesIsMutable();
-        super.addAll(values, names_);
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>repeated string names = 1;</code>
-       */
-      public Builder clearNames() {
-        names_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-        bitField0_ = (bitField0_ & ~0x00000001);
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>repeated string names = 1;</code>
-       */
-      public Builder addNamesBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureNamesIsMutable();
-        names_.add(value);
-        onChanged();
-        return this;
-      }
-
-      // repeated .org.apache.slider.api.NodeInformationProto nodes = 2;
+      // repeated .org.apache.slider.api.NodeInformationProto nodes = 1;
       private java.util.List<org.apache.slider.api.proto.Messages.NodeInformationProto> nodes_ =
         java.util.Collections.emptyList();
       private void ensureNodesIsMutable() {
-        if (!((bitField0_ & 0x00000002) == 0x00000002)) {
+        if (!((bitField0_ & 0x00000001) == 0x00000001)) {
           nodes_ = new java.util.ArrayList<org.apache.slider.api.proto.Messages.NodeInformationProto>(nodes_);
-          bitField0_ |= 0x00000002;
+          bitField0_ |= 0x00000001;
          }
       }
 
@@ -33061,7 +32870,7 @@ public final class Messages {
           org.apache.slider.api.proto.Messages.NodeInformationProto, org.apache.slider.api.proto.Messages.NodeInformationProto.Builder, org.apache.slider.api.proto.Messages.NodeInformationProtoOrBuilder> nodesBuilder_;
 
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public java.util.List<org.apache.slider.api.proto.Messages.NodeInformationProto> getNodesList() {
         if (nodesBuilder_ == null) {
@@ -33071,7 +32880,7 @@ public final class Messages {
         }
       }
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public int getNodesCount() {
         if (nodesBuilder_ == null) {
@@ -33081,7 +32890,7 @@ public final class Messages {
         }
       }
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public org.apache.slider.api.proto.Messages.NodeInformationProto getNodes(int index) {
         if (nodesBuilder_ == null) {
@@ -33091,7 +32900,7 @@ public final class Messages {
         }
       }
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public Builder setNodes(
           int index, org.apache.slider.api.proto.Messages.NodeInformationProto value) {
@@ -33108,7 +32917,7 @@ public final class Messages {
         return this;
       }
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public Builder setNodes(
           int index, org.apache.slider.api.proto.Messages.NodeInformationProto.Builder builderForValue) {
@@ -33122,7 +32931,7 @@ public final class Messages {
         return this;
       }
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public Builder addNodes(org.apache.slider.api.proto.Messages.NodeInformationProto value) {
         if (nodesBuilder_ == null) {
@@ -33138,7 +32947,7 @@ public final class Messages {
         return this;
       }
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public Builder addNodes(
           int index, org.apache.slider.api.proto.Messages.NodeInformationProto value) {
@@ -33155,7 +32964,7 @@ public final class Messages {
         return this;
       }
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public Builder addNodes(
           org.apache.slider.api.proto.Messages.NodeInformationProto.Builder builderForValue) {
@@ -33169,7 +32978,7 @@ public final class Messages {
         return this;
       }
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public Builder addNodes(
           int index, org.apache.slider.api.proto.Messages.NodeInformationProto.Builder builderForValue) {
@@ -33183,7 +32992,7 @@ public final class Messages {
         return this;
       }
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public Builder addAllNodes(
           java.lang.Iterable<? extends org.apache.slider.api.proto.Messages.NodeInformationProto> values) {
@@ -33197,12 +33006,12 @@ public final class Messages {
         return this;
       }
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public Builder clearNodes() {
         if (nodesBuilder_ == null) {
           nodes_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x00000002);
+          bitField0_ = (bitField0_ & ~0x00000001);
           onChanged();
         } else {
           nodesBuilder_.clear();
@@ -33210,7 +33019,7 @@ public final class Messages {
         return this;
       }
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public Builder removeNodes(int index) {
         if (nodesBuilder_ == null) {
@@ -33223,14 +33032,14 @@ public final class Messages {
         return this;
       }
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public org.apache.slider.api.proto.Messages.NodeInformationProto.Builder getNodesBuilder(
           int index) {
         return getNodesFieldBuilder().getBuilder(index);
       }
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public org.apache.slider.api.proto.Messages.NodeInformationProtoOrBuilder getNodesOrBuilder(
           int index) {
@@ -33240,7 +33049,7 @@ public final class Messages {
         }
       }
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public java.util.List<? extends org.apache.slider.api.proto.Messages.NodeInformationProtoOrBuilder> 
            getNodesOrBuilderList() {
@@ -33251,14 +33060,14 @@ public final class Messages {
         }
       }
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public org.apache.slider.api.proto.Messages.NodeInformationProto.Builder addNodesBuilder() {
         return getNodesFieldBuilder().addBuilder(
             org.apache.slider.api.proto.Messages.NodeInformationProto.getDefaultInstance());
       }
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public org.apache.slider.api.proto.Messages.NodeInformationProto.Builder addNodesBuilder(
           int index) {
@@ -33266,7 +33075,7 @@ public final class Messages {
             index, org.apache.slider.api.proto.Messages.NodeInformationProto.getDefaultInstance());
       }
       /**
-       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 2;</code>
+       * <code>repeated .org.apache.slider.api.NodeInformationProto nodes = 1;</code>
        */
       public java.util.List<org.apache.slider.api.proto.Messages.NodeInformationProto.Builder> 
            getNodesBuilderList() {
@@ -33279,7 +33088,7 @@ public final class Messages {
           nodesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
               org.apache.slider.api.proto.Messages.NodeInformationProto, org.apache.slider.api.proto.Messages.NodeInformationProto.Builder, org.apache.slider.api.proto.Messages.NodeInformationProtoOrBuilder>(
                   nodes_,
-                  ((bitField0_ & 0x00000002) == 0x00000002),
+                  ((bitField0_ & 0x00000001) == 0x00000001),
                   getParentForChildren(),
                   isClean());
           nodes_ = null;
@@ -34166,12 +33975,12 @@ public final class Messages {
       "oto\022\020\n\010hostname\030\001 \001(\t\022\023\n\013requesterId\030\002 \002",
       "(\t\022\020\n\010password\030\003 \002(\t\022\014\n\004type\030\004 \002(\t\"1\n Ge" +
       "tCertificateStoreResponseProto\022\r\n\005store\030" +
-      "\001 \002(\014\"\032\n\030GetLiveNodesRequestProto\"f\n\031Get" +
-      "LiveNodesResponseProto\022\r\n\005names\030\001 \003(\t\022:\n" +
-      "\005nodes\030\002 \003(\0132+.org.apache.slider.api.Nod" +
-      "eInformationProto\"\'\n\027GetLiveNodeRequestP" +
-      "roto\022\014\n\004name\030\001 \002(\tB-\n\033org.apache.slider." +
-      "api.protoB\010Messages\210\001\001\240\001\001"
+      "\001 \002(\014\"\032\n\030GetLiveNodesRequestProto\"W\n\031Get" +
+      "LiveNodesResponseProto\022:\n\005nodes\030\001 \003(\0132+." +
+      "org.apache.slider.api.NodeInformationPro" +
+      "to\"\'\n\027GetLiveNodeRequestProto\022\014\n\004name\030\001 " +
+      "\002(\tB-\n\033org.apache.slider.api.protoB\010Mess" +
+      "ages\210\001\001\240\001\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -34471,7 +34280,7 @@ public final class Messages {
           internal_static_org_apache_slider_api_GetLiveNodesResponseProto_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_apache_slider_api_GetLiveNodesResponseProto_descriptor,
-              new java.lang.String[] { "Names", "Nodes", });
+              new java.lang.String[] { "Nodes", });
           internal_static_org_apache_slider_api_GetLiveNodeRequestProto_descriptor =
             getDescriptor().getMessageTypes().get(49);
           internal_static_org_apache_slider_api_GetLiveNodeRequestProto_fieldAccessorTable = new

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/cc94e056/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 ca9bb12..0753ecc 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
@@ -106,6 +106,7 @@ import org.apache.slider.common.params.LaunchArgsAccessor;
 import org.apache.slider.common.tools.ConfigHelper;
 import org.apache.slider.common.tools.Duration;
 import org.apache.slider.common.tools.SliderFileSystem;
+import org.apache.slider.common.tools.SliderUtils;
 import org.apache.slider.common.tools.SliderVersionInfo;
 import org.apache.slider.core.build.InstanceBuilder;
 import org.apache.slider.core.build.InstanceIO;
@@ -4254,9 +4255,13 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
    * @throws IOException IO problems
    * @throws YarnException YARN problems
    */
-  public NodeInformationList listInstanceNodes(ActionNodesArgs args)
+  public NodeInformationList listInstanceNodes(String instance, ActionNodesArgs args)
     throws YarnException, IOException {
-    return yarnClient.listNodes(args.label, args.healthy);
+    // TODO
+    log.info("listInstanceNodes {}", instance);
+    SliderClusterOperations clusterOps =
+      new SliderClusterOperations(bondToCluster(instance));
+    return clusterOps.getLiveNodes();
   }
 
   /**
@@ -4269,7 +4274,12 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
   public int actionNodes(String instance, ActionNodesArgs args) throws YarnException, IOException {
 
     args.instance = instance;
-    NodeInformationList nodes = listYarnClusterNodes(args);
+    NodeInformationList nodes;
+    if (SliderUtils.isUnset(instance)) {
+      nodes = listYarnClusterNodes(args);
+    } else {
+      nodes = listInstanceNodes(instance, args);
+    }
     log.debug("Node listing for {} has {} nodes", args, nodes.size());
     JsonSerDeser<NodeInformationList> serDeser = NodeInformationList.createSerializer();
     if (args.outputFile != null) {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/cc94e056/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
index 291583d..a007326 100644
--- a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
@@ -24,6 +24,7 @@ import org.apache.slider.api.types.ApplicationLivenessInformation;
 import org.apache.slider.api.types.ComponentInformation;
 import org.apache.slider.api.types.ContainerInformation;
 import org.apache.slider.api.types.NodeInformation;
+import org.apache.slider.api.types.NodeInformationList;
 import org.apache.slider.api.types.PingInformation;
 import org.apache.slider.api.SliderApplicationApi;
 import org.apache.slider.core.conf.AggregateConf;
@@ -196,7 +197,7 @@ public class SliderApplicationIpcClient implements SliderApplicationApi {
   }
 
   @Override
-  public Map<String, NodeInformation> getLiveNodes() throws IOException {
+  public NodeInformationList getLiveNodes() throws IOException {
     try {
       return operations.getLiveNodes();
     } catch (IOException e) {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/cc94e056/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
index e1ec971..392f451 100644
--- a/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
+++ b/slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
@@ -19,6 +19,9 @@
 package org.apache.slider.client.ipc;
 
 import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+import org.apache.hadoop.yarn.api.records.NodeReport;
+import org.apache.hadoop.yarn.api.records.NodeState;
 import org.apache.hadoop.yarn.exceptions.YarnException;
 import org.apache.slider.api.ClusterDescription;
 import org.apache.slider.api.ClusterNode;
@@ -31,8 +34,10 @@ import org.apache.slider.api.types.ApplicationLivenessInformation;
 import org.apache.slider.api.types.ComponentInformation;
 import org.apache.slider.api.types.ContainerInformation;
 import org.apache.slider.api.types.NodeInformation;
+import org.apache.slider.api.types.NodeInformationList;
 import org.apache.slider.api.types.PingInformation;
 import org.apache.slider.common.tools.Duration;
+import org.apache.slider.common.tools.SliderUtils;
 import org.apache.slider.core.conf.AggregateConf;
 import org.apache.slider.core.conf.ConfTree;
 import org.apache.slider.core.conf.ConfTreeOperations;
@@ -237,7 +242,7 @@ public class SliderClusterOperations {
 
   /**
    * Get the details on a list of uuids
-   * @param uuids
+   * @param uuids instance IDs
    * @return a possibly empty list of node details
    * @throws IOException
    * @throws YarnException
@@ -468,22 +473,16 @@ public class SliderClusterOperations {
     return unmarshall(proto);
   }
 
-  public Map<String, NodeInformation> getLiveNodes() throws IOException {
+  public NodeInformationList getLiveNodes() throws IOException {
     Messages.GetLiveNodesResponseProto response =
       appMaster.getLiveNodes(Messages.GetLiveNodesRequestProto.newBuilder().build());
 
-    int namesCount = response.getNamesCount();
     int records = response.getNodesCount();
-    if (namesCount != records) {
-      throw new IOException(
-          "Number of names returned (" + namesCount + ")" +
-              " does not match the number of records returned: " + records);
+    NodeInformationList nil = new NodeInformationList(records);
+    for (int i = 0; i < records; i++) {
+      nil.add(unmarshall(response.getNodes(i)));
     }
-    Map<String, NodeInformation> map = new HashMap<>(namesCount);
-    for (int i = 0; i < namesCount; i++) {
-      map.put(response.getNames(i), unmarshall(response.getNodes(i)));
-    }
-    return map;
+    return nil;
   }
 
   public NodeInformation getLiveNode(String hostname) throws IOException {
@@ -527,5 +526,4 @@ public class SliderClusterOperations {
 
     return unmarshall(response);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/cc94e056/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
index 54c60d1..4283ee8 100644
--- a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
@@ -21,11 +21,9 @@ package org.apache.slider.client.rest;
 import com.google.common.base.Preconditions;
 import com.sun.jersey.api.client.Client;
 import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientResponse;
 import com.sun.jersey.api.client.GenericType;
 import com.sun.jersey.api.client.UniformInterfaceException;
 import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.filter.LoggingFilter;
 import com.sun.jersey.api.representation.Form;
 import org.apache.commons.lang.StringUtils;
 import org.apache.slider.api.types.ApplicationLivenessInformation;
@@ -33,11 +31,11 @@ import org.apache.slider.api.types.ComponentInformation;
 import org.apache.slider.api.types.ContainerInformation;
 import org.apache.slider.api.SliderApplicationApi;
 import org.apache.slider.api.types.NodeInformation;
+import org.apache.slider.api.types.NodeInformationList;
 import org.apache.slider.core.conf.AggregateConf;
 import org.apache.slider.core.conf.ConfTree;
 import org.apache.slider.core.conf.ConfTreeOperations;
 import org.apache.slider.core.exceptions.ExceptionConverter;
-import org.apache.slider.core.persist.ConfTreeSerDeser;
 import org.apache.slider.core.restclient.HttpVerb;
 import org.apache.slider.api.types.PingInformation;
 import org.slf4j.Logger;
@@ -258,14 +256,13 @@ public class SliderApplicationApiRestClient extends BaseRestClient
   }
 
   @Override
-  public Map<String, NodeInformation> getLiveNodes() throws IOException {
-    return getApplicationResource(LIVE_NODES,
-        new GenericType<Map<String, NodeInformation>>() { });
+  public NodeInformationList getLiveNodes() throws IOException {
+    return getApplicationResource(LIVE_NODES, NodeInformationList.class);
   }
 
   @Override
   public NodeInformation getLiveNode(String hostname) throws IOException {
-    return getApplicationResource(LIVE_COMPONENTS + "/" + hostname,
+    return getApplicationResource(LIVE_NODES + "/" + hostname,
         NodeInformation.class);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/cc94e056/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
index a983f53..fda23aa 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
@@ -31,6 +31,7 @@ import org.apache.slider.api.types.ApplicationLivenessInformation;
 import org.apache.slider.api.types.ComponentInformation;
 import org.apache.slider.api.types.ContainerInformation;
 import org.apache.slider.api.types.NodeInformation;
+import org.apache.slider.api.types.NodeInformationList;
 import org.apache.slider.core.conf.AggregateConf;
 import org.apache.slider.core.conf.ConfTree;
 import org.apache.slider.core.exceptions.ServiceNotReadyException;
@@ -423,14 +424,12 @@ public class SliderIPCService extends AbstractService
   @Override
   public Messages.GetLiveNodesResponseProto getLiveNodes(Messages.GetLiveNodesRequestProto request)
       throws IOException {
-    Map<String, NodeInformation> infoMap =
-        (Map<String, NodeInformation>) cache.lookupWithIOE(LIVE_NODES);
+    NodeInformationList info = (NodeInformationList) cache.lookupWithIOE(LIVE_NODES);
     Messages.GetLiveNodesResponseProto.Builder builder =
         Messages.GetLiveNodesResponseProto.newBuilder();
 
-    for (Map.Entry<String, NodeInformation> entry : infoMap.entrySet()) {
-      builder.addNames(entry.getKey());
-      builder.addNodes(marshall(entry.getValue()));
+    for (NodeInformation nodeInformation : info) {
+      builder.addNodes(marshall(nodeInformation));
     }
     return builder.build();
   }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/cc94e056/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java
index 1b54a31..52068d6 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java
@@ -26,6 +26,7 @@ import org.apache.slider.api.types.ApplicationLivenessInformation;
 import org.apache.slider.api.types.ComponentInformation;
 import org.apache.slider.api.types.ContainerInformation;
 import org.apache.slider.api.types.NodeInformation;
+import org.apache.slider.api.types.NodeInformationList;
 import org.apache.slider.core.conf.AggregateConf;
 import org.apache.slider.core.conf.ConfTree;
 import org.apache.slider.core.exceptions.NoSuchNodeException;
@@ -350,31 +351,31 @@ TODO: decide what structure to return here, then implement
   @GET
   @Path(LIVE_NODES)
   @Produces({APPLICATION_JSON})
-  public Map<String, NodeInformation> getLiveNodes() {
+  public NodeInformationList getLiveNodes() {
     markGet(SLIDER_SUBPATH_APPLICATION, LIVE_COMPONENTS);
     try {
-      return (Map<String, NodeInformation>) cache.lookup(LIVE_NODES);
+      return (NodeInformationList) cache.lookup(LIVE_NODES);
     } catch (Exception e) {
       throw buildException(LIVE_COMPONENTS, e);
     }
   }
 
   @GET
-  @Path(LIVE_NODES + "/{node}")
+  @Path(LIVE_NODES + "/{hostname}")
   @Produces({APPLICATION_JSON})
-  public NodeInformation getLiveNode(@PathParam("node") String node) {
+  public NodeInformation getLiveNode(@PathParam("hostname") String hostname) {
     markGet(SLIDER_SUBPATH_APPLICATION, LIVE_COMPONENTS);
     try {
-      NodeInformation ni = state.getNodeInformation(node);
+      NodeInformation ni = state.getNodeInformation(hostname);
       if (ni != null) {
         return ni;
       } else {
-        throw new NotFoundException("Unknown node: " + node);
+        throw new NotFoundException("Unknown node: " + hostname);
       }
     } catch (NotFoundException e) {
       throw e;
     } catch (Exception e) {
-      throw buildException(LIVE_CONTAINERS + "/" + node, e);
+      throw buildException(LIVE_COMPONENTS + "/" + hostname, e);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/cc94e056/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveNodesRefresher.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveNodesRefresher.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveNodesRefresher.java
index d4ab8fe..aeb7a11 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveNodesRefresher.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/resources/LiveNodesRefresher.java
@@ -18,16 +18,14 @@
 
 package org.apache.slider.server.appmaster.web.rest.application.resources;
 
-import org.apache.slider.api.types.NodeInformation;
+import org.apache.slider.api.types.NodeInformationList;
 import org.apache.slider.server.appmaster.state.StateAccessForProviders;
 
-import java.util.Map;
-
 /**
  * Update the live nodes map
  */
 public class LiveNodesRefresher
-    implements ResourceRefresher<Map<String, NodeInformation>> {
+    implements ResourceRefresher<NodeInformationList> {
 
   private final StateAccessForProviders state;
 
@@ -36,7 +34,8 @@ public class LiveNodesRefresher
   }
 
   @Override
-  public Map<String, NodeInformation> refresh() {
-    return state.getNodeInformationSnapshot();
+  public NodeInformationList refresh() {
+
+    return new NodeInformationList(state.getNodeInformationSnapshot().values());
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/cc94e056/slider-core/src/main/proto/SliderClusterMessages.proto
----------------------------------------------------------------------
diff --git a/slider-core/src/main/proto/SliderClusterMessages.proto b/slider-core/src/main/proto/SliderClusterMessages.proto
index 2836454..9a4265c 100644
--- a/slider-core/src/main/proto/SliderClusterMessages.proto
+++ b/slider-core/src/main/proto/SliderClusterMessages.proto
@@ -25,10 +25,7 @@ package org.apache.slider.api;
 //import "Security.proto";
 
 /*
- To debug compilation problems, bypass the maven build and invoke protoc
- from the command line
-
-  protoc --java_out=target src/main/proto/SliderClusterMessages.proto
+  Look at SliderClusterProtocol.proto to see how to build this
 */
 
 message RoleInstanceState {
@@ -390,8 +387,7 @@ message GetLiveNodesRequestProto {
 }
 
 message GetLiveNodesResponseProto {
-  repeated string names = 1;
-  repeated NodeInformationProto nodes = 2;
+  repeated NodeInformationProto nodes = 1;
 }
 
 message GetLiveNodeRequestProto {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/cc94e056/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy
index 6d1bcfc..6727a29 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/rest/AbstractAppApiTestDelegates.groovy
@@ -24,10 +24,8 @@ import org.apache.slider.api.SliderApplicationApi
 import org.apache.slider.api.StateValues
 import org.apache.slider.api.types.ComponentInformation
 import org.apache.slider.api.types.ContainerInformation
-import org.apache.slider.api.types.NodeInformation
 import org.apache.slider.core.conf.ConfTreeOperations
 import org.apache.slider.test.Outcome
-import org.junit.Test
 
 import static org.apache.slider.api.ResourceKeys.*
 import static org.apache.slider.api.StatusKeys.*
@@ -210,10 +208,10 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega
     describe "Node listing via $appAPI"
     def liveNodes = appAPI.liveNodes
     assert liveNodes.size() > 0
-    def h = liveNodes.keySet()[0];
+    prettyPrintAsJson(liveNodes)
+    def h = liveNodes[0].hostname;
     def localhost = appAPI.getLiveNode(h)
-
-
+    assert localhost.httpAddress == liveNodes[0].httpAddress
   }
 
   /**
@@ -239,7 +237,7 @@ public abstract class AbstractAppApiTestDelegates extends AbstractRestTestDelega
     testLiveContainers();
     testRESTModel()
     testAppLiveness()
-//    testListNodes();
+    testListNodes();
   }
 
   public void testFlexOperation() {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/cc94e056/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAAEcho.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAAEcho.groovy b/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAAEcho.groovy
index 255dcaf..7072fc6 100644
--- a/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAAEcho.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAAEcho.groovy
@@ -135,6 +135,7 @@ class TestAgentAAEcho extends TestAgentEcho {
     //expect the role count to be the same
     waitForRoleCount(sliderClient, onlyOneEcho, 1000)
 
+    def echoInstances = sliderClient.listNodeUUIDsByRole(roleName)
     queryRestAPI(sliderClient, roles, proxyAM)
     // flex size
     // while running, ask for many more, expect them to still be outstanding
@@ -147,6 +148,9 @@ class TestAgentAAEcho extends TestAgentEcho {
     sliderClient.flex(clustername, onlyOneEcho);
     waitForRoleCount(sliderClient, onlyOneEcho, 1000)
 
+    def echoInstances2 = sliderClient.listNodeUUIDsByRole(roleName)
+    assertArrayEquals(echoInstances, echoInstances2)
+
   }
 
   protected void queryRestAPI(SliderClient sliderClient, Map<String, Integer> roles, String proxyAM) {


[04/17] incubator-slider git commit: SLIDER-82 some cleanup of ClusterDescription & related classes during test coding

Posted by st...@apache.org.
SLIDER-82 some cleanup of ClusterDescription & related classes during test coding


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

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: 781d3322a0f5b3121a3618facbe78e0670897c03
Parents: ba33ece
Author: Steve Loughran <st...@apache.org>
Authored: Wed Nov 18 22:00:50 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Nov 18 22:00:50 2015 +0000

----------------------------------------------------------------------
 .../apache/slider/api/ClusterDescription.java   | 45 ++++++++++----------
 .../api/ClusterDescriptionOperations.java       |  3 +-
 .../java/org/apache/slider/api/ClusterNode.java |  2 +-
 .../java/org/apache/slider/api/RoleKeys.java    | 15 -------
 .../apache/slider/api/SliderApplicationApi.java | 12 +++---
 5 files changed, 30 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/781d3322/slider-core/src/main/java/org/apache/slider/api/ClusterDescription.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/ClusterDescription.java b/slider-core/src/main/java/org/apache/slider/api/ClusterDescription.java
index 7e3a9b4..8358491 100644
--- a/slider-core/src/main/java/org/apache/slider/api/ClusterDescription.java
+++ b/slider-core/src/main/java/org/apache/slider/api/ClusterDescription.java
@@ -65,6 +65,12 @@ import static org.apache.slider.api.OptionKeys.ZOOKEEPER_QUORUM;
  * As a wire format it is less efficient in both xfer and ser/deser than 
  * a binary format, but by having one unified format for wire and persistence,
  * the code paths are simplified.
+ *
+ * This was the original single-file specification/model used in the Hoya
+ * precursor to Slider. Its now retained primarily as a way to publish
+ * the current state of the application, or at least a fraction thereof ...
+ * the larger set of information from the REST API is beyond the scope of
+ * this structure.
  */
 @JsonIgnoreProperties(ignoreUnknown = true)
 @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@@ -165,41 +171,35 @@ public class ClusterDescription implements Cloneable {
    * cluster-specific options -to control both
    * the Slider AM and the application that it deploys
    */
-  public Map<String, String> options =
-    new HashMap<>();
+  public Map<String, String> options = new HashMap<>();
 
   /**
    * cluster information
    * This is only valid when querying the cluster status.
    */
-  public Map<String, String> info =
-    new HashMap<>();
+  public Map<String, String> info = new HashMap<>();
 
   /**
    * Statistics. This is only relevant when querying the cluster status
    */
-  public Map<String, Map<String, Integer>> statistics =
-    new HashMap<String, Map<String, Integer>>();
+  public Map<String, Map<String, Integer>> statistics = new HashMap<>();
 
   /**
    * Instances: role->count
    */
-  public Map<String, List<String>> instances =
-    new HashMap<String, List<String>>();
+  public Map<String, List<String>> instances = new HashMap<>();
 
   /**
    * Role options, 
    * role -> option -> value
    */
-  public Map<String, Map<String, String>> roles =
-    new HashMap<String, Map<String, String>>();
+  public Map<String, Map<String, String>> roles = new HashMap<>();
 
 
   /**
    * List of key-value pairs to add to a client config to set up the client
    */
-  public Map<String, String> clientProperties =
-    new HashMap<>();
+  public Map<String, String> clientProperties = new HashMap<>();
 
   /**
    * Status information
@@ -218,7 +218,6 @@ public class ClusterDescription implements Cloneable {
   public ClusterDescription() {
   }
 
-
   @Override
   public String toString() {
     try {
@@ -284,8 +283,8 @@ public class ClusterDescription implements Cloneable {
    * @param dataOutputStream an outout stream that will always be closed
    * @throws IOException any failure
    */
-  private void writeJsonAsBytes(DataOutputStream dataOutputStream) throws
-                                                                   IOException {
+  private void writeJsonAsBytes(DataOutputStream dataOutputStream)
+      throws IOException {
     try {
       String json = toJsonString();
       byte[] b = json.getBytes(UTF_8);
@@ -303,7 +302,7 @@ public class ClusterDescription implements Cloneable {
    * @throws IOException IO problems
    */
   public static ClusterDescription load(FileSystem fs, Path path)
-    throws IOException, JsonParseException, JsonMappingException {
+      throws IOException, JsonParseException, JsonMappingException {
     FileStatus status = fs.getFileStatus(path);
     byte[] b = new byte[(int) status.getLen()];
     FSDataInputStream dataInputStream = fs.open(path);
@@ -389,7 +388,7 @@ public class ClusterDescription implements Cloneable {
     try {
       return mapper.readValue(jsonFile, ClusterDescription.class);
     } catch (IOException e) {
-      log.error("Exception while parsing json file {}: {}" , jsonFile, e);
+      log.error("Exception while parsing json file {}" , jsonFile, e);
       throw e;
     }
   }
@@ -528,20 +527,20 @@ public class ClusterDescription implements Cloneable {
     }
     String val = roleopts.get(option);
     if (val == null) {
-      throw new BadConfigException("Missing option '%s' in role %s ", option,
-                                   role);
+      throw new BadConfigException("Missing option '%s' in role %s ", option, role);
     }
     return val;
   }
-    /**
+
+  /**
    * Get a mandatory integer role option
    * @param role role to get from
    * @param option option name
    * @return resolved value
    * @throws BadConfigException if the option is not defined
    */
-  public int getMandatoryRoleOptInt(String role, String option) throws
-                                                                BadConfigException {
+  public int getMandatoryRoleOptInt(String role, String option)
+      throws BadConfigException {
     getMandatoryRoleOpt(role, option);
     return getRoleOptInt(role, option, 0);
   }
@@ -575,7 +574,7 @@ public class ClusterDescription implements Cloneable {
    */
   @JsonIgnore
   public Set<String> getRoleNames() {
-    return new HashSet<String>(roles.keySet());
+    return new HashSet<>(roles.keySet());
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/781d3322/slider-core/src/main/java/org/apache/slider/api/ClusterDescriptionOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/ClusterDescriptionOperations.java b/slider-core/src/main/java/org/apache/slider/api/ClusterDescriptionOperations.java
index 21ece2b..5b95414 100644
--- a/slider-core/src/main/java/org/apache/slider/api/ClusterDescriptionOperations.java
+++ b/slider-core/src/main/java/org/apache/slider/api/ClusterDescriptionOperations.java
@@ -80,8 +80,7 @@ public class ClusterDescriptionOperations {
   }
 
   private static void mergeInComponentMap(ClusterDescription cd,
-                                          ConfTree confTree
-                                          ) {
+                                          ConfTree confTree) {
 
     Map<String, Map<String, String>> components = confTree.components;
     for (Map.Entry<String, Map<String, String>> compEntry : components.entrySet()) {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/781d3322/slider-core/src/main/java/org/apache/slider/api/ClusterNode.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/ClusterNode.java b/slider-core/src/main/java/org/apache/slider/api/ClusterNode.java
index 2608cd7..1b638bd 100644
--- a/slider-core/src/main/java/org/apache/slider/api/ClusterNode.java
+++ b/slider-core/src/main/java/org/apache/slider/api/ClusterNode.java
@@ -165,7 +165,7 @@ public final class ClusterNode implements Cloneable {
     try {
       return mapper.readValue(json, ClusterNode.class);
     } catch (IOException e) {
-      LOG.error("Exception while parsing json : " + e + "\n" + json, e);
+      LOG.error("Exception while parsing json : {}\n{}", e , json, e);
       throw e;
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/781d3322/slider-core/src/main/java/org/apache/slider/api/RoleKeys.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/RoleKeys.java b/slider-core/src/main/java/org/apache/slider/api/RoleKeys.java
index 4512354..8b2945e 100644
--- a/slider-core/src/main/java/org/apache/slider/api/RoleKeys.java
+++ b/slider-core/src/main/java/org/apache/slider/api/RoleKeys.java
@@ -98,19 +98,4 @@ public interface RoleKeys {
    */
   String ENV_PREFIX = "env.";
 
-
-  /**
-   * Default no. of cores in the AM {@value}
-   */
-  int DEFAULT_AM_V_CORES = 1;
-  
-  /**
-   * The default memory of the AM:  {@value}
-   */
-  int DEFAULT_AM_MEMORY = 1024;
-
-  /**
-   * The default heap of the AM:  {@value}
-   */
-  String DEFAULT_AM_HEAP = "512M";
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/781d3322/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java b/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java
index 3668c66..750dba5 100644
--- a/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java
+++ b/slider-core/src/main/java/org/apache/slider/api/SliderApplicationApi.java
@@ -37,7 +37,7 @@ public interface SliderApplicationApi {
   /**
    * Get the aggregate desired model
    * @return the aggregate configuration of what was asked for
-   * —before resolution has taken place
+   * -before resolution has taken place
    * @throws IOException on any failure
    */
   AggregateConf getDesiredModel() throws IOException;
@@ -45,7 +45,7 @@ public interface SliderApplicationApi {
   /**
    * Get the desired application configuration
    * @return the application configuration asked for
-   * —before resolution has taken place
+   * -before resolution has taken place
    * @throws IOException on any failure
    */
   ConfTreeOperations getDesiredAppconf() throws IOException;
@@ -53,7 +53,7 @@ public interface SliderApplicationApi {
   /**
    * Get the desired YARN resources
    * @return the resources asked for
-   * —before resolution has taken place
+   * -before resolution has taken place
    * @throws IOException on any failure
    */
   ConfTreeOperations getDesiredResources() throws IOException;
@@ -69,7 +69,7 @@ public interface SliderApplicationApi {
   /**
    * Get the aggregate resolved model
    * @return the aggregate configuration of what was asked for
-   * —after resolution has taken place
+   * -after resolution has taken place
    * @throws IOException on any failure
    */
   AggregateConf getResolvedModel() throws IOException;
@@ -77,7 +77,7 @@ public interface SliderApplicationApi {
   /**
    * Get the resolved application configuration
    * @return the application configuration asked for
-   * —after resolution has taken place
+   * -after resolution has taken place
    * @throws IOException on any failure
    */
   ConfTreeOperations getResolvedAppconf() throws IOException;
@@ -85,7 +85,7 @@ public interface SliderApplicationApi {
   /**
    * Get the resolved YARN resources
    * @return the resources asked for
-   * —after resolution has taken place
+   * -after resolution has taken place
    * @throws IOException on any failure
    */
   ConfTreeOperations getResolvedResources() throws IOException;


[06/17] incubator-slider git commit: SLIDER-970: AASleepIT: initial AA test, hard coded to 1 node cluster

Posted by st...@apache.org.
SLIDER-970: AASleepIT: initial AA test, hard coded to 1 node cluster


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

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: a6eb923cbdf4f1585f592c175c1f8778885a4373
Parents: 082eb0c
Author: Steve Loughran <st...@apache.org>
Authored: Wed Nov 18 22:02:00 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Nov 18 22:02:00 2015 +0000

----------------------------------------------------------------------
 .../test_min_pkg/sleep_cmd/resources.json       |   2 +-
 .../slider/funtest/lifecycle/AASleepIT.groovy   | 107 +++++++++++++++++++
 2 files changed, 108 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/a6eb923c/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
----------------------------------------------------------------------
diff --git a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
index d2ab4f9..c5d7a2a 100644
--- a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
+++ b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
@@ -15,7 +15,7 @@
     },
     "SLEEP_LONG": {
       "yarn.role.priority": "1",
-      "yarn.component.instances": "1",
+      "yarn.component.instances": "0",
       "yarn.memory": "256",
       "yarn.placement.policy": "4"
     }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/a6eb923c/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
new file mode 100644
index 0000000..e4a5d83
--- /dev/null
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.slider.funtest.lifecycle
+
+import groovy.transform.CompileStatic
+import groovy.util.logging.Slf4j
+import org.apache.hadoop.yarn.api.records.YarnApplicationState
+import org.apache.slider.common.SliderExitCodes
+import org.apache.slider.common.params.Arguments
+import org.apache.slider.common.params.SliderActions
+import org.apache.slider.funtest.ResourcePaths
+import org.apache.slider.funtest.framework.AgentCommandTestBase
+import org.apache.slider.funtest.framework.FuntestProperties
+import org.apache.slider.funtest.framework.SliderShell
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+
+@CompileStatic
+@Slf4j
+public class AASleepIT extends AgentCommandTestBase
+    implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
+
+
+  static String CLUSTER = "test-aa-sleep"
+
+  static String TEST_RESOURCE = ResourcePaths.SLEEP_RESOURCES
+  static String TEST_METADATA = ResourcePaths.SLEEP_META
+  public static final String SLEEP_100 = "SLEEP_100"
+  public static final String SLEEP_LONG = "SLEEP_LONG"
+
+  @Before
+  public void prepareCluster() {
+    setupCluster(CLUSTER)
+  }
+
+  @After
+  public void destroyCluster() {
+    cleanup(CLUSTER)
+  }
+
+  @Test
+  public void testAASleepIt() throws Throwable {
+    describe("Test Anti-Affinity Placement")
+    def clusterpath = buildClusterPath(CLUSTER)
+    File launchReportFile = createTempJsonFile();
+
+    // TODO: Determine YARN cluster size via an API/CLI Call, maybe use labels too?
+    int yarnClusterSize = 1;
+    int desired = yarnClusterSize + 1
+    SliderShell shell = createSliderApplicationMinPkg(CLUSTER,
+        TEST_METADATA,
+        TEST_RESOURCE,
+        null,
+        [ARG_RES_COMP_OPT, SLEEP_LONG, "$desired"],
+        launchReportFile)
+
+    logShell(shell)
+
+    def appId = ensureYarnApplicationIsUp(launchReportFile)
+
+    //at this point the cluster should exist.
+    assertPathExists(
+        clusterFS,
+        "Cluster parent directory does not exist",
+        clusterpath.parent)
+
+    assertPathExists(clusterFS, "Cluster directory does not exist", clusterpath)
+
+    status(0, CLUSTER)
+    expectLiveContainerCountReached(CLUSTER, SLEEP_100, desired -1 ,
+        CONTAINER_LAUNCH_TIMEOUT)
+
+    // sleep for some manual test
+    describe("You may quickly perform manual tests against the application instance $CLUSTER")
+    sleep(1000 * 30)
+
+    //stop
+    freeze(0, CLUSTER,
+        [
+            ARG_WAIT, Integer.toString(FREEZE_WAIT_TIME),
+            ARG_MESSAGE, "final-shutdown"
+        ])
+
+    assertInYarnState(appId, YarnApplicationState.FINISHED)
+    destroy(0, CLUSTER)
+
+    //cluster now missing
+    exists(EXIT_UNKNOWN_INSTANCE, CLUSTER)
+  }
+}


[16/17] incubator-slider git commit: SLIDER-994 node information map to list node entries by role name, not priority

Posted by st...@apache.org.
SLIDER-994 node information map to list node entries by role name, not priority


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

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: 737d7875120fe29d8d8d9de4317b4f2e188c0022
Parents: 4fb381e
Author: Steve Loughran <st...@apache.org>
Authored: Fri Nov 20 20:16:31 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Fri Nov 20 20:16:31 2015 +0000

----------------------------------------------------------------------
 .../slider/server/appmaster/state/AppState.java     | 14 +++++++-------
 .../slider/server/appmaster/state/NodeInstance.java | 10 ++++++++--
 .../server/appmaster/state/ProviderAppState.java    | 16 ++++++++++++++--
 .../slider/server/appmaster/state/RoleHistory.java  | 14 ++++++++++----
 4 files changed, 39 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/737d7875/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
index ee5d43d..171cc42 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
@@ -107,6 +107,7 @@ import static org.apache.slider.api.RoleKeys.ROLE_FAILED_INSTANCES;
 import static org.apache.slider.api.RoleKeys.ROLE_FAILED_RECENTLY_INSTANCES;
 import static org.apache.slider.api.RoleKeys.ROLE_FAILED_STARTING_INSTANCES;
 import static org.apache.slider.api.RoleKeys.ROLE_NODE_FAILED_INSTANCES;
+import static org.apache.slider.api.RoleKeys.ROLE_PENDING_AA_INSTANCES;
 import static org.apache.slider.api.RoleKeys.ROLE_PREEMPTED_INSTANCES;
 import static org.apache.slider.api.RoleKeys.ROLE_RELEASING_INSTANCES;
 import static org.apache.slider.api.RoleKeys.ROLE_REQUESTED_INSTANCES;
@@ -911,10 +912,6 @@ public class AppState {
     appMasterNode.state = STATE_LIVE;
   }
 
-  public RoleInstance getAppMasterNode() {
-    return appMasterNode;
-  }
-
   /**
    * Look up the status entry of a role or raise an exception
    * @param key role ID
@@ -1717,13 +1714,13 @@ public class AppState {
                    now);
     if (providerStatus != null) {
       for (Map.Entry<String, String> entry : providerStatus.entrySet()) {
-        cd.setInfo(entry.getKey(),entry.getValue());
+        cd.setInfo(entry.getKey(), entry.getValue());
       }
     }
     MapOperations infoOps = new MapOperations("info", cd.info);
     infoOps.mergeWithoutOverwrite(applicationInfo);
     SliderUtils.addBuildInfo(infoOps, "status");
-    cd.statistics = new HashMap<String, Map<String, Integer>>();
+    cd.statistics = new HashMap<>();
 
     // build the map of node -> container IDs
     Map<String, List<String>> instanceMap = createRoleToInstanceMap();
@@ -1732,7 +1729,7 @@ public class AppState {
     //build the map of node -> containers
     Map<String, Map<String, ClusterNode>> clusterNodes =
       createRoleToClusterNodeMap();
-    cd.status = new HashMap<String, Object>();
+    cd.status = new HashMap<>();
     cd.status.put(ClusterDescriptionKeys.KEY_CLUSTER_LIVE, clusterNodes);
 
 
@@ -1750,6 +1747,9 @@ public class AppState {
       cd.setRoleOpt(rolename, ROLE_FAILED_RECENTLY_INSTANCES, role.getFailedRecently());
       cd.setRoleOpt(rolename, ROLE_NODE_FAILED_INSTANCES, role.getNodeFailed());
       cd.setRoleOpt(rolename, ROLE_PREEMPTED_INSTANCES, role.getPreempted());
+      if (role.isAntiAffinePlacement()) {
+        cd.setRoleOpt(rolename, ROLE_PENDING_AA_INSTANCES, role.getPendingAntiAffineRequests());
+      }
       Map<String, Integer> stats = role.buildStatistics();
       cd.statistics.put(rolename, stats);
     }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/737d7875/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeInstance.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeInstance.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeInstance.java
index 8d63239..cc17cf0 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeInstance.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeInstance.java
@@ -31,6 +31,7 @@ import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.ListIterator;
+import java.util.Map;
 
 /**
  * A node instance -stores information about a node in the cluster.
@@ -299,9 +300,10 @@ public class NodeInstance {
 
   /**
    * Produced a serialized form which can be served up as JSON
+   * @param naming map of priority -> value for naming entries
    * @return a summary of the current role status.
    */
-  public synchronized NodeInformation serialize() {
+  public synchronized NodeInformation serialize(Map<Integer, String> naming) {
     NodeInformation info = new NodeInformation();
     info.hostname = hostname;
     // null-handling state constructor
@@ -315,7 +317,11 @@ public class NodeInstance {
     }
     info.entries = new HashMap<>(nodeEntries.size());
     for (NodeEntry nodeEntry : nodeEntries) {
-      info.entries.put(Integer.toString(nodeEntry.rolePriority), nodeEntry.serialize());
+      String name = naming.get(nodeEntry.rolePriority);
+      if (name == null) {
+        name = Integer.toString(nodeEntry.rolePriority);
+      }
+      info.entries.put(name, nodeEntry.serialize());
     }
     return info;
   }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/737d7875/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java
index 1d96a1c..f544c6a 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/ProviderAppState.java
@@ -37,6 +37,7 @@ import org.apache.slider.server.services.utility.PatternValidator;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -291,12 +292,23 @@ public class ProviderAppState implements StateAccessForProviders {
 
   @Override
   public Map<String, NodeInformation> getNodeInformationSnapshot() {
-    return appState.getRoleHistory().getNodeInformationSnapshot();
+    return appState.getRoleHistory()
+      .getNodeInformationSnapshot(buildingNamingMap());
+  }
+
+  private Map<Integer, String> buildingNamingMap() {
+    Map<Integer, RoleStatus> statusMap = getRoleStatusMap();
+    Map<Integer, String> naming = new HashMap<>(statusMap.size());
+    for (Map.Entry<Integer, RoleStatus> entry : statusMap.entrySet()) {
+      naming.put(entry.getKey(), entry.getValue().getName());
+    }
+    return naming;
   }
 
   @Override
   public NodeInformation getNodeInformation(String hostname) {
-    return appState.getRoleHistory().getNodeInformation(hostname);
+    return appState.getRoleHistory().getNodeInformation(hostname,
+      buildingNamingMap());
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/737d7875/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleHistory.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleHistory.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleHistory.java
index 4d9781d..0584d30 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleHistory.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/RoleHistory.java
@@ -309,11 +309,14 @@ public class RoleHistory {
   /**
    * Get snapshot of the node map
    * @return a snapshot of the current node state
+   * @param naming naming map of priority to enty name; entries must be unique.
+   * It's OK to be incomplete, for those the list falls back to numbers.
    */
-  public synchronized Map<String, NodeInformation> getNodeInformationSnapshot() {
+  public synchronized Map<String, NodeInformation> getNodeInformationSnapshot(
+    Map<Integer, String> naming) {
     Map<String, NodeInformation> result = new HashMap<>(nodemap.size());
     for (Map.Entry<String, NodeInstance> entry : nodemap.entrySet()) {
-      result.put(entry.getKey(), entry.getValue().serialize());
+      result.put(entry.getKey(), entry.getValue().serialize(naming));
     }
     return result;
   }
@@ -321,11 +324,14 @@ public class RoleHistory {
   /**
    * Get the information on a node
    * @param hostname hostname
+   * @param naming naming map of priority to enty name; entries must be unique.
+   * It's OK to be incomplete, for those the list falls back to numbers.
    * @return the information about that host, or null if there is none
    */
-  public NodeInformation getNodeInformation(String hostname) {
+  public NodeInformation getNodeInformation(String hostname,
+    Map<Integer, String> naming) {
     NodeInstance nodeInstance = nodemap.get(hostname);
-    return nodeInstance != null ? nodeInstance.serialize() : null;
+    return nodeInstance != null ? nodeInstance.serialize(naming) : null;
   }
 
   /**


[08/17] incubator-slider git commit: SLIDER-995 Add option to declare that a keytab *must* exist when launching an app

Posted by st...@apache.org.
SLIDER-995 Add option to declare that a keytab *must* exist when launching an app


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

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: ee6e5f69536a2cb38ae2b8b4f1e365dac7ef7a68
Parents: 10abc40
Author: Steve Loughran <st...@apache.org>
Authored: Thu Nov 19 18:40:38 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Nov 19 18:40:38 2015 +0000

----------------------------------------------------------------------
 slider-assembly/src/conf/slider-client.xml      | 45 ++++++++++++++------
 .../apache/slider/common/SliderXmlConfKeys.java |  2 +
 .../providers/AbstractProviderService.java      | 12 +-----
 .../slideram/SliderAMClientProvider.java        | 17 +++++---
 .../slideram/SliderAMProviderService.java       |  3 +-
 5 files changed, 49 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ee6e5f69/slider-assembly/src/conf/slider-client.xml
----------------------------------------------------------------------
diff --git a/slider-assembly/src/conf/slider-client.xml b/slider-assembly/src/conf/slider-client.xml
index 3a42bee..9c2e76d 100644
--- a/slider-assembly/src/conf/slider-client.xml
+++ b/slider-assembly/src/conf/slider-client.xml
@@ -22,14 +22,6 @@
 -->
 <configuration>
 
-  <!--
-     The recommended approach is to configure slider-env.sh and set HADOOP_CONF_DIR.
-     Otherwise, appropriate configurations from hdfs-site, yarn-site, can be dropped in this file
-     for Slider client to work. The following list is not an exhaustive list but the minimal config
-     needed to interact with a non-secure cluster.
-  -->
-
-  <!--
     <property>
       <name>slider.client.resource.origin</name>
       <value>conf/slider-client.xml</value>
@@ -37,14 +29,41 @@
     </property>
 
     <property>
-      <name>yarn.log-aggregation-enable</name>
-      <value>true</value>
+      <name>slider.security.protocol.acl</name>
+      <value>*</value>
+      <description>When security is enabled, set appropriate acl. Default value means allow everyone.</description>
     </property>
 
     <property>
-        <name>slider.security.protocol.acl</name>
-      <value>*</value>
-      <description>When security is enabled, set appropriate acl. Default value means allow everyone.</description>
+      <name>slider.yarn.queue</name>
+      <value/>
+      <description>the name of the YARN queue to use.</description>
+    </property>
+
+    <property>
+      <name>slider.yarn.queue.priority</name>
+      <value>1</value>
+      <description>the priority of the application.</description>
+    </property>
+
+    <property>
+      <name>slider.am.login.keytab.required</name>
+      <value>false</value>
+      <description>Declare that a keytab must be provided.</description>
+    </property>
+
+  <!--
+   The recommended approach is to configure slider-env.sh and set HADOOP_CONF_DIR.
+   Otherwise, appropriate configurations from hdfs-site, yarn-site, can be dropped in this file
+   for Slider client to work. The following list is not an exhaustive list but the minimal config
+   needed to interact with a non-secure cluster.
+  -->
+
+  <!--
+
+    <property>
+      <name>yarn.log-aggregation-enable</name>
+      <value>true</value>
     </property>
 
     <property>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ee6e5f69/slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java b/slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java
index 07214b2..26109a7 100644
--- a/slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java
+++ b/slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java
@@ -125,6 +125,8 @@ public interface SliderXmlConfKeys {
       "hadoop.http.filter.initializers";
   String KEY_KEYSTORE_LOCATION = "ssl.server.keystore.location";
   String KEY_AM_LOGIN_KEYTAB_NAME = "slider.am.login.keytab.name";
+  /** Declare that a keytab must be provided */
+  String KEY_AM_LOGIN_KEYTAB_REQUIRED = "slider.am.login.keytab.required";
   String KEY_HDFS_KEYTAB_DIR = "slider.hdfs.keytab.dir";
   String KEY_AM_KEYTAB_LOCAL_PATH = "slider.am.keytab.local.path";
   String KEY_KEYTAB_PRINCIPAL = "slider.keytab.principal.name";

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ee6e5f69/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java b/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
index 7cba840..c701a55 100644
--- a/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
+++ b/slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
@@ -81,7 +81,7 @@ public abstract class AbstractProviderService
   protected YarnRegistryViewForProviders yarnRegistry;
   protected QueueAccess queueAccess;
 
-  public AbstractProviderService(String name) {
+  protected AbstractProviderService(String name) {
     super(name);
     setStopIfNoChildServicesAtStartup(false);
   }
@@ -343,12 +343,6 @@ public abstract class AbstractProviderService
 
     return details;
   }
-  
-  protected String getInfoAvoidingNull(ClusterDescription clusterDesc, String key) {
-    String value = clusterDesc.getInfo(key);
-
-    return null == value ? "N/A" : value;
-  }
 
   @Override
   public void buildEndpointDetails(Map<String, String> details) {
@@ -363,10 +357,8 @@ public abstract class AbstractProviderService
           if (!urls.isEmpty()) {
             details.put(endpoint.api, urls.get(0).toString());
           }
-        } catch (InvalidRecordException ignored) {
+        } catch (InvalidRecordException  | MalformedURLException ignored) {
           // Ignored
-        } catch (MalformedURLException ignored) {
-          // ignored
         }
 
       }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ee6e5f69/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMClientProvider.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMClientProvider.java b/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMClientProvider.java
index 3be0f48..e5430f2 100644
--- a/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMClientProvider.java
+++ b/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMClientProvider.java
@@ -218,11 +218,12 @@ public class SliderAMClientProvider extends AbstractClientProvider
    * @param instanceDescription
    * @param providerResources
    * @throws IOException
+   * @throws BadConfigException if there's no keytab and it is explicitly required.
    */
   protected void addKeytabResourceIfNecessary(SliderFileSystem fileSystem,
                                               AggregateConf instanceDescription,
                                               Map<String, LocalResource> providerResources)
-      throws IOException {
+    throws IOException, BadConfigException {
     if (UserGroupInformation.isSecurityEnabled()) {
       String keytabPathOnHost = instanceDescription.getAppConfOperations()
           .getComponent(SliderKeys.COMPONENT_AM).get(
@@ -243,10 +244,16 @@ public class SliderAMClientProvider extends AbstractClientProvider
           providerResources.put(SliderKeys.KEYTAB_DIR + "/" +
                                  amKeytabName, keytabRes);
         } else {
-          log.warn("No keytab file was found at {}.  The AM will be "
-                   + "started without a kerberos authenticated identity. "
-                   + "The application is therefore not guaranteed to remain "
-                   + "operational beyond 24 hours.", keytabPath);
+          log.warn("No keytab file was found at {}.", keytabPath);
+          if (getConf().getBoolean(KEY_AM_LOGIN_KEYTAB_REQUIRED, false)) {
+            throw new BadConfigException("No keytab file was found at %s.", keytabPath);
+
+          } else {
+            log.warn("The AM will be "
+              + "started without a kerberos authenticated identity. "
+              + "The application is therefore not guaranteed to remain "
+              + "operational beyond 24 hours.");
+          }
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ee6e5f69/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMProviderService.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMProviderService.java b/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMProviderService.java
index cee7a97..e382058 100644
--- a/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMProviderService.java
+++ b/slider-core/src/main/java/org/apache/slider/providers/slideram/SliderAMProviderService.java
@@ -88,12 +88,11 @@ public class SliderAMProviderService extends AbstractProviderService implements
       MapOperations resourceComponent,
       MapOperations appComponent,
       Path containerTmpDirPath) throws IOException, SliderException {
-    
   }
 
   @Override
   public List<ProviderRole> getRoles() {
-    return new ArrayList<ProviderRole>(0);
+    return new ArrayList<>(0);
   }
 
   @Override


[12/17] incubator-slider git commit: SLIDER-970: AASleepIT, test enums cluster size, asks for one more, verifies that it's not there

Posted by st...@apache.org.
SLIDER-970: AASleepIT, test enums cluster size, asks for one more, verifies that it's not there


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

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: 0c1977be6be92962235a12d09745d95360be09c0
Parents: eac0de9
Author: Steve Loughran <st...@apache.org>
Authored: Fri Nov 20 17:49:27 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Fri Nov 20 17:49:27 2015 +0000

----------------------------------------------------------------------
 .../test_min_pkg/sleep_cmd/resources.json       |   2 +-
 .../apache/slider/test/SliderTestUtils.groovy   |  23 ++++
 .../funtest/framework/CommandTestBase.groovy    | 110 ++++++++++++-------
 .../ApplicationWithAddonPackagesIT.groovy       |  19 ----
 .../slider/funtest/lifecycle/AASleepIT.groovy   |  59 ++++++----
 .../funtest/lifecycle/AgentWebPagesIT.groovy    |   1 -
 6 files changed, 132 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/0c1977be/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
----------------------------------------------------------------------
diff --git a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
index 1268996..e0ed16a 100644
--- a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
+++ b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
@@ -17,7 +17,7 @@
       "yarn.role.priority": "2",
       "yarn.component.instances": "0",
       "yarn.memory": "128",
-      "yarn.placement.policy": "4"
+      "yarn.component.placement.policy": "4"
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/0c1977be/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 5ef388a..cb6ce0e 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
@@ -884,6 +884,29 @@ class SliderTestUtils extends Assert {
     log.info("$realkey = $val")
     return val
   }
+  /**
+   * Create a temp JSON file. After coming up with the name, the file
+   * is deleted
+   * @return the filename
+   */
+  public static  File createTempJsonFile() {
+    return tmpFile(".json")
+  }
+
+  /**
+   * Create a temp file with the specific name. It's deleted after creation,
+   * to avoid  "file exists exceptions"
+   * @param suffix suffix, e.g. ".txt"
+   * @return a path to a file which may be created
+   */
+  public static File tmpFile(String suffix) {
+    File reportFile = File.createTempFile(
+        "temp",
+        suffix,
+        new File("target"))
+    reportFile.delete()
+    return reportFile
+  }
 
   /**
    * Execute a closure, assert it fails with a given exit code and text

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/0c1977be/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
index 654ccb3..252bb79 100644
--- a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
+++ b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
@@ -29,6 +29,7 @@ import org.apache.hadoop.util.Shell
 import org.apache.hadoop.yarn.api.records.YarnApplicationState
 import org.apache.hadoop.yarn.conf.YarnConfiguration
 import org.apache.slider.api.StatusKeys
+import org.apache.slider.api.types.NodeInformationList
 import org.apache.slider.client.SliderClient
 import org.apache.slider.common.SliderKeys
 import org.apache.slider.common.SliderXmlConfKeys
@@ -38,6 +39,7 @@ import org.apache.slider.common.tools.SliderUtils
 import org.apache.slider.core.launch.SerializedApplicationReport
 import org.apache.slider.core.main.ServiceLauncher
 import org.apache.slider.core.persist.ApplicationReportSerDeser
+import org.apache.slider.core.persist.JsonSerDeser
 import org.apache.slider.test.SliderTestUtils
 import org.apache.slider.test.Outcome;
 
@@ -206,7 +208,7 @@ abstract class CommandTestBase extends SliderTestUtils {
       return false;
     }
   }
-  
+
   /**
    * Add a jar to the slider classpath by looking up a class and determining
    * its containing JAR
@@ -325,7 +327,6 @@ abstract class CommandTestBase extends SliderTestUtils {
     ])
   }
 
-
   static SliderShell freeze(
       int exitCode,
       String name,
@@ -359,9 +360,9 @@ abstract class CommandTestBase extends SliderTestUtils {
   static SliderShell killContainer(String name, String containerID) {
     slider(0,
         [
-            ACTION_KILL_CONTAINER,
-            name,
-            containerID
+          ACTION_KILL_CONTAINER,
+          name,
+          containerID
         ])
   }
 
@@ -440,9 +441,7 @@ abstract class CommandTestBase extends SliderTestUtils {
   }
 
   static SliderShell registry(Collection<String> commands) {
-    slider(0,
-        [ACTION_REGISTRY] + commands
-    )
+    slider(0, [ACTION_REGISTRY] + commands)
   }
 
   /**
@@ -572,7 +571,7 @@ abstract class CommandTestBase extends SliderTestUtils {
     List<String> argsList = [action, clustername]
 
     argsList << ARG_ZKHOSTS <<
-    SLIDER_CONFIG.getTrimmed(RegistryConstants.KEY_REGISTRY_ZK_QUORUM)
+      SLIDER_CONFIG.getTrimmed(RegistryConstants.KEY_REGISTRY_ZK_QUORUM)
 
 
     if (blockUntilRunning) {
@@ -774,24 +773,6 @@ abstract class CommandTestBase extends SliderTestUtils {
   }
 
   /**
-   * Create a temp JSON file. After coming up with the name, the file
-   * is deleted
-   * @return the filename
-   */
-  public static  File createTempJsonFile() {
-    return tmpFile(".json")
-  }
-
-  public static File tmpFile(String suffix) {
-    File reportFile = File.createTempFile(
-        "launch",
-        suffix,
-        new File("target"))
-    reportFile.delete()
-    return reportFile
-  }
-
-  /**
    * If the option is not null/empty, add the command and the option
    * @param args arg list being built up
    * @param command command to add option
@@ -812,20 +793,20 @@ abstract class CommandTestBase extends SliderTestUtils {
       ApplicationReportSerDeser serDeser = new ApplicationReportSerDeser()
       def report = serDeser.fromFile(reportFile)
       return report
-    }    
+    }
     return null;
-  }  
-   
+  }
+
   public static SerializedApplicationReport loadAppReport(File reportFile) {
     if (reportFile.exists() && reportFile.length() > 0) {
       ApplicationReportSerDeser serDeser = new ApplicationReportSerDeser()
       def report = serDeser.fromFile(reportFile)
       return report
-    }  else {
+    }else {
       throw new FileNotFoundException(reportFile.absolutePath)
-    }  
-  }  
-  
+    }
+  }
+
   public static SerializedApplicationReport maybeLookupFromLaunchReport(File launchReport) {
     def report = maybeLoadAppReport(launchReport)
     if (report) {
@@ -856,7 +837,44 @@ abstract class CommandTestBase extends SliderTestUtils {
     }
   }
 
-  
+  /**
+   * Lookup an application, return null if loading failed
+   * @param id application ID
+   * @return an application report or null
+   */
+  public static NodeInformationList listNodes(boolean healthy = false, String label = "") {
+    File reportFile = createTempJsonFile();
+    try {
+      def shell = nodes(reportFile, healthy, label)
+      shell.dumpOutput()
+      JsonSerDeser<NodeInformationList> serDeser = NodeInformationList.createSerializer();
+      serDeser.fromFile(reportFile)
+    } finally {
+      reportFile.delete()
+    }
+  }
+
+  /**
+   * List cluster nodes
+   * @param out output file (or null)
+   * @param healthy list healthy nodes only
+   * @param label label to filter on
+   * @return output
+   */
+  static SliderShell nodes(File out, boolean healthy = false, String label = "") {
+    def commands = [ACTION_NODES]
+    if (label) {
+      commands += [ ARG_LABEL, label]
+    }
+    if (out) {
+      commands += [ARG_OUTPUT, out.absolutePath]
+    }
+    if (healthy) {
+      commands << ARG_HEALTHY
+    }
+    slider(0, commands)
+  }
+
   public Path buildClusterPath(String clustername) {
     return new Path(
         clusterFS.homeDirectory,
@@ -1274,6 +1292,13 @@ abstract class CommandTestBase extends SliderTestUtils {
     }
   }
 
+  /**
+   * Assert that exactly the number of containers are live
+   * @param clustername name of cluster
+   * @param component component to probe
+   * @param count count
+   * @return
+   */
   public ClusterDescription assertContainersLive(String clustername,
       String component,
       int count) {
@@ -1420,8 +1445,8 @@ abstract class CommandTestBase extends SliderTestUtils {
   }
  
   /**
-   * Is the registry accessible for an application?
-   * @param args argument map containing <code>"application"</code>
+   * probe for the output {@code  command: List} containing {@code text}
+   * @param args argument map containing the required parameters
    * @return probe outcome
    */
   protected Outcome commandOutputContains(Map args) {
@@ -1430,9 +1455,10 @@ abstract class CommandTestBase extends SliderTestUtils {
     SliderShell shell = slider(0, command)
     return Outcome.fromBool(shell.outputContains(text))
   }
+
   /**
-   * Is the registry accessible for an application?
-   * @param args argument map containing <code>"application"</code>
+   * probe for a command {@code command: List} succeeeding
+   * @param args argument map containing the required parameters
    * @return probe outcome
    */
   protected Outcome commandSucceeds(Map args) {
@@ -1440,9 +1466,11 @@ abstract class CommandTestBase extends SliderTestUtils {
     SliderShell shell = slider(command)
     return Outcome.fromBool(shell.ret == 0)
   }
+
   /**
-   * Is the registry accessible for an application?
-   * @param args argument map
+   * probe for a command {@code command: List} generating a file 'filename'
+   * which must contain the text 'text'
+   * @param args argument map containing the required parameters
    * @return probe outcome
    */
   protected Outcome generatedFileContains(Map args) {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/0c1977be/slider-funtest/src/test/groovy/org/apache/slider/funtest/coprocessors/ApplicationWithAddonPackagesIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/coprocessors/ApplicationWithAddonPackagesIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/coprocessors/ApplicationWithAddonPackagesIT.groovy
index 43275e6..b32275e 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/coprocessors/ApplicationWithAddonPackagesIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/coprocessors/ApplicationWithAddonPackagesIT.groovy
@@ -18,28 +18,9 @@ package org.apache.slider.funtest.coprocessors
 
 import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
-
-import org.apache.hadoop.security.UserGroupInformation
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.yarn.api.records.YarnApplicationState
-import org.apache.slider.api.ClusterDescription
-import org.apache.slider.api.StatusKeys
-import org.apache.slider.client.SliderClient
-import org.apache.slider.common.SliderExitCodes
-import org.apache.slider.common.SliderXmlConfKeys
 import org.apache.slider.common.params.Arguments
-import org.apache.slider.common.params.SliderActions
 import org.apache.slider.common.tools.SliderUtils
-import org.apache.slider.funtest.framework.AgentCommandTestBase
-import org.apache.slider.funtest.framework.FuntestProperties
 import org.apache.slider.funtest.framework.SliderShell
-import org.apache.slider.funtest.framework.FileUploader
-import org.junit.After
-import org.junit.Before
-import org.junit.Test
-
 import org.apache.slider.funtest.framework.AgentCommandTestBase
 import org.apache.slider.funtest.framework.CommandTestBase
 import org.junit.After

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/0c1977be/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
index 464b329..054245e 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
@@ -21,7 +21,9 @@ package org.apache.slider.funtest.lifecycle
 import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
 import org.apache.hadoop.yarn.api.records.YarnApplicationState
+import org.apache.slider.api.ClusterDescription
 import org.apache.slider.api.ResourceKeys
+import org.apache.slider.api.types.NodeInformationList
 import org.apache.slider.common.SliderExitCodes
 import org.apache.slider.common.params.Arguments
 import org.apache.slider.common.params.SliderActions
@@ -40,7 +42,7 @@ public class AASleepIT extends AgentCommandTestBase
     implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
 
 
-  static String CLUSTER = "test-aa-sleep"
+  static String NAME = "test-aa-sleep"
 
   static String TEST_RESOURCE = ResourcePaths.SLEEP_RESOURCES
   static String TEST_METADATA = ResourcePaths.SLEEP_META
@@ -49,23 +51,36 @@ public class AASleepIT extends AgentCommandTestBase
 
   @Before
   public void prepareCluster() {
-    setupCluster(CLUSTER)
+    setupCluster(NAME)
   }
 
   @After
   public void destroyCluster() {
-    cleanup(CLUSTER)
+    cleanup(NAME)
   }
 
   @Test
   public void testAASleepIt() throws Throwable {
     describe("Test Anti-Affinity Placement")
-    def clusterpath = buildClusterPath(CLUSTER)
+
+    describe "diagnostics"
+
+    slider([ACTION_DIAGNOSTICS, ARG_VERBOSE, ARG_CLIENT, ARG_YARN, ARG_CREDENTIALS])
+
+    describe "list nodes"
+
+    def healthyNodes = listNodes(true)
+
+    def healthyNodeCount = healthyNodes.size()
+    describe("Cluster nodes : ${healthyNodeCount}")
+    log.info(NodeInformationList.createSerializer().toJson(healthyNodes))
+
     File launchReportFile = createTempJsonFile();
 
-    // TODO: Determine YARN cluster size via an API/CLI Call, maybe use labels too?
-    int desired = buildDesiredCount(1)
-    SliderShell shell = createSliderApplicationMinPkg(CLUSTER,
+    int desired = buildDesiredCount(healthyNodeCount)
+    def clusterpath = buildClusterPath(NAME)
+
+    SliderShell shell = createSliderApplicationMinPkg(NAME,
         TEST_METADATA,
         TEST_RESOURCE,
         ResourcePaths.SLEEP_APPCONFIG,
@@ -84,30 +99,26 @@ public class AASleepIT extends AgentCommandTestBase
 
     assertPathExists(clusterFS, "Cluster directory does not exist", clusterpath)
 
-    status(0, CLUSTER)
+    status(0, NAME)
 
     def expected = buildExpectedCount(desired)
-    expectLiveContainerCountReached(CLUSTER, SLEEP_100, expected,
+    expectLiveContainerCountReached(NAME, SLEEP_100, expected,
         CONTAINER_LAUNCH_TIMEOUT)
 
-    operations(CLUSTER, loadAppReport(launchReportFile), desired, expected)
-
-    // sleep for some manual test
-    describe("You may quickly perform manual tests against the application instance $CLUSTER")
-    sleep(1000 * 30)
+    operations(NAME, loadAppReport(launchReportFile), desired, expected)
 
     //stop
-    freeze(0, CLUSTER,
+    freeze(0, NAME,
         [
             ARG_WAIT, Integer.toString(FREEZE_WAIT_TIME),
             ARG_MESSAGE, "final-shutdown"
         ])
 
     assertInYarnState(appId, YarnApplicationState.FINISHED)
-    destroy(0, CLUSTER)
+    destroy(0, NAME)
 
     //cluster now missing
-    exists(EXIT_UNKNOWN_INSTANCE, CLUSTER)
+    exists(EXIT_UNKNOWN_INSTANCE, NAME)
   }
 
   protected int buildExpectedCount(int desired) {
@@ -122,9 +133,17 @@ public class AASleepIT extends AgentCommandTestBase
       SerializedApplicationReport appReport,
       int desired,
       int expected ) {
-    // sleep for some manual test
-    describe("You may quickly perform manual tests against the application instance $CLUSTER")
-    sleep(1000 * 30)
+
+
+    // now here await for the cluster size to grow: if it does, there's a problem
+    ClusterDescription cd
+    // spin for a while and fail if the number ever goes above it.
+    5.times {
+      cd = assertContainersLive(NAME, SLEEP_LONG, expected)
+      sleep(1000 * 10)
+    }
+
+    // here cluster is still 1 below expected
 
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/0c1977be/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy
index 70f31d5..d1f8f20 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy
@@ -43,7 +43,6 @@ import org.apache.slider.funtest.framework.SliderShell
 import org.apache.slider.server.appmaster.rpc.RpcBinder
 import org.junit.After
 import org.junit.Before
-import org.junit.Ignore
 import org.junit.Test
 
 import static org.apache.slider.server.appmaster.web.rest.RestPaths.SYSTEM_HEALTHCHECK


[11/17] incubator-slider git commit: SLIDER-994 add "nodemap" command to get the (JSON) nodemap of the YARN cluster

Posted by st...@apache.org.
SLIDER-994 add "nodemap" command to get the (JSON) nodemap of the YARN cluster


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

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: eac0de9fcf7260ba8236825986108fc44548788a
Parents: e9c5ebc
Author: Steve Loughran <st...@apache.org>
Authored: Fri Nov 20 17:45:30 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Fri Nov 20 17:45:30 2015 +0000

----------------------------------------------------------------------
 .../slider/api/types/NodeInformation.java       | 23 +++++--
 .../slider/api/types/NodeInformationList.java   | 41 +++++++++++++
 .../org/apache/slider/client/SliderClient.java  | 63 ++++++++++++++++++--
 .../apache/slider/client/SliderClientAPI.java   | 12 ++++
 .../slider/client/SliderYarnClientImpl.java     | 46 ++++++++++++++
 .../slider/common/params/ActionNodesArgs.java   | 20 +++++++
 .../apache/slider/common/tools/SliderUtils.java | 14 +++++
 .../core/launch/JavaCommandLineBuilder.java     |  2 -
 .../slider/core/persist/JsonSerDeser.java       | 45 +++-----------
 .../slider/server/appmaster/state/AppState.java |  7 +--
 .../server/appmaster/state/NodeInstance.java    |  8 +--
 .../slider/client/TestClientBadArgs.groovy      | 16 +++--
 .../client/TestSliderClientMethods.groovy       |  3 +-
 .../client/TestUpgradeCommandOptions.groovy     | 10 +---
 .../slider/providers/agent/TestAgentEcho.groovy | 32 ++++++++++
 15 files changed, 270 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eac0de9f/slider-core/src/main/java/org/apache/slider/api/types/NodeInformation.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/types/NodeInformation.java b/slider-core/src/main/java/org/apache/slider/api/types/NodeInformation.java
index edf7e21..e759bc9 100644
--- a/slider-core/src/main/java/org/apache/slider/api/types/NodeInformation.java
+++ b/slider-core/src/main/java/org/apache/slider/api/types/NodeInformation.java
@@ -33,12 +33,27 @@ import java.util.Map;
 @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
 public class NodeInformation {
 
-  public String healthReport;
   public String hostname;
-  public String httpAddress;
+  public String state;
   public String labels;
-  public long lastUpdated;
   public String rackName;
-  public String state;
+  public String httpAddress;
+  public String healthReport;
+  public long lastUpdated;
   public Map<String, NodeEntryInformation> entries = new HashMap<>();
+
+  @Override
+  public String toString() {
+    final StringBuilder sb = new StringBuilder(
+      "NodeInformation{");
+    sb.append(", hostname='").append(hostname).append('\'');
+    sb.append(", state='").append(state).append('\'');
+    sb.append(", labels='").append(labels).append('\'');
+    sb.append(", rackName='").append(rackName).append('\'');
+    sb.append(", httpAddress='").append(httpAddress).append('\'');
+    sb.append(", healthReport='").append(healthReport).append('\'');
+    sb.append(", lastUpdated=").append(lastUpdated);
+    sb.append('}');
+    return sb.toString();
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eac0de9f/slider-core/src/main/java/org/apache/slider/api/types/NodeInformationList.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/types/NodeInformationList.java b/slider-core/src/main/java/org/apache/slider/api/types/NodeInformationList.java
new file mode 100644
index 0000000..741523e
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/api/types/NodeInformationList.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.slider.api.types;
+
+import org.apache.slider.core.persist.JsonSerDeser;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class NodeInformationList extends ArrayList<NodeInformation> {
+  public NodeInformationList() {
+  }
+
+  public NodeInformationList(Collection<? extends NodeInformation> c) {
+    super(c);
+  }
+
+  public NodeInformationList(int initialCapacity) {
+    super(initialCapacity);
+  }
+
+  public static JsonSerDeser<NodeInformationList> createSerializer() {
+    return new JsonSerDeser<>(NodeInformationList.class);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eac0de9f/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 bfec417..ca9bb12 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
@@ -68,6 +68,7 @@ import org.apache.slider.api.SliderClusterProtocol;
 import org.apache.slider.api.StateValues;
 import org.apache.slider.api.proto.Messages;
 import org.apache.slider.api.types.ContainerInformation;
+import org.apache.slider.api.types.NodeInformationList;
 import org.apache.slider.api.types.SliderInstanceDescription;
 import org.apache.slider.client.ipc.SliderClusterOperations;
 import org.apache.slider.common.Constants;
@@ -91,6 +92,7 @@ import org.apache.slider.common.params.ActionKeytabArgs;
 import org.apache.slider.common.params.ActionKillContainerArgs;
 import org.apache.slider.common.params.ActionListArgs;
 import org.apache.slider.common.params.ActionLookupArgs;
+import org.apache.slider.common.params.ActionNodesArgs;
 import org.apache.slider.common.params.ActionPackageArgs;
 import org.apache.slider.common.params.ActionRegistryArgs;
 import org.apache.slider.common.params.ActionResolveArgs;
@@ -133,6 +135,7 @@ import org.apache.slider.core.main.RunService;
 import org.apache.slider.core.persist.AppDefinitionPersister;
 import org.apache.slider.core.persist.ApplicationReportSerDeser;
 import org.apache.slider.core.persist.ConfPersister;
+import org.apache.slider.core.persist.JsonSerDeser;
 import org.apache.slider.core.persist.LockAcquireFailedException;
 import org.apache.slider.core.registry.SliderRegistryUtils;
 import org.apache.slider.core.registry.YarnAppListClient;
@@ -166,7 +169,6 @@ import org.slf4j.LoggerFactory;
 
 import java.io.BufferedReader;
 import java.io.File;
-import java.io.FilenameFilter;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -333,7 +335,7 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
     if (isUnset(action)) {
       throw new SliderException(EXIT_USAGE, serviceArgs.usage());
     }
-      
+
     int exitCode = EXIT_SUCCESS;
     String clusterName = serviceArgs.getClusterName();
     // actions
@@ -405,11 +407,15 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
       case ACTION_LIST:
         exitCode = actionList(clusterName, serviceArgs.getActionListArgs());
         break;
-      
+
       case ACTION_LOOKUP:
         exitCode = actionLookup(serviceArgs.getActionLookupArgs());
         break;
 
+      case ACTION_NODES:
+        exitCode = actionNodes("", serviceArgs.getActionNodesArgs());
+        break;
+
       case ACTION_PACKAGE:
         exitCode = actionPackage(serviceArgs.getActionPackageArgs());
         break;
@@ -2156,7 +2162,7 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
       log.info("Using queue {} for the application instance.", amQueue);
     }
 
-    if (amQueue != null) {
+    if (isSet(amQueue)) {
       amLauncher.setQueue(amQueue);
     }
 
@@ -4225,6 +4231,55 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
     throw new UsageException("%s %s", errMsg, CommonArgs.usage(serviceArgs,
         actionName));
   }
+
+  /**
+   * List the nodes in the cluster, possibly filtering by node state or label.
+   *
+   * @param args argument list
+   * @return a possibly empty list of nodes in the cluster
+   * @throws IOException IO problems
+   * @throws YarnException YARN problems
+   */
+  @Override
+  public NodeInformationList listYarnClusterNodes(ActionNodesArgs args)
+    throws YarnException, IOException {
+    return yarnClient.listNodes(args.label, args.healthy);
+  }
+
+  /**
+   * List the nodes in the cluster, possibly filtering by node state or label.
+   *
+   * @param args argument list
+   * @return a possibly empty list of nodes in the cluster
+   * @throws IOException IO problems
+   * @throws YarnException YARN problems
+   */
+  public NodeInformationList listInstanceNodes(ActionNodesArgs args)
+    throws YarnException, IOException {
+    return yarnClient.listNodes(args.label, args.healthy);
+  }
+
+  /**
+   * List the nodes in the cluster, possibly filtering by node state or label.
+   * Prints them to stdout unless the args names a file instead.
+   * @param args argument list
+   * @throws IOException IO problems
+   * @throws YarnException YARN problems
+   */
+  public int actionNodes(String instance, ActionNodesArgs args) throws YarnException, IOException {
+
+    args.instance = instance;
+    NodeInformationList nodes = listYarnClusterNodes(args);
+    log.debug("Node listing for {} has {} nodes", args, nodes.size());
+    JsonSerDeser<NodeInformationList> serDeser = NodeInformationList.createSerializer();
+    if (args.outputFile != null) {
+      serDeser.save(nodes, args.outputFile);
+    } else {
+      println(serDeser.toJson(nodes));
+    }
+    return 0;
+  }
+
 }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eac0de9f/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java b/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
index d87b121..5c5d96b 100644
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
+++ b/slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
@@ -23,6 +23,7 @@ import org.apache.hadoop.service.Service;
 import org.apache.hadoop.yarn.api.records.ApplicationReport;
 import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.apache.hadoop.yarn.exceptions.YarnException;
+import org.apache.slider.api.types.NodeInformationList;
 import org.apache.slider.api.types.SliderInstanceDescription;
 import org.apache.slider.common.params.AbstractClusterBuildingActionArgs;
 import org.apache.slider.common.params.ActionAMSuicideArgs;
@@ -36,6 +37,7 @@ import org.apache.slider.common.params.ActionFreezeArgs;
 import org.apache.slider.common.params.ActionInstallKeytabArgs;
 import org.apache.slider.common.params.ActionInstallPackageArgs;
 import org.apache.slider.common.params.ActionKeytabArgs;
+import org.apache.slider.common.params.ActionNodesArgs;
 import org.apache.slider.common.params.ActionPackageArgs;
 import org.apache.slider.common.params.ActionKillContainerArgs;
 import org.apache.slider.common.params.ActionListArgs;
@@ -342,4 +344,14 @@ public interface SliderClientAPI extends Service {
    */
   int actionDependency(ActionDependencyArgs dependencyArgs) throws IOException,
       YarnException;
+
+  /**
+   * List the nodes
+   * @param args
+   * @return
+   * @throws YarnException
+   * @throws IOException
+   */
+  NodeInformationList listYarnClusterNodes(ActionNodesArgs args)
+    throws YarnException, IOException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eac0de9f/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 a315345..85a582b 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
@@ -28,13 +28,18 @@ import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest;
 import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationResponse;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationReport;
+import org.apache.hadoop.yarn.api.records.NodeReport;
+import org.apache.hadoop.yarn.api.records.NodeState;
 import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.apache.hadoop.yarn.client.api.impl.YarnClientImpl;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.exceptions.YarnException;
 import org.apache.hadoop.yarn.util.ConverterUtils;
 import org.apache.hadoop.yarn.util.Records;
+import org.apache.slider.api.types.NodeInformation;
+import org.apache.slider.api.types.NodeInformationList;
 import org.apache.slider.common.SliderKeys;
+import org.apache.slider.common.params.ActionNodesArgs;
 import org.apache.slider.common.tools.CoreFileSystem;
 import org.apache.slider.common.tools.Duration;
 import org.apache.slider.common.tools.SliderFileSystem;
@@ -361,4 +366,45 @@ public class SliderYarnClientImpl extends YarnClientImpl {
     log.debug("No match");
     return null;
   }
+
+  /**
+   * List the nodes in the cluster, possibly filtering by node state or label.
+   *
+   * @param label label to filter by -or "" for any
+   * @param live flag to request running nodes only
+   * @return a possibly empty list of nodes in the cluster
+   * @throws IOException IO problems
+   * @throws YarnException YARN problems
+   */
+  public NodeInformationList listNodes(String label, boolean live)
+    throws IOException, YarnException {
+    Preconditions.checkArgument(label != null, "null label");
+    NodeState[] states;
+    if (live) {
+      states = new NodeState[1];
+      states[0] = NodeState.RUNNING;
+    } else {
+      states = new NodeState[0];
+    }
+    List<NodeReport> reports = getNodeReports(states);
+    NodeInformationList results = new NodeInformationList(reports.size());
+    for (NodeReport report : reports) {
+      if (live && report.getNodeState() != NodeState.RUNNING) {
+        continue;
+      }
+      if (!label.isEmpty() && !report.getNodeLabels().contains(label)) {
+        continue;
+      }
+      // build node info from report
+      NodeInformation info = new NodeInformation();
+      info.hostname = report.getNodeId().getHost();
+      info.healthReport  = report.getHealthReport();
+      info.httpAddress = report.getHttpAddress();
+      info.labels = SliderUtils.extractNodeLabel(report);
+      info.rackName = report.getRackName();
+      info.state = report.getNodeState().toString();
+      results.add(info);
+    }
+    return results;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eac0de9f/slider-core/src/main/java/org/apache/slider/common/params/ActionNodesArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionNodesArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionNodesArgs.java
index bb214e1..5ddccf6 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionNodesArgs.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/ActionNodesArgs.java
@@ -27,6 +27,11 @@ import java.io.File;
             commandDescription = SliderActions.DESCRIBE_ACTION_NODES)
 public class ActionNodesArgs extends AbstractActionArgs {
 
+  /**
+   * Instance for API use; on CLI the name is derived from {@link #getClusterName()}.
+   */
+  public String instance;
+
   @Override
   public String getActionName() {
     return SliderActions.ACTION_NODES;
@@ -42,5 +47,20 @@ public class ActionNodesArgs extends AbstractActionArgs {
   @Parameter(names = {ARG_HEALTHY} )
   public boolean healthy;
 
+  @Override
+  public int getMinParams() {
+    return 0;
+  }
 
+  @Override
+  public String toString() {
+    final StringBuilder sb = new StringBuilder(
+      "ActionNodesArgs{");
+    sb.append("instance='").append(instance).append('\'');
+    sb.append(", outputFile=").append(outputFile);
+    sb.append(", label='").append(label).append('\'');
+    sb.append(", healthy=").append(healthy);
+    sb.append('}');
+    return sb.toString();
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eac0de9f/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java b/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
index eb7a9d5..712eb75 100644
--- a/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
+++ b/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
@@ -47,6 +47,7 @@ import org.apache.hadoop.yarn.api.ApplicationConstants;
 import org.apache.hadoop.yarn.api.records.ApplicationReport;
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.LocalResource;
+import org.apache.hadoop.yarn.api.records.NodeReport;
 import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.apache.hadoop.yarn.client.api.AMRMClient;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
@@ -1774,6 +1775,19 @@ public final class SliderUtils {
     return toTruncate.substring(0, maxSize - pad.length()).concat(pad);
   }
 
+  /**
+   * Get a string node label value from a node report
+   * @param report node report
+   * @return a single trimmed label or ""
+   */
+  public static String extractNodeLabel(NodeReport report) {
+    Set<String> newlabels = report.getNodeLabels();
+    if (newlabels != null && !newlabels.isEmpty()) {
+      return newlabels.iterator().next().trim();
+    } else {
+      return "";
+    }
+  }
 
   /**
    * Callable for async/scheduled halt

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eac0de9f/slider-core/src/main/java/org/apache/slider/core/launch/JavaCommandLineBuilder.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/launch/JavaCommandLineBuilder.java b/slider-core/src/main/java/org/apache/slider/core/launch/JavaCommandLineBuilder.java
index ccb610a..dcb322e 100644
--- a/slider-core/src/main/java/org/apache/slider/core/launch/JavaCommandLineBuilder.java
+++ b/slider-core/src/main/java/org/apache/slider/core/launch/JavaCommandLineBuilder.java
@@ -25,8 +25,6 @@ import org.apache.hadoop.yarn.api.ApplicationConstants;
 import org.apache.slider.common.tools.SliderUtils;
 import org.apache.slider.core.exceptions.BadConfigException;
 
-import java.util.Map;
-
 /**
  * Command line builder purely for the Java CLI.
  * Some of the <code>define</code> methods are designed to work with Hadoop tool and

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eac0de9f/slider-core/src/main/java/org/apache/slider/core/persist/JsonSerDeser.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/persist/JsonSerDeser.java b/slider-core/src/main/java/org/apache/slider/core/persist/JsonSerDeser.java
index c5908bb..4f60c06 100644
--- a/slider-core/src/main/java/org/apache/slider/core/persist/JsonSerDeser.java
+++ b/slider-core/src/main/java/org/apache/slider/core/persist/JsonSerDeser.java
@@ -91,10 +91,11 @@ public class JsonSerDeser<T> {
    */
   public T fromFile(File jsonFile)
     throws IOException, JsonParseException, JsonMappingException {
+    File absoluteFile = jsonFile.getAbsoluteFile();
     try {
-      return mapper.readValue(jsonFile, classType);
+      return mapper.readValue(absoluteFile, classType);
     } catch (IOException e) {
-      log.error("Exception while parsing json file {}: {}", jsonFile, e);
+      log.error("Exception while parsing json file {}", absoluteFile, e);
       throw e;
     }
   }
@@ -106,7 +107,6 @@ public class JsonSerDeser<T> {
    * @throws IOException IO problems
    * @throws JsonMappingException failure to map from the JSON to this class
    */
-/* JDK7
  public T fromResource(String resource)
     throws IOException, JsonParseException, JsonMappingException {
     try(InputStream resStream = this.getClass().getResourceAsStream(resource)) {
@@ -115,34 +115,9 @@ public class JsonSerDeser<T> {
       }
       return (T) (mapper.readValue(resStream, classType));
     } catch (IOException e) {
-      log.error("Exception while parsing json resource {}: {}", resource, e);
+      log.error("Exception while parsing json resource {}", resource, e);
       throw e;
     }
-  }*/
-
-  /**
-   * Convert from a JSON file
-   * @param resource input file
-   * @return the parsed JSON
-   * @throws IOException IO problems
-   * @throws JsonMappingException failure to map from the JSON to this class
-   */
-  @SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
-  public synchronized T fromResource(String resource)
-      throws IOException, JsonParseException, JsonMappingException {
-    InputStream resStream = null;
-    try {
-      resStream = this.getClass().getResourceAsStream(resource);
-      if (resStream == null) {
-        throw new FileNotFoundException(resource);
-      }
-      return (T) (mapper.readValue(resStream, classType));
-    } catch (IOException e) {
-      log.error("Exception while parsing json resource {}: {}", resource, e);
-      throw e;
-    } finally {
-      IOUtils.closeStream(resStream);
-    }
   }
 
   /**
@@ -155,7 +130,7 @@ public class JsonSerDeser<T> {
     try {
       return (T) (mapper.readValue(stream, classType));
     } catch (IOException e) {
-      log.error("Exception while parsing json input stream: {}", e);
+      log.error("Exception while parsing json input stream", e);
       throw e;
     } finally {
       IOUtils.closeStream(stream);
@@ -201,7 +176,7 @@ public class JsonSerDeser<T> {
     FSDataInputStream dataInputStream = fs.open(path);
     int count = dataInputStream.read(b);
     if (count != len) {
-      throw new EOFException("Read finished prematurely");
+      throw new EOFException("Read of " + path +" finished prematurely");
     }
     return fromBytes(b);
   }
@@ -230,9 +205,9 @@ public class JsonSerDeser<T> {
    */
   public void save(T instance, File file) throws
       IOException {
-    writeJsonAsBytes(instance, new FileOutputStream(file));
+    writeJsonAsBytes(instance, new FileOutputStream(file.getAbsoluteFile()));
   }
-  
+
   /**
    * Write the json as bytes -then close the file
    * @param dataOutputStream an outout stream that will always be closed
@@ -251,7 +226,6 @@ public class JsonSerDeser<T> {
     }
   }
 
-
   /**
    * Convert an object to a JSON string
    * @param instance instance to convert
@@ -265,6 +239,5 @@ public class JsonSerDeser<T> {
     mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
     return mapper.writeValueAsString(instance);
   }
-  
-  
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eac0de9f/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
index 49bc225..ee5d43d 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
@@ -688,8 +688,8 @@ public class AppState {
     instanceDefinition.resolve();
 
     // force in the AM desired state values
-    ConfTreeOperations resources =
-        instanceDefinition.getResourceOperations();
+    ConfTreeOperations resources = instanceDefinition.getResourceOperations();
+
     if (resources.getComponent(SliderKeys.COMPONENT_AM) != null) {
       resources.setComponentOpt(
           SliderKeys.COMPONENT_AM, COMPONENT_INSTANCES, "1");
@@ -706,8 +706,7 @@ public class AppState {
                                                    internalsSnapshot.confTree);
     instanceDefinitionSnapshot.setName(instanceDefinition.getName());
 
-    clusterStatusTemplate =
-      ClusterDescriptionOperations.buildFromInstanceDefinition(
+    clusterStatusTemplate = ClusterDescriptionOperations.buildFromInstanceDefinition(
           instanceDefinition);
 
     // Add the -site configuration properties

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eac0de9f/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeInstance.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeInstance.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeInstance.java
index 2b8f01c..8d63239 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeInstance.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/NodeInstance.java
@@ -31,7 +31,6 @@ import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.ListIterator;
-import java.util.Set;
 
 /**
  * A node instance -stores information about a node in the cluster.
@@ -103,12 +102,7 @@ public class NodeInstance {
     boolean newUsable = !nodeState.isUnusable();
     boolean nodeNowAvailable = oldStateUnusable && newUsable;
     String labels = this.nodeLabels;
-    Set<String> newlabels = report.getNodeLabels();
-    if (newlabels != null && !newlabels.isEmpty()) {
-      nodeLabels = newlabels.iterator().next().trim();
-    } else {
-      nodeLabels = "";
-    }
+    nodeLabels = SliderUtils.extractNodeLabel(report);
     return nodeNowAvailable
         || newUsable && !this.nodeLabels.equals(labels);
   }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eac0de9f/slider-core/src/test/groovy/org/apache/slider/client/TestClientBadArgs.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/client/TestClientBadArgs.groovy b/slider-core/src/test/groovy/org/apache/slider/client/TestClientBadArgs.groovy
index 1b074dc..9b6c7dc 100644
--- a/slider-core/src/test/groovy/org/apache/slider/client/TestClientBadArgs.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/client/TestClientBadArgs.groovy
@@ -22,14 +22,11 @@ import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
 import org.apache.hadoop.conf.Configuration
 import org.apache.hadoop.yarn.conf.YarnConfiguration
-import org.apache.slider.common.params.ActionRegistryArgs
 import org.apache.slider.common.params.Arguments
 import org.apache.slider.common.params.SliderActions
 import org.apache.slider.core.exceptions.BadCommandArgumentsException
 import org.apache.slider.core.exceptions.ErrorStrings
 import org.apache.slider.core.exceptions.UsageException
-import org.apache.slider.core.exceptions.BadConfigException
-import org.apache.slider.core.main.ServiceLauncher
 import org.apache.slider.core.main.ServiceLauncherBaseTest
 import org.junit.Test
 
@@ -39,9 +36,7 @@ import org.junit.Test
 @CompileStatic
 @Slf4j
 class TestClientBadArgs extends ServiceLauncherBaseTest {
-  
-  static String TEST_FILES = "./src/test/resources/org/apache/slider/providers/agent/tests/"
-  
+
   @Test
   public void testNoAction() throws Throwable {
     launchExpectingException(SliderClient,
@@ -244,4 +239,13 @@ class TestClientBadArgs extends ServiceLauncherBaseTest {
       assert exception instanceof BadCommandArgumentsException
       log.info(exception.toString())
     }
+
+  @Test
+  public void testNodesMissingFile() throws Throwable {
+    def exception = launchExpectingException(SliderClient,
+        createTestConfig(),
+        "after parameter --out",
+        [SliderActions.ACTION_NODES, Arguments.ARG_OUTPUT])
+    assert exception instanceof BadCommandArgumentsException
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eac0de9f/slider-core/src/test/groovy/org/apache/slider/client/TestSliderClientMethods.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/client/TestSliderClientMethods.groovy b/slider-core/src/test/groovy/org/apache/slider/client/TestSliderClientMethods.groovy
index 168415c..e244923 100644
--- a/slider-core/src/test/groovy/org/apache/slider/client/TestSliderClientMethods.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/client/TestSliderClientMethods.groovy
@@ -30,6 +30,7 @@ import org.apache.slider.core.exceptions.SliderException
 import org.apache.slider.core.launch.LaunchedApplication
 import org.apache.slider.core.main.ServiceLauncherBaseTest
 import org.apache.slider.core.persist.LockAcquireFailedException
+import org.apache.slider.server.appmaster.model.mock.MockApplicationId
 import org.easymock.EasyMock
 import org.junit.Assert
 import org.junit.Test
@@ -137,7 +138,7 @@ class TestSliderClientMethods extends ServiceLauncherBaseTest {
         AggregateConf instanceDefinition,
         boolean debugAM)
     throws YarnException, IOException {
-      return new LaunchedApplication(clustername, new SliderYarnClientImpl());
+      return new LaunchedApplication(new MockApplicationId(1), new SliderYarnClientImpl());
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eac0de9f/slider-core/src/test/groovy/org/apache/slider/client/TestUpgradeCommandOptions.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/client/TestUpgradeCommandOptions.groovy b/slider-core/src/test/groovy/org/apache/slider/client/TestUpgradeCommandOptions.groovy
index 8d5aef1..5295f9b 100644
--- a/slider-core/src/test/groovy/org/apache/slider/client/TestUpgradeCommandOptions.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/client/TestUpgradeCommandOptions.groovy
@@ -82,10 +82,8 @@ class TestUpgradeCommandOptions extends AgentMiniClusterTestBase {
               new File(tmpDir, "resources.json").toURI()
           ])
       fail("Upgrade command should have failed")
-    } catch (SliderException e) {
-      log.info(e.toString())
-      assert e instanceof UnknownApplicationInstanceException
-      assert e.getMessage().contains("Unknown application instance")
+    } catch (UnknownApplicationInstanceException e) {
+      assertExceptionDetails(e, SliderExitCodes.EXIT_UNKNOWN_INSTANCE, "Unknown application instance")
     }
   }
 
@@ -301,10 +299,6 @@ class TestUpgradeCommandOptions extends AgentMiniClusterTestBase {
     assert launcher.serviceExitCode == 0
   }
 
-  private File getTempLocation () {
-    return new File(System.getProperty("user.dir") + "/target/_")
-  }
-
   static class TestSliderClient extends SliderClient {
     public TestSliderClient() {
       super()

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eac0de9f/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentEcho.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentEcho.groovy b/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentEcho.groovy
index 4ceeca0..23a7bbb 100644
--- a/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentEcho.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentEcho.groovy
@@ -22,11 +22,14 @@ import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
 import org.apache.hadoop.yarn.conf.YarnConfiguration
 import org.apache.slider.api.ResourceKeys
+import org.apache.slider.api.types.NodeInformationList
 import org.apache.slider.client.SliderClient
 import org.apache.slider.common.SliderExitCodes
 import org.apache.slider.common.SliderXmlConfKeys
+import org.apache.slider.common.params.ActionNodesArgs
 import org.apache.slider.core.exceptions.BadClusterStateException
 import org.apache.slider.core.main.ServiceLauncher
+import org.apache.slider.core.persist.JsonSerDeser
 import org.junit.Before
 import org.junit.Test
 
@@ -124,6 +127,35 @@ class TestAgentEcho extends AgentTestBase {
       assertExceptionDetails(e, SliderExitCodes.EXIT_BAD_STATE, "negative")
     }
 
+
+    runNodemapTests(sliderClient)
+
+  }
+
+  /**
+   * do some nodemap checks, currently cluster-wide
+   * @param sliderClient
+   */
+  protected void runNodemapTests(SliderClient sliderClient) {
+    describe "slider nodes"
+    sliderClient.actionNodes("", new ActionNodesArgs())
+
+    def allNodes = sliderClient.listYarnClusterNodes(new ActionNodesArgs()).collect { it.httpAddress }
+    assert !allNodes.empty
+
+    // healthy only
+    def healthyNodes = sliderClient.listYarnClusterNodes(new ActionNodesArgs(healthy: true))
+    assert healthyNodes.collect { it.httpAddress }.containsAll(allNodes)
+    // look for an unknown label and expect none
+    def gpuNodes = sliderClient.listYarnClusterNodes(new ActionNodesArgs(label: "gpu"))
+    assert gpuNodes.empty
+    File t1 = createTempJsonFile()
+    sliderClient.actionNodes("", new ActionNodesArgs(outputFile: t1))
+    assert t1.exists()
+    JsonSerDeser<NodeInformationList> serDeser = new JsonSerDeser<>(NodeInformationList.class);
+    NodeInformationList loaded = serDeser.fromFile(t1)
+    assert allNodes.containsAll(loaded.collect { it.httpAddress })
+
   }
 
   protected void validatePaths() {


[15/17] incubator-slider git commit: SLIDER-970: AASleepIT, diagnostics run at first

Posted by st...@apache.org.
SLIDER-970: AASleepIT, diagnostics run at first


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

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: 4fb381e1b25486044956bd0194a8b3f71995f017
Parents: 962400b
Author: Steve Loughran <st...@apache.org>
Authored: Fri Nov 20 19:07:26 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Fri Nov 20 19:07:26 2015 +0000

----------------------------------------------------------------------
 .../groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/4fb381e1/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
index 054245e..84ef340 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
@@ -65,7 +65,7 @@ public class AASleepIT extends AgentCommandTestBase
 
     describe "diagnostics"
 
-    slider([ACTION_DIAGNOSTICS, ARG_VERBOSE, ARG_CLIENT, ARG_YARN, ARG_CREDENTIALS])
+    slider([ACTION_DIAGNOSTICS, ARG_VERBOSE, ARG_CLIENT, ARG_YARN, ARG_CREDENTIALS]).dumpOutput()
 
     describe "list nodes"
 


[05/17] incubator-slider git commit: SLIDER-907: AgentWebPagesIT downgrades on HTTPS RM proxies by skipping all proxied tests, retaining the direct ones

Posted by st...@apache.org.
SLIDER-907: AgentWebPagesIT downgrades on HTTPS RM proxies by skipping all proxied tests, retaining the direct ones


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

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: 082eb0c1787b9fe4d97c8c02b2e4883800eec80b
Parents: 781d332
Author: Steve Loughran <st...@apache.org>
Authored: Wed Nov 18 22:01:27 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Nov 18 22:01:27 2015 +0000

----------------------------------------------------------------------
 .../apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy   | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/082eb0c1/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy
index 682caf8..70f31d5 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentWebPagesIT.groovy
@@ -106,11 +106,9 @@ public class AgentWebPagesIT extends AgentCommandTestBase
     def appId = ensureYarnApplicationIsUp(launchReportFile)
     assert appId
     awaitApplicationURLPublished(appId, instanceLaunchTime)
-    File liveReportFile = createTempJsonFile();
 
-    lookup(appId, liveReportFile)
-    def report = loadAppReport(liveReportFile)
-    assert report.url
+    def report = lookupApplication(appId)
+    assert report && report.url
 
     def proxyAM = report.url
 
@@ -187,7 +185,7 @@ public class AgentWebPagesIT extends AgentCommandTestBase
     // maybe execute IPC operations.
     // these are skipped when security is enabled, until
     // there's some code set up to do the tokens properly
-    if (!UserGroupInformation.isSecurityEnabled()) {
+    if (!UserGroupInformation.securityEnabled) {
       describe("IPC equivalent operations")
 
       def sliderClusterProtocol =


[10/17] incubator-slider git commit: SLIDER-1000 clean org.apache.slider.common.params package

Posted by st...@apache.org.
SLIDER-1000 clean org.apache.slider.common.params package


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

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: e9c5ebc7838a3c2785ab13752bf495a27a965fd1
Parents: 3418d72
Author: Steve Loughran <st...@apache.org>
Authored: Fri Nov 20 16:51:27 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Fri Nov 20 16:51:27 2015 +0000

----------------------------------------------------------------------
 .../common/params/AbstractActionArgs.java       |  6 +--
 .../AbstractClusterBuildingActionArgs.java      |  2 +-
 .../common/params/ActionAMSuicideArgs.java      |  1 -
 .../slider/common/params/ActionEchoArgs.java    |  7 +--
 .../slider/common/params/ActionListArgs.java    |  2 +-
 .../slider/common/params/ActionLookupArgs.java  |  2 +-
 .../slider/common/params/ActionNodesArgs.java   | 46 ++++++++++++++++++++
 .../slider/common/params/ActionStatusArgs.java  |  3 +-
 .../slider/common/params/ActionUpgradeArgs.java |  4 +-
 .../slider/common/params/AddonArgsDelegate.java |  2 +-
 .../params/AppAndResouceOptionArgsDelegate.java |  8 ++--
 .../org/apache/slider/common/params/ArgOps.java | 20 +++------
 .../apache/slider/common/params/Arguments.java  |  8 +++-
 .../apache/slider/common/params/ClientArgs.java | 45 +++++++++++--------
 .../apache/slider/common/params/CommonArgs.java | 16 +++----
 .../common/params/ComponentArgsDelegate.java    |  2 +-
 .../common/params/DontSplitArguments.java       |  2 +-
 .../slider/common/params/SliderActions.java     |  2 +
 18 files changed, 111 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java
index 17c235f..d0b1693 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java
@@ -56,7 +56,7 @@ public abstract class AbstractActionArgs extends ArgOps implements Arguments {
    * This is the default parameter
    */
   @Parameter
-  public final List<String> parameters = new ArrayList<String>();
+  public final List<String> parameters = new ArrayList<>();
 
   /**
    * get the name: relies on arg 1 being the cluster name in all operations 
@@ -77,7 +77,7 @@ public abstract class AbstractActionArgs extends ArgOps implements Arguments {
    */
 
   @Parameter(names = ARG_DEFINE, arity = 1, description = "Definitions")
-  public final List<String> definitions = new ArrayList<String>();
+  public final List<String> definitions = new ArrayList<>();
 
   /**
    * System properties
@@ -85,7 +85,7 @@ public abstract class AbstractActionArgs extends ArgOps implements Arguments {
   @Parameter(names = {ARG_SYSPROP}, arity = 1,
              description = "system properties in the form name value" +
                            " These are set after the JVM is started.")
-  public final List<String> sysprops = new ArrayList<String>(0);
+  public final List<String> sysprops = new ArrayList<>(0);
 
 
   @Parameter(names = {ARG_MANAGER_SHORT, ARG_MANAGER},

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java
index f2e3c61..1c694bd 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java
@@ -59,7 +59,7 @@ public abstract class AbstractClusterBuildingActionArgs extends
 
   /**
    * --image path
-   the full path to a .tar or .tar.gz path containing an HBase image.
+   * the full path to a .tar or .tar.gz path containing an HBase image.
    */
   @Parameter(names = ARG_IMAGE,
       description = "The full path to a .tar or .tar.gz path containing the application",

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/ActionAMSuicideArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionAMSuicideArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionAMSuicideArgs.java
index d6cabf5..5b4cfdc 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionAMSuicideArgs.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/ActionAMSuicideArgs.java
@@ -21,7 +21,6 @@ package org.apache.slider.common.params;
 import com.beust.jcommander.Parameter;
 import com.beust.jcommander.Parameters;
 
-
 @Parameters(commandNames = {SliderActions.ACTION_AM_SUICIDE},
             commandDescription = SliderActions.DESCRIBE_ACTION_AM_SUICIDE)
 public class ActionAMSuicideArgs extends AbstractActionArgs {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/ActionEchoArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionEchoArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionEchoArgs.java
index b0f53f8..d05f10b 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionEchoArgs.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/ActionEchoArgs.java
@@ -20,15 +20,10 @@ package org.apache.slider.common.params;
 
 import com.beust.jcommander.Parameter;
 
-/*
-
-@Parameters(commandNames = {SliderActions.ACTION_KILL_CONTAINER},
-            commandDescription = SliderActions.DESCRIBE_ACTION_KILL_CONTAINER)
-*/
 public class ActionEchoArgs extends AbstractActionArgs {
   @Override
   public String getActionName() {
-    return SliderActions.ACTION_DESTROY;
+    return SliderActions.ACTION_ECHO;
   }
 
   @Parameter(names = {ARG_MESSAGE},

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/ActionListArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionListArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionListArgs.java
index 0bc5792..739b5fc 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionListArgs.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/ActionListArgs.java
@@ -57,7 +57,7 @@ public class ActionListArgs extends AbstractActionArgs {
   @Parameter(names = {ARG_COMPONENTS}, variableArity = true,
       description = "Filter containers by component names (used with " +
                     ARG_CONTAINERS + ")")
-  public Set<String> components = new HashSet<>(0);;
+  public Set<String> components = new HashSet<>(0);
 
   /**
    * Get the min #of params expected

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/ActionLookupArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionLookupArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionLookupArgs.java
index 3b69e74..1b73522 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionLookupArgs.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/ActionLookupArgs.java
@@ -43,7 +43,7 @@ public class ActionLookupArgs extends AbstractActionArgs {
   }
   
   @Parameter(names = {ARG_ID},
-             description = "ID of the container")
+             description = "ID of the application")
   public String id;
 
   @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT},

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/ActionNodesArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionNodesArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionNodesArgs.java
new file mode 100644
index 0000000..bb214e1
--- /dev/null
+++ b/slider-core/src/main/java/org/apache/slider/common/params/ActionNodesArgs.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.slider.common.params;
+
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+
+import java.io.File;
+
+@Parameters(commandNames = {SliderActions.ACTION_NODES},
+            commandDescription = SliderActions.DESCRIBE_ACTION_NODES)
+public class ActionNodesArgs extends AbstractActionArgs {
+
+  @Override
+  public String getActionName() {
+    return SliderActions.ACTION_NODES;
+  }
+
+  @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT},
+             description = "Output file for the information")
+  public File outputFile;
+
+  @Parameter(names = {ARG_LABEL})
+  public String label = "";
+
+  @Parameter(names = {ARG_HEALTHY} )
+  public boolean healthy;
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/ActionStatusArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionStatusArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionStatusArgs.java
index a7edb65..00178df 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionStatusArgs.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/ActionStatusArgs.java
@@ -25,13 +25,14 @@ import com.beust.jcommander.Parameters;
             commandDescription = SliderActions.DESCRIBE_ACTION_STATUS)
 
 public class ActionStatusArgs extends AbstractActionArgs {
+
   @Override
   public String getActionName() {
     return SliderActions.ACTION_STATUS;
   }
 
   @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT},
-             description = "Output file for the configuration data")
+             description = "Output file for the status information")
   public String output;
 
   public String getOutput() {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/ActionUpgradeArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ActionUpgradeArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ActionUpgradeArgs.java
index 832e1cc..6ef51b2 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/ActionUpgradeArgs.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/ActionUpgradeArgs.java
@@ -61,11 +61,11 @@ public class ActionUpgradeArgs extends AbstractClusterBuildingActionArgs
 
   @Parameter(names={ARG_CONTAINERS}, variableArity = true,
              description = "stop specific containers")
-  public List<String> containers = new ArrayList<String>(0);
+  public List<String> containers = new ArrayList<>(0);
 
   @Parameter(names={ARG_COMPONENTS}, variableArity = true,
       description = "stop all containers of specific components")
-  public List<String> components = new ArrayList<String>(0);
+  public List<String> components = new ArrayList<>(0);
 
   @Parameter(names = {ARG_FORCE},
       description = "force spec upgrade operation")

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/AddonArgsDelegate.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/AddonArgsDelegate.java b/slider-core/src/main/java/org/apache/slider/common/params/AddonArgsDelegate.java
index 65ebc4b..3ef8e19 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/AddonArgsDelegate.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/AddonArgsDelegate.java
@@ -34,7 +34,7 @@ public class AddonArgsDelegate extends AbstractArgsDelegate {
       arity = 2,
       description = "--addon <name> <folder or package>",
       splitter = DontSplitArguments.class)
-  public List<String> addonTuples = new ArrayList<String>(0);
+  public List<String> addonTuples = new ArrayList<>(0);
 
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/AppAndResouceOptionArgsDelegate.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/AppAndResouceOptionArgsDelegate.java b/slider-core/src/main/java/org/apache/slider/common/params/AppAndResouceOptionArgsDelegate.java
index 1f07de3..248e4c2 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/AppAndResouceOptionArgsDelegate.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/AppAndResouceOptionArgsDelegate.java
@@ -37,7 +37,7 @@ public class AppAndResouceOptionArgsDelegate extends AbstractArgsDelegate {
   @Parameter(names = {ARG_OPTION, ARG_OPTION_SHORT}, arity = 2,
              description = ARG_OPTION + "<name> <value>",
              splitter = DontSplitArguments.class)
-  public List<String> optionTuples = new ArrayList<String>(0);
+  public List<String> optionTuples = new ArrayList<>(0);
 
 
   /**
@@ -47,7 +47,7 @@ public class AppAndResouceOptionArgsDelegate extends AbstractArgsDelegate {
              description = "Component option " + ARG_COMP_OPT +
                            " <component> <name> <option>",
              splitter = DontSplitArguments.class)
-  public List<String> compOptTriples = new ArrayList<String>(0);
+  public List<String> compOptTriples = new ArrayList<>(0);
 
   /**
    * Resource Options
@@ -55,7 +55,7 @@ public class AppAndResouceOptionArgsDelegate extends AbstractArgsDelegate {
   @Parameter(names = {ARG_RESOURCE_OPT, ARG_RESOURCE_OPT_SHORT}, arity = 2,
              description = "Resource option "+ ARG_RESOURCE_OPT + "<name> <value>",
              splitter = DontSplitArguments.class)
-  public List<String> resOptionTuples = new ArrayList<String>(0);
+  public List<String> resOptionTuples = new ArrayList<>(0);
 
 
   /**
@@ -65,7 +65,7 @@ public class AppAndResouceOptionArgsDelegate extends AbstractArgsDelegate {
              description = "Component resource option " + ARG_RES_COMP_OPT +
                            " <component> <name> <option>",
              splitter = DontSplitArguments.class)
-  public List<String> resCompOptTriples = new ArrayList<String>(0);
+  public List<String> resCompOptTriples = new ArrayList<>(0);
 
 
   public Map<String, String> getOptionsMap() throws

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/ArgOps.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ArgOps.java b/slider-core/src/main/java/org/apache/slider/common/params/ArgOps.java
index aeb2979..12a2032 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/ArgOps.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/ArgOps.java
@@ -44,20 +44,13 @@ public class ArgOps {
    * create a 3-tuple
    */
   public static List<Object> triple(String msg, int min, int max) {
-    List<Object> l = new ArrayList<Object>(3);
+    List<Object> l = new ArrayList<>(3);
     l.add(msg);
     l.add(min);
     l.add(max);
     return l;
   }
 
-  /**
-   * Create a tuple
-   */
-  public static List<Object> tuple(String msg, int min) {
-    return triple(msg, min, min);
-  }
-
   public static void applyFileSystemBinding(String filesystemBinding,
       Configuration conf) {
     if (filesystemBinding != null) {
@@ -100,7 +93,7 @@ public class ArgOps {
   public static Map<String, String> convertTupleListToMap(String description,
                                                           List<String> list) throws
                                                                              BadCommandArgumentsException {
-    Map<String, String> results = new HashMap<String, String>();
+    Map<String, String> results = new HashMap<>();
     if (list != null && !list.isEmpty()) {
       int size = list.size();
       if (size % 2 != 0) {
@@ -131,10 +124,9 @@ public class ArgOps {
    * @throws BadCommandArgumentsException odd #of arguments received
    */
   public static Map<String, Map<String, String>> convertTripleListToMaps(String description,
-                                                                         List<String> list) throws
-                                                                                            BadCommandArgumentsException {
-    Map<String, Map<String, String>> results =
-      new HashMap<String, Map<String, String>>();
+         List<String> list) throws BadCommandArgumentsException {
+
+    Map<String, Map<String, String>> results = new HashMap<>();
     if (list != null && !list.isEmpty()) {
       int size = list.size();
       if (size % 3 != 0) {
@@ -149,7 +141,7 @@ public class ArgOps {
         Map<String, String> roleMap = results.get(role);
         if (roleMap == null) {
           //demand create new role map
-          roleMap = new HashMap<String, String>();
+          roleMap = new HashMap<>();
           results.put(role, roleMap);
         }
         if (roleMap.get(key) != null) {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java b/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java
index c2fa09c..ca22c24 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/Arguments.java
@@ -60,6 +60,7 @@ public interface Arguments {
   String ARG_GETCONF = "--getconf";
   String ARG_GETEXP = "--getexp";
   String ARG_GETFILES = "--getfiles";
+  String ARG_HEALTHY= "--healthy";
   String ARG_HELP = "--help";
   String ARG_HOSTNAME = "--hostname";
   String ARG_ID = "--id";
@@ -70,6 +71,7 @@ public interface Arguments {
   String ARG_KEYTABINSTALL = "--install";
   String ARG_KEYTABDELETE = "--delete";
   String ARG_KEYTABLIST = "--list";
+  String ARG_LABEL = "--label";
   String ARG_LEVEL = "--level";
   String ARG_LIST = "--list";
   String ARG_LISTCONF = "--listconf";
@@ -125,10 +127,14 @@ public interface Arguments {
 
 
   /**
-   * Deprecated
+   * Deprecated: use ARG_COMPONENT
    */
   @Deprecated
   String ARG_ROLE = "--role";
+
+  /**
+   * Deprecated: use ARG_COMP_OPT
+   */
   @Deprecated
   String ARG_ROLEOPT = "--roleopt";
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/ClientArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ClientArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/ClientArgs.java
index 3c430f3..ea1448b 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/ClientArgs.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/ClientArgs.java
@@ -66,6 +66,7 @@ public class ClientArgs extends CommonArgs {
     new ActionKillContainerArgs();
   private final ActionListArgs actionListArgs = new ActionListArgs();
   private final ActionLookupArgs actionLookupArgs = new ActionLookupArgs();
+  private final ActionNodesArgs actionNodesArgs = new ActionNodesArgs();
   private final ActionRegistryArgs actionRegistryArgs = new ActionRegistryArgs();
   private final ActionResolveArgs actionResolveArgs = new ActionResolveArgs();
   private final ActionStatusArgs actionStatusArgs = new ActionStatusArgs();
@@ -86,31 +87,32 @@ public class ClientArgs extends CommonArgs {
   protected void addActionArguments() {
 
     addActions(
-        actionPackageArgs,
-        actionKeytabArgs,
+        actionAMSuicideArgs,
         actionBuildArgs,
-        actionDependencyArgs,
-        actionCreateArgs,
-        actionListArgs,
-        actionStatusArgs,
-        actionRegistryArgs,
         actionClientArgs,
-        actionFlexArgs,
+        actionCreateArgs,
+        actionDependencyArgs,
+        actionDestroyArgs,
         actionDiagnosticArgs,
+        actionExistsArgs,
+        actionFlexArgs,
         actionFreezeArgs,
+        actionHelpArgs,
+        actionInstallKeytabArgs,
+        actionInstallPackageArgs,
+        actionKeytabArgs,
+        actionKillContainerArgs,
+        actionListArgs,
+        actionLookupArgs,
+        actionNodesArgs,
+        actionPackageArgs,
+        actionRegistryArgs,
+        actionResolveArgs,
+        actionStatusArgs,
         actionThawArgs,
         actionUpdateArgs,
         actionUpgradeArgs,
-        actionDestroyArgs,
-        actionExistsArgs,
-        actionLookupArgs,
-        actionResolveArgs,
-        actionKillContainerArgs,
-        actionAMSuicideArgs,
-        actionInstallPackageArgs,
-        actionInstallKeytabArgs,
-        actionVersionArgs,
-        actionHelpArgs
+        actionVersionArgs
     );
   }
 
@@ -196,6 +198,10 @@ public class ClientArgs extends CommonArgs {
     return actionListArgs;
   }
 
+  public ActionNodesArgs getActionNodesArgs() {
+    return actionNodesArgs;
+  }
+
   public ActionLookupArgs getActionLookupArgs() {
     return actionLookupArgs;
   }
@@ -286,6 +292,9 @@ public class ClientArgs extends CommonArgs {
     } else if (SliderActions.ACTION_LOOKUP.equals(action)) {
       bindCoreAction(actionLookupArgs);
 
+    } else if (SliderActions.ACTION_NODES.equals(action)) {
+      bindCoreAction(actionNodesArgs);
+
     } else if (SliderActions.ACTION_REGISTRY.equals(action)) {
       bindCoreAction(actionRegistryArgs);
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/CommonArgs.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/CommonArgs.java b/slider-core/src/main/java/org/apache/slider/common/params/CommonArgs.java
index 7e02eec..162a87d 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/CommonArgs.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/CommonArgs.java
@@ -91,12 +91,12 @@ public abstract class CommonArgs extends ArgOps implements SliderActions,
     return coreAction.getClusterName();
   }
 
-  public CommonArgs(String[] args) {
+  protected CommonArgs(String[] args) {
     this.args = args;
     commander = new JCommander(this);
   }
 
-  public CommonArgs(Collection args) {
+  protected CommonArgs(Collection args) {
     List<String> argsAsStrings = SliderUtils.collectionToStringList(args);
     this.args = argsAsStrings.toArray(new String[argsAsStrings.size()]);
     commander = new JCommander(this);
@@ -123,7 +123,7 @@ public abstract class CommonArgs extends ArgOps implements SliderActions,
           .append("Most commands print help when invoked without parameters or with --help");
       result = helperMessage.toString();
     } else {
-      helperMessage.append("\nUsage: slider " + commandOfInterest);
+      helperMessage.append("\nUsage: slider ").append(commandOfInterest);
       helperMessage.append(serviceArgs.coreAction.getMinParams() > 0 ? " <application>" : "");
       helperMessage.append("\n");
       for (ParameterDescription paramDesc : serviceArgs.commander.getCommands()
@@ -171,7 +171,7 @@ public abstract class CommonArgs extends ArgOps implements SliderActions,
   /**
    * Add a command
    * @param name action
-   * @param arg
+   * @param arg value
    */
   protected void addAction(String name, Object arg) {
     commander.addCommand(name, arg);
@@ -249,7 +249,7 @@ public abstract class CommonArgs extends ArgOps implements SliderActions,
       throw new BadCommandArgumentsException(badArgMsgBuilder.toString());
     } catch (UsageException e) {
       StringBuilder badArgMsgBuilder = new StringBuilder();
-      badArgMsgBuilder.append(e.toString() + "\n");
+      badArgMsgBuilder.append(e.toString()).append("\n");
       badArgMsgBuilder.append(usage(this, coreAction.getActionName()));
       throw new UsageException(badArgMsgBuilder.toString());
     }
@@ -289,12 +289,6 @@ public abstract class CommonArgs extends ArgOps implements SliderActions,
     return coreAction.manager;
   }
 
-
-//  public String getRmAddress() {
-//    return rmAddress;
-//  }
-
-
   public String getAction() {
     return commander.getParsedCommand();
   }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/ComponentArgsDelegate.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/ComponentArgsDelegate.java b/slider-core/src/main/java/org/apache/slider/common/params/ComponentArgsDelegate.java
index 494258e..abda53f 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/ComponentArgsDelegate.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/ComponentArgsDelegate.java
@@ -34,7 +34,7 @@ public class ComponentArgsDelegate extends AbstractArgsDelegate {
              arity = 2,
              description = "--component <name> <count>",
              splitter = DontSplitArguments.class)
-  public List<String> componentTuples = new ArrayList<String>(0);
+  public List<String> componentTuples = new ArrayList<>(0);
 
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/DontSplitArguments.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/DontSplitArguments.java b/slider-core/src/main/java/org/apache/slider/common/params/DontSplitArguments.java
index 3225133..0344305 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/DontSplitArguments.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/DontSplitArguments.java
@@ -27,7 +27,7 @@ public class DontSplitArguments implements IParameterSplitter {
 
   @Override
   public List<String> split(String value) {
-    List<String> list = new ArrayList<String>(1);
+    List<String> list = new ArrayList<>(1);
     list.add(value);
     return list;
   }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/e9c5ebc7/slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java b/slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java
index 54d2746..1d4e0ea 100644
--- a/slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java
+++ b/slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java
@@ -39,6 +39,7 @@ public interface SliderActions {
   String ACTION_KILL_CONTAINER = "kill-container";
   String ACTION_LIST = "list";
   String ACTION_LOOKUP = "lookup";
+  String ACTION_NODES = "nodes";
   String ACTION_PREFLIGHT = "preflight";
   String ACTION_RECONFIGURE = "reconfigure";
   String ACTION_REGISTRY = "registry";
@@ -80,6 +81,7 @@ public interface SliderActions {
                   "List running Slider applications";
   String DESCRIBE_ACTION_LOOKUP =
                   "look up a YARN application";
+  String DESCRIBE_ACTION_NODES = "List the node information for the YARN cluster or a running application";
   String DESCRIBE_ACTION_MONITOR =
                     "Monitor a running application";
   String DESCRIBE_ACTION_REGISTRY =


[03/17] incubator-slider git commit: SLIDER-970: preamble —review and clean up existing functional tests, extracting resources to new file of constants, ResourcePaths.groovy

Posted by st...@apache.org.
SLIDER-970: preamble —review and clean up existing functional tests, extracting resources to new file of constants, ResourcePaths.groovy


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

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: ba33ecee613cead8ef53ed261c0f4d3ab1f83702
Parents: d4d343a
Author: Steve Loughran <st...@apache.org>
Authored: Wed Nov 18 15:55:41 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Wed Nov 18 16:01:41 2015 +0000

----------------------------------------------------------------------
 .../test_min_pkg/sleep_cmd/appConfig.json       |  7 ++++
 .../test_min_pkg/sleep_cmd/metainfo.json        | 34 ++++++++++++--------
 .../test_min_pkg/sleep_cmd/resources.json       |  6 ++++
 .../funtest/framework/CommandTestBase.groovy    |  8 +----
 .../apache/slider/funtest/ResourcePaths.groovy  | 10 ++++--
 .../funtest/lifecycle/AgentMinSleepIT.groovy    | 14 ++++----
 .../lifecycle/DemoAppsThroughAgent.groovy       |  2 +-
 7 files changed, 50 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ba33ecee/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/appConfig.json
----------------------------------------------------------------------
diff --git a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/appConfig.json b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/appConfig.json
new file mode 100644
index 0000000..6e3ef14
--- /dev/null
+++ b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/appConfig.json
@@ -0,0 +1,7 @@
+{
+  "schema": "http://example.org/specification/v2.0.0",
+  "metadata": {
+  },
+  "global": {
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ba33ecee/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/metainfo.json
----------------------------------------------------------------------
diff --git a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/metainfo.json b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/metainfo.json
index c8ada2c..073d1ff 100644
--- a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/metainfo.json
+++ b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/metainfo.json
@@ -1,16 +1,24 @@
 {
-    "schemaVersion": "2.1",
-    "application": {
-        "name": "SLEEPER",
-        "components": [
-            {
-                "name": "SLEEP_100",
-                "commands": [
-                    {
-                        "exec": "sleep 180"
-                    }
-                ]
-             }
+  "schemaVersion": "2.1",
+  "application": {
+    "name": "SLEEPER",
+    "components": [
+      {
+        "name": "SLEEP_100",
+        "commands": [
+          {
+            "exec": "sleep 180"
+          }
         ]
-    }
+      },
+      {
+        "name": "SLEEP_LONG",
+        "commands": [
+          {
+            "exec": "sleep 180000"
+          }
+        ]
+      }
+    ]
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ba33ecee/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
----------------------------------------------------------------------
diff --git a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
index be7b962..d2ab4f9 100644
--- a/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
+++ b/slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json
@@ -12,6 +12,12 @@
       "yarn.role.priority": "1",
       "yarn.component.instances": "1",
       "yarn.memory": "256"
+    },
+    "SLEEP_LONG": {
+      "yarn.role.priority": "1",
+      "yarn.component.instances": "1",
+      "yarn.memory": "256",
+      "yarn.placement.policy": "4"
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ba33ecee/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
index d3a6680..218a081 100644
--- a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
+++ b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
@@ -88,7 +88,6 @@ abstract class CommandTestBase extends SliderTestUtils {
    * Keytab for secure cluster
    */
   public static final String TEST_AM_KEYTAB
-  static File keytabFile
 
   /**
    * shell-escaped ~ symbol. On windows this does
@@ -931,11 +930,7 @@ abstract class CommandTestBase extends SliderTestUtils {
       }
 
       // trigger a failure on registry lookup
-      SliderShell shell = registry(0, [
-              ARG_NAME,
-              application,
-              ARG_LISTEXP
-          ])
+      registry(0, [ARG_NAME, application, ARG_LISTEXP])
     }
   }
 
@@ -1206,7 +1201,6 @@ abstract class CommandTestBase extends SliderTestUtils {
   }
 
   public ClusterDescription execStatus(String application) {
-    ClusterDescription cd
     File statusFile = File.createTempFile("status", ".json")
     try {
       slider(EXIT_SUCCESS,

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ba33ecee/slider-funtest/src/test/groovy/org/apache/slider/funtest/ResourcePaths.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/ResourcePaths.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/ResourcePaths.groovy
index c93753d..5de2b8e 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/ResourcePaths.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/ResourcePaths.groovy
@@ -30,8 +30,12 @@ interface ResourcePaths {
   String COMMAND_LOG_APPCONFIG_NO_HB = "$SLIDER_CORE_APP_PACKAGES/test_command_log/appConfig_no_hb.json"
   String COMMAND_LOG_APPCONFIG_FAST_NO_REG = "$SLIDER_CORE_APP_PACKAGES/test_command_log/appConfig_fast_no_reg.json"
 
-  static String PING_RESOURCES = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/nc_ping_cmd/resources.json"
-  static String PING_META = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/nc_ping_cmd/metainfo.json"
-  static String PING_APPCONFIG = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/nc_ping_cmd/appConfig.json"
+  String PING_RESOURCES = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/nc_ping_cmd/resources.json"
+  String PING_META = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/nc_ping_cmd/metainfo.json"
+  String PING_APPCONFIG = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/nc_ping_cmd/appConfig.json"
+
+  String SLEEP_RESOURCES = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/sleep_cmd/resources.json"
+  String SLEEP_META = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/sleep_cmd/metainfo.json"
+  String SLEEP_APPCONFIG = "$SLIDER_CORE_APP_PACKAGES/test_min_pkg/sleep_cmd/appConfig.json"
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ba33ecee/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentMinSleepIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentMinSleepIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentMinSleepIT.groovy
index b69effa..779316b 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentMinSleepIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AgentMinSleepIT.groovy
@@ -24,6 +24,7 @@ import org.apache.hadoop.yarn.api.records.YarnApplicationState
 import org.apache.slider.common.SliderExitCodes
 import org.apache.slider.common.params.Arguments
 import org.apache.slider.common.params.SliderActions
+import org.apache.slider.funtest.ResourcePaths
 import org.apache.slider.funtest.framework.AgentCommandTestBase
 import org.apache.slider.funtest.framework.FuntestProperties
 import org.apache.slider.funtest.framework.SliderShell
@@ -39,9 +40,8 @@ public class AgentMinSleepIT extends AgentCommandTestBase
 
   static String CLUSTER = "test-agent-sleep-100"
 
-  static String APP_RESOURCE11 = "../slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/resources.json"
-  static String APP_META11 = "../slider-core/src/test/app_packages/test_min_pkg/sleep_cmd/metainfo.json"
-
+  static String TEST_RESOURCE = ResourcePaths.SLEEP_RESOURCES
+  static String TEST_METADATA = ResourcePaths.SLEEP_META
 
   @Before
   public void prepareCluster() {
@@ -54,14 +54,14 @@ public class AgentMinSleepIT extends AgentCommandTestBase
   }
 
   @Test
-  public void testAgentRegistry() throws Throwable {
+  public void testAgentMinSleepIt() throws Throwable {
     describe("Create a cluster using metainfo and resources only that executes sleep 100")
     def clusterpath = buildClusterPath(CLUSTER)
     File launchReportFile = createTempJsonFile();
 
     SliderShell shell = createSliderApplicationMinPkg(CLUSTER,
-        APP_META11,
-        APP_RESOURCE11,
+        TEST_METADATA,
+        TEST_RESOURCE,
         null,
         [],
         launchReportFile)
@@ -83,7 +83,7 @@ public class AgentMinSleepIT extends AgentCommandTestBase
         CONTAINER_LAUNCH_TIMEOUT)
 
     // sleep for some manual test
-    describe("You may quickly perform manual tests against the application instance " + CLUSTER)
+    describe("You may quickly perform manual tests against the application instance $CLUSTER")
     sleep(1000 * 30)
 
     //stop

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/ba33ecee/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAppsThroughAgent.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAppsThroughAgent.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAppsThroughAgent.groovy
index 8ebb3d2..ea10390 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAppsThroughAgent.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/DemoAppsThroughAgent.groovy
@@ -39,7 +39,7 @@ public class DemoAppsThroughAgent extends AppsThroughAgentIT {
 
   @Override
   void destroyCluster() {
-//    super.destroyCluster()
+
   }
 
 }


[07/17] incubator-slider git commit: SLIDER-970: AASleepIT: compilation failures

Posted by st...@apache.org.
SLIDER-970: AASleepIT: compilation failures


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

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: 10abc40f0576eb4f008e17939e7f2cab6c01f35d
Parents: a6eb923
Author: Steve Loughran <st...@apache.org>
Authored: Thu Nov 19 13:01:07 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Nov 19 13:01:07 2015 +0000

----------------------------------------------------------------------
 .../groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/10abc40f/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
index e4a5d83..e549b70 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
@@ -67,8 +67,8 @@ public class AASleepIT extends AgentCommandTestBase
     SliderShell shell = createSliderApplicationMinPkg(CLUSTER,
         TEST_METADATA,
         TEST_RESOURCE,
-        null,
-        [ARG_RES_COMP_OPT, SLEEP_LONG, "$desired"],
+        ResourcePaths.SLEEP_APPCONFIG,
+        [ARG_RES_COMP_OPT, SLEEP_LONG, Integer.toString(desired)],
         launchReportFile)
 
     logShell(shell)


[14/17] incubator-slider git commit: SLIDER-979 AM web UI to show state of AA request .. test failure due to changes in semantics of RoleStatus.getRequests() to exclude pending

Posted by st...@apache.org.
SLIDER-979 AM web UI to show state of AA request .. test failure due to changes in semantics of RoleStatus.getRequests() to exclude pending


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

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: 962400bdc6e8e9ceb81512df448f94c0ed36609b
Parents: cc94e05
Author: Steve Loughran <st...@apache.org>
Authored: Fri Nov 20 19:07:02 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Fri Nov 20 19:07:02 2015 +0000

----------------------------------------------------------------------
 .../slider/server/appmaster/web/view/TestIndexBlock.groovy       | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/962400bd/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
index de5fdc7..a818e53 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/view/TestIndexBlock.groovy
@@ -119,10 +119,10 @@ public class TestIndexBlock extends BaseMockAppStateAATest {
     aaRole.outstandingAArequest = new OutstandingRequest(2, "")
     // add a requested
     aaRole.incRequested()
-    aaRole.pendingAntiAffineRequests = aarole_pending
+    aaRole.setPendingAntiAffineRequests(aarole_pending)
     assert aaRole.pendingAntiAffineRequests == aarole_pending
 
-    assert aaRole.actualAndRequested == aarole_desired
+    assert aaRole.actualAndRequested == aarole_actual + 1
     StringWriter sw = new StringWriter(64);
     PrintWriter pw = new PrintWriter(sw);
 


[17/17] incubator-slider git commit: SLIDER-970: AASleepIT and TestAgentAAEcho together. Some caching of cluster status updates is breaking TestAgentAAEcho right now...needs some spinning

Posted by st...@apache.org.
SLIDER-970: AASleepIT and TestAgentAAEcho together. Some caching of cluster status updates is breaking TestAgentAAEcho right now...needs some spinning


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

Branch: refs/heads/feature/SLIDER-82-pass-3.1
Commit: 4cc0d0dbd202097fa2d1f62a40d9310a263c3853
Parents: 737d787
Author: Steve Loughran <st...@apache.org>
Authored: Fri Nov 20 21:07:35 2015 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Fri Nov 20 21:07:35 2015 +0000

----------------------------------------------------------------------
 .../java/org/apache/slider/api/ClusterNode.java |  7 +-
 .../java/org/apache/slider/api/RoleKeys.java    |  5 ++
 .../org/apache/slider/client/SliderClient.java  | 11 +++
 .../server/appmaster/SliderAppMaster.java       |  9 ---
 .../providers/agent/DemoAgentAAEcho.groovy      |  2 +-
 .../providers/agent/TestAgentAAEcho.groovy      | 73 +++++++++++++++-----
 .../funtest/framework/CommandTestBase.groovy    | 14 ++--
 .../slider/funtest/lifecycle/AASleepIT.groovy   | 52 ++++++++------
 8 files changed, 116 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/4cc0d0db/slider-core/src/main/java/org/apache/slider/api/ClusterNode.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/ClusterNode.java b/slider-core/src/main/java/org/apache/slider/api/ClusterNode.java
index 1b638bd..d255db0 100644
--- a/slider-core/src/main/java/org/apache/slider/api/ClusterNode.java
+++ b/slider-core/src/main/java/org/apache/slider/api/ClusterNode.java
@@ -38,11 +38,11 @@ import java.io.IOException;
 @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL )
 public final class ClusterNode implements Cloneable {
   protected static final Logger
-    LOG = LoggerFactory.getLogger(ClusterDescription.class);
+    LOG = LoggerFactory.getLogger(ClusterNode.class);
   
   @JsonIgnore
   public ContainerId containerId;
-  
+
   /**
    * server name
    */
@@ -67,8 +67,7 @@ public final class ClusterNode implements Cloneable {
   public boolean released;
   public String host;
   public String hostUrl;
-  
-  
+
   /**
    * state from {@link ClusterDescription}
    */

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/4cc0d0db/slider-core/src/main/java/org/apache/slider/api/RoleKeys.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/api/RoleKeys.java b/slider-core/src/main/java/org/apache/slider/api/RoleKeys.java
index 8b2945e..eda01ad 100644
--- a/slider-core/src/main/java/org/apache/slider/api/RoleKeys.java
+++ b/slider-core/src/main/java/org/apache/slider/api/RoleKeys.java
@@ -65,6 +65,11 @@ public interface RoleKeys {
   String ROLE_PREEMPTED_INSTANCES = "role.failed.preempted.instances";
 
   /**
+   * Number of pending anti-affine instances: {@value}
+   */
+  String ROLE_PENDING_AA_INSTANCES = "role.pending.aa.instances";
+
+  /**
    * Status report: number currently being released: {@value} 
    */
   String ROLE_FAILED_STARTING_INSTANCES = "role.failed.starting.instances";

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/4cc0d0db/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 0753ecc..ed7d4c7 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
@@ -64,12 +64,14 @@ import org.apache.hadoop.yarn.exceptions.YarnException;
 import org.apache.hadoop.yarn.util.ConverterUtils;
 import org.apache.slider.api.ClusterDescription;
 import org.apache.slider.api.ClusterNode;
+import org.apache.slider.api.SliderApplicationApi;
 import org.apache.slider.api.SliderClusterProtocol;
 import org.apache.slider.api.StateValues;
 import org.apache.slider.api.proto.Messages;
 import org.apache.slider.api.types.ContainerInformation;
 import org.apache.slider.api.types.NodeInformationList;
 import org.apache.slider.api.types.SliderInstanceDescription;
+import org.apache.slider.client.ipc.SliderApplicationIpcClient;
 import org.apache.slider.client.ipc.SliderClusterOperations;
 import org.apache.slider.common.Constants;
 import org.apache.slider.common.SliderExitCodes;
@@ -4290,6 +4292,15 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
     return 0;
   }
 
+  /**
+   * Create a new IPC client for talking to slider via what follows the REST API.
+   * Client must already be bonded to the cluster
+   * @return a new IPC client
+   */
+  public SliderApplicationApi createIpcClient()
+    throws IOException, YarnException {
+    return new SliderApplicationIpcClient(createClusterOperations());
+  }
 }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/4cc0d0db/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
index eb7b26a..cc2dc6d 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
@@ -1919,15 +1919,6 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
 /* =================================================================== */
 
   /**
-   * Update the cluster description with anything interesting
-   */
-  public synchronized ClusterDescription updateClusterStatus() {
-    Map<String, String> providerStatus = providerService.buildProviderStatus();
-    assert providerStatus != null : "null provider status";
-    return appState.refreshClusterStatus(providerStatus);
-  }
-
-  /**
    * Launch the provider service
    *
    * @param instanceDefinition definition of the service

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/4cc0d0db/slider-core/src/test/groovy/org/apache/slider/providers/agent/DemoAgentAAEcho.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/providers/agent/DemoAgentAAEcho.groovy b/slider-core/src/test/groovy/org/apache/slider/providers/agent/DemoAgentAAEcho.groovy
index 94e7320..855ed36 100644
--- a/slider-core/src/test/groovy/org/apache/slider/providers/agent/DemoAgentAAEcho.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/providers/agent/DemoAgentAAEcho.groovy
@@ -30,7 +30,7 @@ class DemoAgentAAEcho extends TestAgentAAEcho {
   protected void postLaunchActions(
       SliderClient sliderClient,
       String clustername,
-      String roleName,
+      String rolename,
       Map<String, Integer> roles,
       String proxyAM) {
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/4cc0d0db/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAAEcho.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAAEcho.groovy b/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAAEcho.groovy
index 7072fc6..890ce82 100644
--- a/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAAEcho.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/providers/agent/TestAgentAAEcho.groovy
@@ -21,9 +21,11 @@ package org.apache.slider.providers.agent
 import groovy.transform.CompileStatic
 import groovy.util.logging.Slf4j
 import org.apache.slider.api.ResourceKeys
+import org.apache.slider.api.RoleKeys
 import org.apache.slider.client.SliderClient
 import org.apache.slider.client.rest.SliderApplicationApiRestClient
 import org.apache.slider.common.SliderXmlConfKeys
+import org.apache.slider.common.params.ActionNodesArgs
 import org.apache.slider.core.main.ServiceLauncher
 import org.apache.slider.providers.PlacementPolicy
 import org.apache.slider.server.appmaster.management.MetricsConstants
@@ -63,18 +65,17 @@ class TestAgentAAEcho extends TestAgentEcho {
     ServiceLauncher<SliderClient> launcher = buildAgentCluster(clustername,
         roles,
         [
-            ARG_OPTION, PACKAGE_PATH, slider_core.absolutePath,
-            ARG_OPTION, APP_DEF, toURIArg(app_def_path),
-            ARG_OPTION, AGENT_CONF, toURIArg(agt_conf_path),
-            ARG_OPTION, AGENT_VERSION, toURIArg(agt_ver_path),
-            ARG_RES_COMP_OPT, echo, ResourceKeys.COMPONENT_PRIORITY, "1",
-            ARG_RES_COMP_OPT, echo, ResourceKeys.COMPONENT_PLACEMENT_POLICY,
-              "" + PlacementPolicy.ANTI_AFFINITY_REQUIRED,
-            ARG_COMP_OPT, echo, SCRIPT_PATH, echo_py,
-            ARG_COMP_OPT, echo, SERVICE_NAME, "Agent",
-            ARG_DEFINE, 
-            SliderXmlConfKeys.KEY_SLIDER_AM_DEPENDENCY_CHECKS_DISABLED + "=false",
-            ARG_COMP_OPT, echo, TEST_RELAX_VERIFICATION, "true",
+          ARG_OPTION, PACKAGE_PATH, slider_core.absolutePath,
+          ARG_OPTION, APP_DEF, toURIArg(app_def_path),
+          ARG_OPTION, AGENT_CONF, toURIArg(agt_conf_path),
+          ARG_OPTION, AGENT_VERSION, toURIArg(agt_ver_path),
+          ARG_RES_COMP_OPT, echo, ResourceKeys.COMPONENT_PRIORITY, "1",
+          ARG_RES_COMP_OPT, echo, ResourceKeys.COMPONENT_PLACEMENT_POLICY,
+            "" + PlacementPolicy.ANTI_AFFINITY_REQUIRED,
+          ARG_COMP_OPT, echo, SCRIPT_PATH, echo_py,
+          ARG_COMP_OPT, echo, SERVICE_NAME, "Agent",
+          ARG_DEFINE, SliderXmlConfKeys.KEY_SLIDER_AM_DEPENDENCY_CHECKS_DISABLED + "=false",
+          ARG_COMP_OPT, echo, TEST_RELAX_VERIFICATION, "true",
         ],
         true, true,
         true)
@@ -109,7 +110,7 @@ class TestAgentAAEcho extends TestAgentEcho {
    */
   protected Map<String, Integer> buildRoleMap(String roleName) {
     [
-        (roleName): 3,
+      (roleName): 3,
     ];
   }
 
@@ -118,39 +119,73 @@ class TestAgentAAEcho extends TestAgentEcho {
    * HTTP client operations will have been set up already.
    * @param sliderClient client for the cluster
    * @param clustername cluster name
-   * @param roleName name of the echo role
+   * @param rolename name of the echo role
    * @param roles original set of roles
    * @param proxyAM URl to proxy AM.
    */
   protected void postLaunchActions(
       SliderClient sliderClient,
       String clustername,
-      String roleName,
+      String rolename,
       Map<String, Integer> roles,
       String proxyAM) {
-    def onlyOneEcho = [(roleName): 1]
+    def onlyOneEcho = [(rolename): 1]
+    def requested = roles[rolename]
+
     waitForRoleCount(sliderClient, onlyOneEcho, AGENT_CLUSTER_STARTUP_TIME)
     //sleep a bit
     sleep(5000)
     //expect the role count to be the same
     waitForRoleCount(sliderClient, onlyOneEcho, 1000)
+    def cd = sliderClient.getClusterDescription()
+    assert cd.getRoleOptInt(rolename, RoleKeys.ROLE_PENDING_AA_INSTANCES, -1) == requested - 1;
+    assert !cd.liveness.allRequestsSatisfied
+    assert cd.liveness.requestsOutstanding == requested - 1
+    def ipcClient = sliderClient.createIpcClient()
 
-    def echoInstances = sliderClient.listNodeUUIDsByRole(roleName)
+    def echoInstances = sliderClient.listNodeUUIDsByRole(rolename)
     queryRestAPI(sliderClient, roles, proxyAM)
     // flex size
     // while running, ask for many more, expect them to still be outstanding
     sleep(5000)
-    sliderClient.flex(clustername, [(roleName): 50]);
+
+    requested = 50
+    def expectedPending = requested - 1
+
+    sliderClient.flex(clustername, [(rolename): requested]);
     waitForRoleCount(sliderClient, onlyOneEcho, 1000)
+    sleep(5000)
+    def now = System.currentTimeMillis();
+
+    def componentInformation = ipcClient.getComponent(rolename)
+    assert !ipcClient.getComponent(rolename).isAARequestOutstanding
+
+    assert componentInformation.pendingAntiAffineRequestCount == expectedPending
+
+    cd = sliderClient.getClusterDescription()
+    assert !cd.liveness.allRequestsSatisfied
+    assert cd.liveness.requestsOutstanding == requested - 1
+    assert cd.createTime >= now
+    assert expectedPending == cd.getRoleOptInt(rolename, RoleKeys.ROLE_PENDING_AA_INSTANCES, -1)
 
     // while running, flex it to size = 1
     sleep(1000)
     sliderClient.flex(clustername, onlyOneEcho);
     waitForRoleCount(sliderClient, onlyOneEcho, 1000)
 
-    def echoInstances2 = sliderClient.listNodeUUIDsByRole(roleName)
+    def echoInstances2 = sliderClient.listNodeUUIDsByRole(rolename)
     assertArrayEquals(echoInstances, echoInstances2)
 
+    assert !ipcClient.getComponent(rolename).isAARequestOutstanding
+    cd = sliderClient.getClusterDescription()
+    assert cd.liveness.allRequestsSatisfied
+
+
+    assert cd.getRoleOptInt(rolename, RoleKeys.ROLE_PENDING_AA_INSTANCES, -1) == 0;
+
+    def nodes = sliderClient.listYarnClusterNodes(new ActionNodesArgs())
+    assert nodes.size() == 1
+    assert nodes[0].entries[rolename].live == 1
   }
 
   protected void queryRestAPI(SliderClient sliderClient, Map<String, Integer> roles, String proxyAM) {

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/4cc0d0db/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
index 252bb79..5fa4c2a 100644
--- a/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
+++ b/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/CommandTestBase.groovy
@@ -842,11 +842,13 @@ abstract class CommandTestBase extends SliderTestUtils {
    * @param id application ID
    * @return an application report or null
    */
-  public static NodeInformationList listNodes(boolean healthy = false, String label = "") {
+  public static NodeInformationList listNodes(String name = "", boolean healthy = false, String label = "") {
     File reportFile = createTempJsonFile();
     try {
-      def shell = nodes(reportFile, healthy, label)
-      shell.dumpOutput()
+      def shell = nodes(name, reportFile, healthy, label)
+      if (log.isDebugEnabled()) {
+        shell.dumpOutput()
+      }
       JsonSerDeser<NodeInformationList> serDeser = NodeInformationList.createSerializer();
       serDeser.fromFile(reportFile)
     } finally {
@@ -856,16 +858,20 @@ abstract class CommandTestBase extends SliderTestUtils {
 
   /**
    * List cluster nodes
+   * @param name of cluster or null
    * @param out output file (or null)
    * @param healthy list healthy nodes only
    * @param label label to filter on
    * @return output
    */
-  static SliderShell nodes(File out, boolean healthy = false, String label = "") {
+  static SliderShell nodes(String name, File out = null, boolean healthy = false, String label = "") {
     def commands = [ACTION_NODES]
     if (label) {
       commands += [ ARG_LABEL, label]
     }
+    if (name) {
+      commands << name
+    }
     if (out) {
       commands += [ARG_OUTPUT, out.absolutePath]
     }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/4cc0d0db/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
----------------------------------------------------------------------
diff --git a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
index 84ef340..c42edf8 100644
--- a/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
+++ b/slider-funtest/src/test/groovy/org/apache/slider/funtest/lifecycle/AASleepIT.groovy
@@ -23,6 +23,9 @@ import groovy.util.logging.Slf4j
 import org.apache.hadoop.yarn.api.records.YarnApplicationState
 import org.apache.slider.api.ClusterDescription
 import org.apache.slider.api.ResourceKeys
+import org.apache.slider.api.RoleKeys
+import org.apache.slider.api.types.NodeEntryInformation
+import org.apache.slider.api.types.NodeInformation
 import org.apache.slider.api.types.NodeInformationList
 import org.apache.slider.common.SliderExitCodes
 import org.apache.slider.common.params.Arguments
@@ -41,12 +44,14 @@ import org.junit.Test
 public class AASleepIT extends AgentCommandTestBase
     implements FuntestProperties, Arguments, SliderExitCodes, SliderActions {
 
-
   static String NAME = "test-aa-sleep"
 
   static String TEST_RESOURCE = ResourcePaths.SLEEP_RESOURCES
   static String TEST_METADATA = ResourcePaths.SLEEP_META
   public static final String SLEEP_100 = "SLEEP_100"
+  public static final int SLEEP_LONG_PRIORITY = 3
+  public static final String SLEEP_LONG_PRIORITY_S = Integer.toString(SLEEP_LONG_PRIORITY)
+
   public static final String SLEEP_LONG = "SLEEP_LONG"
 
   @Before
@@ -69,7 +74,7 @@ public class AASleepIT extends AgentCommandTestBase
 
     describe "list nodes"
 
-    def healthyNodes = listNodes(true)
+    def healthyNodes = listNodes("", true)
 
     def healthyNodeCount = healthyNodes.size()
     describe("Cluster nodes : ${healthyNodeCount}")
@@ -78,34 +83,28 @@ public class AASleepIT extends AgentCommandTestBase
     File launchReportFile = createTempJsonFile();
 
     int desired = buildDesiredCount(healthyNodeCount)
-    def clusterpath = buildClusterPath(NAME)
 
     SliderShell shell = createSliderApplicationMinPkg(NAME,
-        TEST_METADATA,
-        TEST_RESOURCE,
-        ResourcePaths.SLEEP_APPCONFIG,
-        [ARG_RES_COMP_OPT, SLEEP_LONG, ResourceKeys.COMPONENT_INSTANCES, Integer.toString(desired)],
-        launchReportFile)
+      TEST_METADATA,
+      TEST_RESOURCE,
+      ResourcePaths.SLEEP_APPCONFIG,
+      [
+        ARG_RES_COMP_OPT, SLEEP_LONG, ResourceKeys.COMPONENT_INSTANCES, Integer.toString( desired),
+        ARG_RES_COMP_OPT, SLEEP_LONG, ResourceKeys.COMPONENT_PRIORITY, SLEEP_LONG_PRIORITY_S
+      ],
+      launchReportFile)
 
     logShell(shell)
 
     def appId = ensureYarnApplicationIsUp(launchReportFile)
 
-    //at this point the cluster should exist.
-    assertPathExists(
-        clusterFS,
-        "Cluster parent directory does not exist",
-        clusterpath.parent)
-
-    assertPathExists(clusterFS, "Cluster directory does not exist", clusterpath)
-
     status(0, NAME)
 
     def expected = buildExpectedCount(desired)
     expectLiveContainerCountReached(NAME, SLEEP_100, expected,
         CONTAINER_LAUNCH_TIMEOUT)
 
-    operations(NAME, loadAppReport(launchReportFile), desired, expected)
+    operations(NAME, loadAppReport(launchReportFile), desired, expected, healthyNodes)
 
     //stop
     freeze(0, NAME,
@@ -132,18 +131,31 @@ public class AASleepIT extends AgentCommandTestBase
   protected void operations(String name,
       SerializedApplicationReport appReport,
       int desired,
-      int expected ) {
-
+      int expected,
+      NodeInformationList healthyNodes) {
 
     // now here await for the cluster size to grow: if it does, there's a problem
-    ClusterDescription cd
     // spin for a while and fail if the number ever goes above it.
+    ClusterDescription cd = null
     5.times {
       cd = assertContainersLive(NAME, SLEEP_LONG, expected)
       sleep(1000 * 10)
     }
 
     // here cluster is still 1 below expected
+    def role = cd.getRole(SLEEP_LONG)
+    assert "1" == role.get(RoleKeys.ROLE_PENDING_AA_INSTANCES)
+
+    // look through the nodes
+    def currentNodes = listNodes(name)
+    // assert that there is no entry of the sleep long priority on any node
+    currentNodes.each { NodeInformation it ->
+      def entry = it.entries[SLEEP_LONG]
+      assert entry == null || entry.live <= 1
+    }
+
+    // now reduce the cluster size and assert that the size stays the same
+
 
   }
 }