You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2013/05/08 19:26:06 UTC

svn commit: r1480366 - in /incubator/ambari/trunk: ./ ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/ ambari-agent/src/main/puppet/modules/hdp-yarn/files/ ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/ ambari-agent/src/main/puppet/...

Author: swagle
Date: Wed May  8 17:26:05 2013
New Revision: 1480366

URL: http://svn.apache.org/r1480366
Log:
AMBARI-2096. Create smoke test for HISTORYSERVER. (swagle)

Added:
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/historyserver/
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/historyserver/service_check.pp
Removed:
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/nodemanager/service_check.pp
Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/namenode.pp
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/files/validateYarnComponentStatus.py
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/params.pp
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/smoketest.pp
    incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/Role.java

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1480366&r1=1480365&r2=1480366&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Wed May  8 17:26:05 2013
@@ -12,6 +12,8 @@ Trunk (unreleased changes):
 
  NEW FEATURES
 
+ AMBARI-2096. Create smoke test for HISTORYSERVER. (swagle)
+
  AMBARI-2094. Create smoke test for NODEMANAGER component as a part of 
  MapReduce V2 Service check. (swagle)
 

Modified: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/namenode.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/namenode.pp?rev=1480366&r1=1480365&r2=1480366&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/namenode.pp (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/namenode.pp Wed May  8 17:26:05 2013
@@ -167,7 +167,7 @@ define hdp-hadoop::namenode::create_app_
     }
 
     if $stack_version in ("2.0.1") {
-      if ($hdp::params::nm_host != "") {
+      if ($hdp::params::nm_hosts != "") {
         if ($hdp::params::yarn_log_aggregation_enabled == "true") {
           $yarn_user = $hdp::params::yarn_user
           $yarn_nm_app_log_dir = $hdp::params::yarn_nm_app_log_dir

Modified: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/files/validateYarnComponentStatus.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/files/validateYarnComponentStatus.py?rev=1480366&r1=1480365&r2=1480366&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/files/validateYarnComponentStatus.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/files/validateYarnComponentStatus.py Wed May  8 17:26:05 2013
@@ -23,11 +23,11 @@ import urllib2, urllib
 import json
 
 RESOURCEMANAGER = 'rm'
-NODEMANAGER = 'nm'
+HISTORYSERVER ='hs'
 
 STARTED_STATE = 'STARTED'
 
-def validate(path, port):
+def validate(component, path, port):
 
   try:
     url = 'http://localhost:' + str(port) + path
@@ -35,19 +35,37 @@ def validate(path, port):
     urllib2.install_opener(opener)
     request = urllib2.Request(url)
     handler = urllib2.urlopen(request)
-    cluster_info = json.loads(handler.read())
-    component_state = cluster_info['clusterInfo']['state']
-  
-    if component_state == STARTED_STATE:
-      print 'Component''s state is: ' + str(component_state)
+    response = json.loads(handler.read())
+    is_valid = validateResponse(component, response)
+    if is_valid:
       exit(0)
     else:
-      print 'Component''s state is not' + STARTED_STATE
       exit(1)
   except Exception as e:
     print 'Error checking status of component', e
     exit(1)
 
+
+def validateResponse(component, response):
+  try:
+    if component == RESOURCEMANAGER:
+      rm_state = response['clusterInfo']['state']
+      if rm_state == STARTED_STATE:
+        return True
+      else:
+        return False
+    elif component == HISTORYSERVER:
+      hs_start_time = response['historyInfo']['startedOn']
+      if hs_start_time > 0:
+        return True
+      else:
+        return False
+    else:
+      return False
+  except Exception as e:
+    print 'Error validation of response', e
+    return False
+
 #
 # Main.
 #
@@ -64,12 +82,12 @@ def main():
   
   if component == RESOURCEMANAGER:
     path = '/ws/v1/cluster/info'
-  elif component == NODEMANAGER:
-    path = '/ws/v1/node/info'
+  elif component == HISTORYSERVER:
+    path = '/ws/v1/history/info'
   else:
     parser.error("Invalid component")
 
-  validate(path, port)
+  validate(component, path, port)
 
 if __name__ == "__main__":
   main()

Added: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/historyserver/service_check.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/historyserver/service_check.pp?rev=1480366&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/historyserver/service_check.pp (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/historyserver/service_check.pp Wed May  8 17:26:05 2013
@@ -0,0 +1,24 @@
+#
+#
+# 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.
+#
+#
+class hdp-yarn::historyserver::service_check() inherits hdp-yarn::params
+{
+  class { 'hdp-yarn::smoketest': component_name => 'historyserver'}
+}
\ No newline at end of file

Modified: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/params.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/params.pp?rev=1480366&r1=1480365&r2=1480366&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/params.pp (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/params.pp Wed May  8 17:26:05 2013
@@ -36,6 +36,8 @@ class hdp-yarn::params(
   $yarn_pid_dir_prefix = hdp_default("hadoop/yarn-env/yarn_pid_dir_prefix","/var/run/hadoop-yarn")
   
   ## yarn-site
-  $yarn_webui_port = hdp_default("yarn-site/yarn.resourcemanager.webapp.address", "8088")
- 
+  $rm_webui_port = hdp_default("yarn-site/yarn.resourcemanager.webapp.address", "8088")
+  $nm_webui_port = hdp_default("yarn-site/yarn.nodemanager.webapp.address", "8042")
+  $hs_webui_port = hdp_default("yarn-site/mapreduce.jobhistory.address", "19888")
+
 }

Modified: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/smoketest.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/smoketest.pp?rev=1480366&r1=1480365&r2=1480366&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/smoketest.pp (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/smoketest.pp Wed May  8 17:26:05 2013
@@ -22,12 +22,16 @@ class hdp-yarn::smoketest(
   $component_name = undef
 )
 {
+  $rm_webui_port = $hdp-yarn::params::rm_webui_port
+  $nm_webui_port = $hdp-yarn::params::nm_webui_port
+  $hs_webui_port = $hdp-yarn::params::hs_webui_port
+
   if ($component_name == 'resourcemanager') {
-    $component_type = 'rm' 
-  } elsif ($component_name == 'nodemanger') {
-    $component_type = 'nm' 
+    $component_type = 'rm'
+    $component_port = $rm_webui_port
   } elsif ($component_name == 'historyserver') {
     $component_type = 'hs' 
+    $component_port = $hs_webui_port
   } else {
     hdp_fail("Unsupported component name: $component_name")
   }
@@ -36,8 +40,8 @@ class hdp-yarn::smoketest(
   
   $validateStatusFileName = "validateYarnComponentStatus.py"
   $validateStatusFilePath = "/tmp/$validateStatusFileName"
-  $yarn_webui_port = $hdp-yarn::params::yarn_webui_port
-  $validateStatusCmd = "su - ${smoke_test_user} -c 'python $validateStatusFilePath $component_type -p $yarn_webui_port'"
+
+  $validateStatusCmd = "su - ${smoke_test_user} -c 'python $validateStatusFilePath $component_type -p $component_port'"
 
   file { $validateStatusFilePath:
     ensure => present,

Modified: incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py?rev=1480366&r1=1480365&r2=1480366&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py Wed May  8 17:26:05 2013
@@ -125,7 +125,7 @@ rolesToClass = {
   'DECOMMISSION_DATANODE': 'hdp-hadoop::hdfs::decommission',
   'HUE_SERVICE_CHECK': 'hdp-hue::service_check',
   'RESOURCEMANAGER_SERVICE_CHECK': 'hdp-yarn::resourcemanager::service_check',
-  'NODEMANAGER_SERVICE_CHECK': 'hdp-yarn::nodemanager::service_check',
+  'HISTORYSERVER_SERVICE_CHECK': 'hdp-yarn::historyserver::service_check',
   'TEZ_CLIENT': 'hdp-tez::tez_client'
 }
 

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/Role.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/Role.java?rev=1480366&r1=1480365&r2=1480366&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/Role.java (original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/Role.java Wed May  8 17:26:05 2013
@@ -72,7 +72,7 @@ public enum Role {
   AMBARI_SERVER_ACTION,
   RESOURCEMANAGER,
   RESOURCEMANAGER_SERVICE_CHECK,
-  NODEMANAGER_SERVICE_CHECK,
+  HISTORYSERVER_SERVICE_CHECK,
   NODEMANAGER,
   YARN_CLIENT,
   HISTORYSERVER,