ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ja...@apache.org
Subject ambari git commit: AMBARI-15475: Editing tmp dir from single to multiple dir doesn't trigger the backend change
Date Sat, 19 Mar 2016 01:17:01 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 edfbe19b6 -> e4899550f


AMBARI-15475: Editing tmp dir from single to multiple dir doesn't trigger the backend change


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

Branch: refs/heads/branch-2.2
Commit: e4899550fc1f8f1fbfb17228175e15aa4cd8a18c
Parents: edfbe19
Author: Jun Aoki <jaoki@apache.org>
Authored: Fri Mar 18 18:16:48 2016 -0700
Committer: Jun Aoki <jaoki@apache.org>
Committed: Fri Mar 18 18:16:48 2016 -0700

----------------------------------------------------------------------
 .../HAWQ/2.0.0/package/scripts/common.py             | 14 ++++++++++++++
 .../HAWQ/2.0.0/package/scripts/hawqsegment.py        |  7 +++----
 .../HAWQ/2.0.0/package/scripts/master_helper.py      | 15 ++-------------
 .../HAWQ/2.0.0/package/scripts/params.py             |  4 ++--
 .../HAWQ/2.0.0/package/scripts/utils.py              |  6 +++++-
 .../test/python/stacks/2.3/HAWQ/test_hawqmaster.py   | 10 +++++-----
 .../test/python/stacks/2.3/HAWQ/test_hawqsegment.py  | 13 +++++++++----
 .../test/python/stacks/2.3/HAWQ/test_hawqstandby.py  |  9 +++++----
 8 files changed, 45 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e4899550/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py
b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py
index d62332d..20336bc 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py
@@ -52,6 +52,20 @@ def __create_hawq_user():
        groups=[hawq_constants.hawq_group, params.user_group],
        ignore_failures=True)
 
+def create_master_dir(dir_path):
+  """
+  Creates the master directory (hawq_master_dir or hawq_segment_dir) for HAWQ
+  """
+  utils.create_dir_as_hawq_user(dir_path)
+  Execute("chmod 700 {0}".format(dir_path), user=hawq_constants.root_user, timeout=hawq_constants.default_exec_timeout)
+
+def create_temp_dirs(dir_paths):
+  """
+  Creates the temp directories (hawq_master_temp_dir or hawq_segment_temp_dir) for HAWQ
+  """
+  for path in dir_paths.split(','):
+    if path != "":
+      utils.create_dir_as_hawq_user(path)
 
 def __set_home_dir_ownership():
   """

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4899550/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py
b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py
index 0a597b6..1891ede 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py
@@ -42,6 +42,8 @@ class HawqSegment(Script):
     env.set_params(hawq_constants)
     common.setup_user()
     common.setup_common_configurations()
+    # temp directories are stateless and they should be recreated when configured (started)
+    common.create_temp_dirs(params.hawq_segment_temp_dirs)
 
 
   def __start_segment(self):
@@ -80,10 +82,7 @@ class HawqSegment(Script):
   @staticmethod
   def __init_segment():
     import params
-
-    # Create segment directories
-    utils.create_dir_as_hawq_user(params.hawq_segment_dir)
-    utils.create_dir_as_hawq_user(params.hawq_segment_temp_dir.split(','))
+    common.create_master_dir(params.hawq_segment_dir)
 
     # Initialize hawq segment
     utils.exec_hawq_operation(hawq_constants.INIT, "{0} -a -v".format(hawq_constants.SEGMENT))

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4899550/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
index 9482b35..330b6c0 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
@@ -59,20 +59,9 @@ def configure_master():
   common.setup_user()
   common.setup_common_configurations()
   __setup_master_specific_conf_files()
-  __create_local_dirs()
-
-
-def __create_local_dirs():
-  """
-  Creates the required local directories for HAWQ
-  """
   import params
-  # Create Master directories
-  utils.create_dir_as_hawq_user(params.hawq_master_dir)
-  utils.create_dir_as_hawq_user(params.hawq_master_temp_dir.split(','))
-
-  Execute("chmod 700 {0}".format(params.hawq_master_dir), user=hawq_constants.root_user,
timeout=hawq_constants.default_exec_timeout)
-
+  common.create_master_dir(params.hawq_master_dir)
+  common.create_temp_dirs(params.hawq_master_temp_dirs)
 
 def __setup_hdfs_dirs():
   """

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4899550/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/params.py
b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/params.py
index 1bdc5aa..d3c9009 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/params.py
@@ -138,8 +138,8 @@ yarn_client = config['configurations']['yarn-client']
 # Directories and ports
 hawq_master_dir = hawq_site.get('hawq_master_directory')
 hawq_segment_dir = hawq_site.get('hawq_segment_directory')
-hawq_master_temp_dir = hawq_site.get('hawq_master_temp_directory')
-hawq_segment_temp_dir = hawq_site.get('hawq_segment_temp_directory')
+hawq_master_temp_dirs = hawq_site.get('hawq_master_temp_directory')
+hawq_segment_temp_dirs = hawq_site.get('hawq_segment_temp_directory')
 # Extract hawq hdfs directory from hdfs url. Ex: /hawq/hawq_default from
 # host:8080/hawq/hawq_default
 hawq_hdfs_data_dir = "/{0}".format(hawq_site.get('hawq_dfs_url').split('/', 1)[1])

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4899550/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 dc6c203..0baa4c5 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
@@ -35,7 +35,11 @@ def create_dir_as_hawq_user(directory):
   """
   Creates directories with hawq_user and hawq_group (defaults to gpadmin:gpadmin)
   """
-  Directory(directory, recursive=True, owner=hawq_constants.hawq_user, group=hawq_constants.hawq_group)
+  Directory(
+        directory,
+        recursive=True,
+        owner=hawq_constants.hawq_user,
+        group=hawq_constants.hawq_group)
 
 
 def exec_hawq_operation(operation, option, not_if=None, only_if=None, logoutput=True):

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4899550/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqmaster.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqmaster.py b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqmaster.py
index 14b5a5f..4552f3a 100644
--- a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqmaster.py
+++ b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqmaster.py
@@ -100,17 +100,17 @@ class TestHawqMaster(RMFTestCase):
         recursive = True
         )
 
+    self.assertResourceCalled('Execute', 'chmod 700 /data/hawq/master',
+        user = 'root',
+        timeout = 600
+        )
+
     self.assertResourceCalled('Directory', '/tmp',
         group = self.GPADMIN,
         owner = self.GPADMIN,
         recursive = True
         )
 
-    self.assertResourceCalled('Execute', 'chmod 700 /data/hawq/master',
-        user = 'root',
-        timeout =  600
-        )
-
 
   @patch ('hawqmaster.common.__set_osparams')
   def test_configure_default(self, set_osparams_mock):

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4899550/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqsegment.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqsegment.py b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqsegment.py
index 6ca83b7..ac315f2 100644
--- a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqsegment.py
+++ b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqsegment.py
@@ -70,6 +70,12 @@ class TestHawqSegment(RMFTestCase):
         mode = 0644
         )
 
+    self.assertResourceCalled('Directory', '/tmp',
+        owner = self.GPADMIN,
+        group = self.GPADMIN,
+        recursive = True
+        )
+
 
 
   @patch ('hawqsegment.common.__set_osparams')
@@ -121,10 +127,9 @@ class TestHawqSegment(RMFTestCase):
         recursive = True
         )
 
-    self.assertResourceCalled('Directory', '/tmp',
-        owner = self.GPADMIN,
-        group = self.GPADMIN,
-        recursive = True
+    self.assertResourceCalled('Execute', 'chmod 700 /data/hawq/segment',
+        user = 'root',
+        timeout = 600
         )
 
     self.assertResourceCalled('Execute', 'source /usr/local/hawq/greenplum_path.sh &&
hawq init segment -a -v',

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4899550/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py
index eaba496..c0ec9f9 100644
--- a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py
+++ b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py
@@ -98,16 +98,17 @@ class TestHawqStandby(RMFTestCase):
         recursive = True
         )
 
+    self.assertResourceCalled('Execute', 'chmod 700 /data/hawq/master',
+        user = 'root',
+        timeout = 600
+        )
+
     self.assertResourceCalled('Directory', '/tmp',
         group = self.GPADMIN,
         owner = self.GPADMIN,
         recursive = True
         )
 
-    self.assertResourceCalled('Execute', 'chmod 700 /data/hawq/master',
-        user = 'root',
-        timeout = 600
-        )
 
 
   @patch ('hawqstandby.common.__set_osparams')


Mime
View raw message