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-15019: Refactor HAWQ common.py after moving config substitution to UI (lavjain via jaoki)
Date Wed, 17 Feb 2016 22:45:57 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 52b72ac59 -> bb314bd35


AMBARI-15019: Refactor HAWQ common.py after moving config substitution to UI (lavjain via
jaoki)


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

Branch: refs/heads/branch-2.2
Commit: bb314bd35549d1fa79534041146e2033d795514a
Parents: 52b72ac
Author: Jun Aoki <jaoki@apache.org>
Authored: Wed Feb 17 14:45:44 2016 -0800
Committer: Jun Aoki <jaoki@apache.org>
Committed: Wed Feb 17 14:45:44 2016 -0800

----------------------------------------------------------------------
 .../HAWQ/2.0.0/package/scripts/common.py        | 60 ++++----------------
 .../HAWQ/2.0.0/package/scripts/params.py        | 19 +++++--
 2 files changed, 23 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bb314bd3/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 05b56f5..edeb5af 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
@@ -20,9 +20,7 @@ import os
 import time
 import crypt
 import filecmp
-from resource_management.libraries.resources.xml_config import XmlConfig
 from resource_management.core.resources.system import Execute, Directory, File
-from resource_management.libraries.script.config_dictionary import ConfigDictionary
 from resource_management.core.logger import Logger
 from resource_management.core.system import System
 from resource_management.core.exceptions import Fail
@@ -67,58 +65,20 @@ def setup_common_configurations():
   """
   Sets up the config files common to master, standby and segment nodes.
   """
-  __update_hdfs_client()
-  __update_yarn_client()
-  __update_hawq_site()
-  __set_osparams()
-
-def __update_hdfs_client():
-  """
-  Writes hdfs-client.xml on the local filesystem on hawq nodes.
-  If hdfs ha is enabled, appends related parameters to hdfs-client.xml
-  """
   import params
 
-  hdfs_client_dict = params.hdfs_client.copy()
+  params.XmlConfig(filename="hdfs-client.xml",
+                   configurations=params.hdfs_client,
+                   configuration_attributes=params.config_attrs['hdfs-client'])
 
-  XmlConfig("hdfs-client.xml",
-            conf_dir=hawq_constants.hawq_config_dir,
-            configurations=ConfigDictionary(hdfs_client_dict),
-            configuration_attributes=params.config['configuration_attributes']['hdfs-client'],
-            owner=hawq_constants.hawq_user,
-            group=hawq_constants.hawq_group,
-            mode=0644)
+  params.XmlConfig(filename="yarn-client.xml",
+                   configurations=params.yarn_client,
+                   configuration_attributes=params.config_attrs['yarn-client'])
 
-
-def __update_yarn_client():
-  """
-  Writes yarn-client.xml on the local filesystem on hawq nodes.
-  If yarn ha is enabled, appends related parameters to yarn-client.xml
-  """
-  import params
-
-  XmlConfig("yarn-client.xml",
-            conf_dir=hawq_constants.hawq_config_dir,
-            configurations=params.yarn_client,
-            configuration_attributes=params.config['configuration_attributes']['yarn-client'],
-            owner=hawq_constants.hawq_user,
-            group=hawq_constants.hawq_group,
-            mode=0644)
-
-
-def __update_hawq_site():
-  """
-  Sets up hawq-site.xml
-  """
-  import params
-  
-  XmlConfig("hawq-site.xml",
-            conf_dir=hawq_constants.hawq_config_dir,
-            configurations=ConfigDictionary(params.hawq_site),
-            configuration_attributes=params.config['configuration_attributes']['hawq-site'],
-            owner=hawq_constants.hawq_user,
-            group=hawq_constants.hawq_group,
-            mode=0644)
+  params.XmlConfig(filename="hawq-site.xml",
+                   configurations=params.hawq_site,
+                   configuration_attributes=params.config_attrs['hawq-site'])
+  __set_osparams()
 
 
 def __set_osparams():

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb314bd3/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 48b933e..74c9813 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
@@ -16,16 +16,16 @@ See the License for the specific language governing permissions and
 limitations under the License.
 """
 
-import os
 import functools
-from hawq_constants import PXF_PORT, pxf_hdfs_test_dir
+import hawq_constants
 from resource_management import Script
 from resource_management.libraries.functions.default import default
 from resource_management.libraries.resources.hdfs_resource import HdfsResource
+from resource_management.libraries.resources.xml_config import XmlConfig
 from resource_management.libraries.functions import get_kinit_path
 
 config = Script.get_config()
-
+config_attrs = config['configuration_attributes']
 
 def __get_component_host(component):
   """
@@ -76,9 +76,16 @@ HdfsResource = functools.partial(HdfsResource,
                                  default_fs=default_fs)
 
 
+# XMLConfig partial function
+XmlConfig = functools.partial(XmlConfig,
+                              conf_dir=hawq_constants.hawq_config_dir,
+                              owner=hawq_constants.hawq_user,
+                              group=hawq_constants.hawq_group,
+                              mode=0644)
+
 # For service Check
 is_pxf_installed = __get_component_host("pxf_hosts") is not None
-namenode_path =  "{0}:{1}".format(__get_component_host("namenode_host"), PXF_PORT) if dfs_nameservice
is None else dfs_nameservice
+namenode_path =  "{0}:{1}".format(__get_component_host("namenode_host"), hawq_constants.PXF_PORT)
if dfs_nameservice is None else dfs_nameservice
 table_definition = {
   "HAWQ": {
     "name": "ambari_hawq_test",
@@ -90,13 +97,13 @@ table_definition = {
     "name": "ambari_hawq_pxf_hdfs_readable_test",
     "create_type": "READABLE EXTERNAL",
     "drop_type": "EXTERNAL",
-    "description": "(col1 int) LOCATION ('pxf://{0}{1}?PROFILE=HdfsTextSimple') FORMAT 'TEXT'".format(namenode_path,
pxf_hdfs_test_dir)
+    "description": "(col1 int) LOCATION ('pxf://{0}{1}?PROFILE=HdfsTextSimple') FORMAT 'TEXT'".format(namenode_path,
hawq_constants.pxf_hdfs_test_dir)
   },
   "EXTERNAL_HDFS_WRITABLE": {
     "name": "ambari_hawq_pxf_hdfs_writable_test",
     "create_type": "WRITABLE EXTERNAL",
     "drop_type": "EXTERNAL",
-    "description": "(col1 int) LOCATION ('pxf://{0}{1}?PROFILE=HdfsTextSimple') FORMAT 'TEXT'".format(namenode_path,
pxf_hdfs_test_dir)
+    "description": "(col1 int) LOCATION ('pxf://{0}{1}?PROFILE=HdfsTextSimple') FORMAT 'TEXT'".format(namenode_path,
hawq_constants.pxf_hdfs_test_dir)
   }
 }
 


Mime
View raw message