ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [04/16] ambari git commit: AMBARI-14872: HAWQ service check fails if master port is not 5432 (adenissov via jaoki)
Date Wed, 03 Feb 2016 19:14:18 GMT
AMBARI-14872: HAWQ service check fails if master port is not 5432 (adenissov via jaoki)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6fb00585
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6fb00585
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6fb00585

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 6fb00585cf9b7e55ce615bbfc4d7ee11f4ed319e
Parents: 94c13ee
Author: Jun Aoki <jaoki@apache.org>
Authored: Tue Feb 2 15:51:24 2016 -0800
Committer: Jun Aoki <jaoki@apache.org>
Committed: Tue Feb 2 15:51:24 2016 -0800

----------------------------------------------------------------------
 .../HAWQ/2.0.0/package/scripts/service_check.py | 22 ++++++++++----------
 .../HAWQ/2.0.0/package/scripts/utils.py         |  4 ++--
 2 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6fb00585/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/service_check.py
b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/service_check.py
index 4e5dc32..6e7ea0f 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/service_check.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/service_check.py
@@ -30,18 +30,17 @@ class HAWQServiceCheck(Script):
   Runs a set of HAWQ tests to verify if the service has been setup correctly
   """
 
-  def __init__(self):
-    self.active_master_host = common.get_local_hawq_site_property("hawq_master_address_host")
-    self.checks_failed = 0
-    self.total_checks = 3
-
-
   def service_check(self, env):
     """
     Runs service check for HAWQ.
     """
     import params
 
+    self.active_master_host = params.hawqmaster_host
+    self.active_master_port = params.hawq_master_address_port
+    self.checks_failed = 0
+    self.total_checks = 2
+
     # Checks HAWQ cluster state
     self.check_state()
 
@@ -50,6 +49,7 @@ class HAWQServiceCheck(Script):
 
     # Runs check for writing and reading external tables on HDFS using PXF, if PXF is installed
     if params.is_pxf_installed:
+      self.total_checks += 1
       self.check_hawq_pxf_hdfs()
     else:
       Logger.info("PXF not installed. Skipping HAWQ-PXF checks...")
@@ -128,32 +128,32 @@ class HAWQServiceCheck(Script):
   def drop_table(self, table):
     Logger.info("Dropping {0} table if exists".format(table['name']))
     sql_cmd = "DROP {0} TABLE IF EXISTS {1}".format(table['drop_type'], table['name'])
-    exec_psql_cmd(sql_cmd, self.active_master_host)
+    exec_psql_cmd(sql_cmd, self.active_master_host, self.active_master_port)
 
 
   def create_table(self, table):
     Logger.info("Creating table {0}".format(table['name']))
     sql_cmd = "CREATE {0} TABLE {1} {2}".format(table['create_type'], table['name'], table['description'])
-    exec_psql_cmd(sql_cmd, self.active_master_host)
+    exec_psql_cmd(sql_cmd, self.active_master_host, self.active_master_port)
 
 
   def insert_data(self, table):
     Logger.info("Inserting data to table {0}".format(table['name']))
     sql_cmd = "INSERT INTO  {0} SELECT * FROM generate_series(1,10)".format(table['name'])
-    exec_psql_cmd(sql_cmd, self.active_master_host)
+    exec_psql_cmd(sql_cmd, self.active_master_host, self.active_master_port)
 
 
   def query_data(self, table):
     Logger.info("Querying data from table {0}".format(table['name']))
     sql_cmd = "SELECT * FROM {0}".format(table['name'])
-    exec_psql_cmd(sql_cmd, self.active_master_host)
+    exec_psql_cmd(sql_cmd, self.active_master_host, self.active_master_port)
 
 
   def validate_data(self, table):
     expected_data = "55"
     Logger.info("Validating data inserted, finding sum of all the inserted entries. Expected
output: {0}".format(expected_data))
     sql_cmd = "SELECT sum(col1) FROM {0}".format(table['name'])
-    _, stdout, _ = exec_psql_cmd(sql_cmd, self.active_master_host, tuples_only=False)
+    _, stdout, _ = exec_psql_cmd(sql_cmd, self.active_master_host, self.active_master_port,
tuples_only=False)
     if expected_data != stdout.strip():
       Logger.error("Incorrect data returned. Expected Data: {0} Actual Data: {1}".format(expected_data,
stdout))
       raise Fail("Incorrect data returned.")

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fb00585/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py
b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py
index ade4b90..e607a28 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/utils.py
@@ -91,11 +91,11 @@ def exec_ssh_cmd(hostname, cmd):
   return process.returncode, stdout, stderr
 
 
-def exec_psql_cmd(command, host, db="template1", tuples_only=True):
+def exec_psql_cmd(command, host, port, db="template1", tuples_only=True):
   """
   Sets up execution environment and runs the HAWQ queries
   """
-  src_cmd = "source {0}".format(hawq_constants.hawq_greenplum_path_file)
+  src_cmd = "export PGPORT={0} && source {1}".format(port, hawq_constants.hawq_greenplum_path_file)
   if tuples_only:
     cmd = src_cmd + " && psql -d {0} -c \\\\\\\"{1};\\\\\\\"".format(db, command)
   else:


Mime
View raw message