You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jl...@apache.org on 2016/03/31 22:55:51 UTC

ambari git commit: AMBARI-15579: Stack Featurize Falcon service (jluniya)

Repository: ambari
Updated Branches:
  refs/heads/trunk 490fa51f1 -> 4ecd3c762


AMBARI-15579: Stack Featurize Falcon service (jluniya)


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

Branch: refs/heads/trunk
Commit: 4ecd3c7620edcfa1ced4a25abd022c21f42960af
Parents: 490fa51
Author: Jayush Luniya <jl...@hortonworks.com>
Authored: Thu Mar 31 13:55:46 2016 -0700
Committer: Jayush Luniya <jl...@hortonworks.com>
Committed: Thu Mar 31 13:55:46 2016 -0700

----------------------------------------------------------------------
 .../0.5.0.2.1/package/scripts/falcon_client.py  |  9 ++++++---
 .../0.5.0.2.1/package/scripts/falcon_server.py  |  9 ++++++---
 .../0.5.0.2.1/package/scripts/params_linux.py   | 20 ++++++++++----------
 .../0.5.0.2.1/package/scripts/status_params.py  | 11 +++++++++--
 4 files changed, 31 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4ecd3c76/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_client.py b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_client.py
index 2894844..75b5de4 100644
--- a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_client.py
+++ b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_client.py
@@ -23,6 +23,8 @@ from resource_management.libraries.functions import stack_select
 from falcon import falcon
 from ambari_commons import OSConst
 from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
+from resource_management.libraries.functions.stack_features import check_stack_feature
+from resource_management.libraries.functions import StackFeature
 
 class FalconClient(Script):
   def configure(self, env):
@@ -36,7 +38,8 @@ class FalconClient(Script):
 @OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)
 class FalconClientLinux(FalconClient):
   def get_stack_to_component(self):
-    return {"HDP": "falcon-client"}
+    import params
+    return {params.stack_name: "falcon-client"}
 
   def install(self, env):
     self.install_packages(env)
@@ -48,8 +51,8 @@ class FalconClientLinux(FalconClient):
     env.set_params(params)
 
     # this function should not execute if the version can't be determined or
-    # is not at least HDP 2.2.0.0
-    if not params.version or compare_versions(format_stack_version(params.version), '2.2.0.0') < 0:
+    # the stack does not support rolling upgrade
+    if not (params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version)):
       return
 
     Logger.info("Executing Falcon Client Stack Upgrade pre-restart")

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ecd3c76/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_server.py b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_server.py
index ccc1c9d..86bf3b6 100644
--- a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_server.py
+++ b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_server.py
@@ -33,6 +33,8 @@ from resource_management.libraries.functions.security_commons import FILE_TYPE_P
 from falcon import falcon
 from ambari_commons import OSConst
 from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
+from resource_management.libraries.functions.stack_features import check_stack_feature
+from resource_management.libraries.functions import StackFeature
 
 class FalconServer(Script):
   def configure(self, env, upgrade_type=None):
@@ -58,7 +60,8 @@ class FalconServer(Script):
 @OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)
 class FalconServerLinux(FalconServer):
   def get_stack_to_component(self):
-    return {"HDP": "falcon-server"}
+    import params
+    return {params.stack_name: "falcon-server"}
 
   def install(self, env):
     import params
@@ -76,8 +79,8 @@ class FalconServerLinux(FalconServer):
     env.set_params(params)
 
     # this function should not execute if the version can't be determined or
-    # is not at least HDP 2.2.0.0
-    if Script.is_stack_less_than("2.2"):
+    # the stack does not support rolling upgrade
+    if not (params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version)):
       return
 
     Logger.info("Executing Falcon Server Stack Upgrade pre-restart")

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ecd3c76/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/params_linux.py
index 9a0e170..84d8b57 100644
--- a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/params_linux.py
@@ -21,30 +21,30 @@ import status_params
 from resource_management.libraries.resources.hdfs_resource import HdfsResource
 from resource_management.libraries.functions import stack_select
 from resource_management.libraries.functions import format
-from resource_management.libraries.functions.version import format_stack_version
 from resource_management.libraries.functions.default import default
 from resource_management.libraries.functions.get_not_managed_resources import get_not_managed_resources
 from resource_management.libraries.functions import get_kinit_path
 from resource_management.libraries.script.script import Script
 import os
+from resource_management.libraries.functions.stack_features import check_stack_feature
+from resource_management.libraries.functions import StackFeature
 
 config = Script.get_config()
-
+stack_root = status_params.stack_root
 stack_name = default("/hostLevelParams/stack_name", None)
 
 # New Cluster Stack Version that is defined during the RESTART of a Rolling Upgrade
 version = default("/commandParams/version", None)
 
-stack_version_unformatted = config['hostLevelParams']['stack_version']
-stack_version_formatted = format_stack_version(stack_version_unformatted)
+stack_version_unformatted = status_params.stack_version_unformatted
+stack_version_formatted = status_params.stack_version_formatted
 etc_prefix_dir = "/etc/falcon"
 
 # hadoop params
 hadoop_home_dir = stack_select.get_hadoop_dir("home")
 hadoop_bin_dir = stack_select.get_hadoop_dir("bin")
 
-if Script.is_stack_greater_or_equal("2.2"):
-
+if stack_version_formatted and check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_formatted):
   # if this is a server action, then use the server binaries; smoke tests
   # use the client binaries
   server_role_dir_mapping = { 'FALCON_SERVER' : 'falcon-server',
@@ -55,8 +55,8 @@ if Script.is_stack_greater_or_equal("2.2"):
     command_role = 'FALCON_SERVICE_CHECK'
 
   falcon_root = server_role_dir_mapping[command_role]
-  falcon_webapp_dir = format('/usr/hdp/current/{falcon_root}/webapp')
-  falcon_home = format('/usr/hdp/current/{falcon_root}')
+  falcon_webapp_dir = format('{stack_root}/current/{falcon_root}/webapp')
+  falcon_home = format('{stack_root}/current/{falcon_root}')
 else:
   falcon_webapp_dir = '/var/lib/falcon/webapp'
   falcon_home = '/usr/lib/falcon'
@@ -107,7 +107,7 @@ smokeuser_principal =  config['configurations']['cluster-env']['smokeuser_princi
 kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
 
 supports_hive_dr = config['configurations']['falcon-env']['supports_hive_dr']
-local_data_mirroring_dir = "/usr/hdp/current/falcon-server/data-mirroring"
+local_data_mirroring_dir = format('{stack_root}/current/falcon-server/data-mirroring')
 dfs_data_mirroring_dir = "/apps/data-mirroring"
 
 atlas_hosts = default('/clusterHostInfo/atlas_server_hosts', [])
@@ -116,7 +116,7 @@ has_atlas = len(atlas_hosts) > 0
 if has_atlas:
   atlas_conf_file = config['configurations']['atlas-env']['metadata_conf_file']
   atlas_conf_dir = os.environ['METADATA_CONF'] if 'METADATA_CONF' in os.environ else '/etc/atlas/conf'
-  atlas_home_dir = os.environ['METADATA_HOME_DIR'] if 'METADATA_HOME_DIR' in os.environ else '/usr/hdp/current/atlas-server'
+  atlas_home_dir = os.environ['METADATA_HOME_DIR'] if 'METADATA_HOME_DIR' in os.environ else format('{stack_root}/current/atlas-server')
 
   application_services = "org.apache.falcon.security.AuthenticationInitializationService,\
       org.apache.falcon.workflow.WorkflowJobEndNotificationService, \

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ecd3c76/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/status_params.py b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/status_params.py
index 712a141..33f1c7e 100644
--- a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/status_params.py
+++ b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/status_params.py
@@ -23,6 +23,9 @@ from resource_management.libraries.functions import format
 from resource_management.libraries.functions.default import default
 from resource_management.libraries.functions import get_kinit_path
 from resource_management.libraries.script.script import Script
+from resource_management.libraries.functions.version import format_stack_version
+from resource_management.libraries.functions.stack_features import check_stack_feature
+from resource_management.libraries.functions import StackFeature
 
 # a map of the Ambari role to the component name
 # for use with <stack-root>/current/<component>
@@ -34,6 +37,10 @@ SERVER_ROLE_DIRECTORY_MAP = {
 component_directory = Script.get_component_from_role(SERVER_ROLE_DIRECTORY_MAP, "FALCON_CLIENT")
 
 config = Script.get_config()
+stack_root = Script.get_stack_root()
+
+stack_version_unformatted = config['hostLevelParams']['stack_version']
+stack_version_formatted = format_stack_version(stack_version_unformatted)
 
 if OSCheck.is_windows_family():
   falcon_win_service_name = "falcon"
@@ -46,8 +53,8 @@ else:
   hadoop_conf_dir = conf_select.get_hadoop_conf_dir()
 
   falcon_conf_dir = "/etc/falcon/conf"
-  if Script.is_stack_greater_or_equal("2.2"):
-    falcon_conf_dir = format("/usr/hdp/current/{component_directory}/conf")
+  if stack_version_formatted and check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_formatted):
+    falcon_conf_dir = format("{stack_root}/current/{component_directory}/conf")
 
   # Security related/required params
   hostname = config['hostname']