瀏覽代碼

AMBARI-15578: Stack Featurize Atlas Service (jluniya)

Jayush Luniya 9 年之前
父節點
當前提交
d812b17048

+ 1 - 0
ambari-common/src/main/python/resource_management/libraries/functions/constants.py

@@ -63,3 +63,4 @@ class StackFeature:
   ACCUMULO_KERBEROS_USER_AUTH = "accumulo_kerberos_user_auth"
   KNOX_VERSIONED_DATA_DIR = "knox_versioned_data_dir"
   KNOX_SSO_TOPOLOGY = "knox_sso_topology"
+  ATLAS_ROLLING_UPGRADE = "atlas_rolling_upgrade"

+ 5 - 0
ambari-common/src/main/python/resource_management/libraries/functions/stack_features.py

@@ -148,6 +148,11 @@ _DEFAULT_STACK_FEATURES = {
       "name": "knox_sso_topology",
       "description": "Knox SSO Topology support (AMBARI-13975)",
       "min_version": "2.3.8.0"
+    },
+    {
+      "name": "atlas_rolling_upgrade",
+      "description": "Rolling upgrade support for Atlas",
+      "min_version": "2.3.0.0"
     }
   ]
 }

+ 8 - 2
ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/atlas_client.py

@@ -22,6 +22,8 @@ import sys
 from resource_management import *
 from resource_management.libraries.functions import conf_select
 from resource_management.libraries.functions import stack_select
+from resource_management.libraries.functions.stack_features import check_stack_feature
+from resource_management.libraries.functions import StackFeature
 
 from metadata import metadata
 
@@ -29,7 +31,8 @@ from metadata import metadata
 class AtlasClient(Script):
 
   def get_stack_to_component(self):
-    return {"HDP": "atlas-client"}
+    import params
+    return {params.stack_name: "atlas-client"}
 
   # ToDo: currently <stack-selector-tool> doesn't contain atlas-client, uncomment this block when
   # ToDo: atlas-client will be available
@@ -37,8 +40,11 @@ class AtlasClient(Script):
   #   import params
   #   env.set_params(params)
   #
-  #   if params.version and compare_versions(format_stack_version(params.version), '2.3.0.0') >= 0:
+  # TODO: Add ATLAS_CONFIG_VERSIONING stack feature and uncomment this code when config versioning for Atlas is supported
+  #   if params.version and check_stack_feature(StackFeature.ATLAS_CONFIG_VERSIONING, params.version):
   #     conf_select.select(params.stack_name, "atlas", params.version)
+  # TODO: Add ATLAS_CLIENT_ROLLING_UPGRADE stack feature and uncomment this code when rolling upgrade for Atlas client is supported
+  #   if params.version and check_stack_feature(StackFeature.ATLAS_CLIENT_ROLLING_UPGRADE, params.version):
   #     stack_select.select("atlas-client", params.version)
 
   def install(self, env):

+ 9 - 4
ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata_server.py

@@ -21,16 +21,18 @@ from resource_management.libraries.functions import conf_select
 from resource_management.libraries.functions import stack_select
 from resource_management import Execute, File, check_process_status, Script
 from resource_management.libraries.functions import format
-from resource_management.libraries.functions.version import compare_versions, format_stack_version
 from resource_management.libraries.functions.security_commons import build_expectations, \
   get_params_from_filesystem, validate_security_config_properties, \
   FILE_TYPE_PROPERTIES
 from resource_management.libraries.functions.show_logs import show_logs
+from resource_management.libraries.functions.stack_features import check_stack_feature
+from resource_management.libraries.functions import StackFeature
 
 class MetadataServer(Script):
 
   def get_stack_to_component(self):
-    return {"HDP": "atlas-server"}
+    import params
+    return {params.stack_name: "atlas-server"}
 
   def install(self, env):
     self.install_packages(env)
@@ -44,8 +46,11 @@ class MetadataServer(Script):
     import params
     env.set_params(params)
 
-    if params.version and compare_versions(format_stack_version(params.version), '2.3.0.0') >= 0:
-      # conf_select.select(params.stack_name, "atlas", params.version)
+    # TODO: Add ATLAS_CONFIG_VERSIONING stack feature and uncomment this code when config versioning for Atlas is supported
+    #if params.version and check_stack_feature(StackFeature.ATLAS_CONFIG_VERSIONING, params.version):
+    #  conf_select.select(params.stack_name, "atlas", params.version)
+
+    if params.version and check_stack_feature(StackFeature.ATLAS_ROLLING_UPGRADE, params.version):
       stack_select.select("atlas-server", params.version)
 
   def start(self, env, upgrade_type=None):

+ 3 - 2
ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py

@@ -27,6 +27,7 @@ import status_params
 
 # server configurations
 config = Script.get_config()
+stack_root = Script.get_stack_root()
 
 cluster_name = config['clusterName']
 
@@ -44,11 +45,11 @@ stack_name = default("/hostLevelParams/stack_name", None)
 # New Cluster Stack Version that is defined during the RESTART of a Stack Upgrade
 version = default("/commandParams/version", None)
 
-# hdp version
+# stack version
 stack_version_unformatted = config['hostLevelParams']['stack_version']
 stack_version_formatted = format_stack_version(stack_version_unformatted)
 
-metadata_home = os.environ['METADATA_HOME_DIR'] if 'METADATA_HOME_DIR' in os.environ else '/usr/hdp/current/atlas-server'
+metadata_home = os.environ['METADATA_HOME_DIR'] if 'METADATA_HOME_DIR' in os.environ else format('{stack_root}/current/atlas-server')
 metadata_bin = format("{metadata_home}/bin")
 
 python_binary = os.environ['PYTHON_EXE'] if 'PYTHON_EXE' in os.environ else sys.executable

+ 5 - 0
ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json

@@ -122,6 +122,11 @@
       "name": "knox_sso_topology",
       "description": "Knox SSO Topology support (AMBARI-13975)",
       "min_version": "2.3.8.0"
+    },
+    {
+      "name": "atlas_rolling_upgrade",
+      "description": "Rolling upgrade support for Atlas",
+      "min_version": "2.3.0.0"
     }
   ]
 }