Преглед на файлове

AMBARI-19639. Remove the hardcoding for LLAP app name and read it from config 'llap_app_name'.

Swapan Shridhar преди 8 години
родител
ревизия
ccd10f6753

+ 12 - 15
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py

@@ -228,20 +228,19 @@ class HiveServerInteractiveDefault(HiveServerInteractive):
     def _llap_stop(self, env):
     def _llap_stop(self, env):
       import params
       import params
       Logger.info("Stopping LLAP")
       Logger.info("Stopping LLAP")
-      SLIDER_APP_NAME = "llap0"
 
 
-      stop_cmd = ["slider", "stop", SLIDER_APP_NAME]
+      stop_cmd = ["slider", "stop", params.llap_app_name]
 
 
       code, output, error = shell.call(stop_cmd, user=params.hive_user, stderr=subprocess.PIPE, logoutput=True)
       code, output, error = shell.call(stop_cmd, user=params.hive_user, stderr=subprocess.PIPE, logoutput=True)
       if code == 0:
       if code == 0:
-        Logger.info(format("Stopped {SLIDER_APP_NAME} application on Slider successfully"))
+        Logger.info(format("Stopped {params.llap_app_name} application on Slider successfully"))
       elif code == 69 and output is not None and "Unknown application instance" in output:
       elif code == 69 and output is not None and "Unknown application instance" in output:
-        Logger.info(format("Application {SLIDER_APP_NAME} was already stopped on Slider"))
+        Logger.info(format("Application {params.llap_app_name} was already stopped on Slider"))
       else:
       else:
-        raise Fail(format("Could not stop application {SLIDER_APP_NAME} on Slider. {error}\n{output}"))
+        raise Fail(format("Could not stop application {params.llap_app_name} on Slider. {error}\n{output}"))
 
 
       # Will exit with code 4 if need to run with "--force" to delete directories and registries.
       # Will exit with code 4 if need to run with "--force" to delete directories and registries.
-      Execute(('slider', 'destroy', SLIDER_APP_NAME, "--force"),
+      Execute(('slider', 'destroy', params.llap_app_name, "--force"),
               user=params.hive_user,
               user=params.hive_user,
               timeout=30,
               timeout=30,
               ignore_failures=True,
               ignore_failures=True,
@@ -254,19 +253,17 @@ class HiveServerInteractiveDefault(HiveServerInteractive):
       import params
       import params
       env.set_params(params)
       env.set_params(params)
 
 
-      LLAP_APP_NAME = 'llap0'
-
       if params.hive_server_interactive_ha:
       if params.hive_server_interactive_ha:
         """
         """
         Check llap app state
         Check llap app state
         """
         """
         Logger.info("HSI HA is enabled. Checking if LLAP is already running ...")
         Logger.info("HSI HA is enabled. Checking if LLAP is already running ...")
-        status = self.check_llap_app_status(LLAP_APP_NAME, 2, params.hive_server_interactive_ha)
+        status = self.check_llap_app_status(params.llap_app_name, 2, params.hive_server_interactive_ha)
         if status:
         if status:
-          Logger.info("LLAP app '{0}' is already running.".format(LLAP_APP_NAME))
+          Logger.info("LLAP app '{0}' is already running.".format(params.llap_app_name))
           return True
           return True
         else:
         else:
-          Logger.info("LLAP app '{0}' is not running. llap will be started.".format(LLAP_APP_NAME))
+          Logger.info("LLAP app '{0}' is not running. llap will be started.".format(params.llap_app_name))
         pass
         pass
 
 
       # Call for cleaning up the earlier run(s) LLAP package folders.
       # Call for cleaning up the earlier run(s) LLAP package folders.
@@ -335,16 +332,16 @@ class HiveServerInteractiveDefault(HiveServerInteractive):
 
 
         Logger.info(format("Run file path: {run_file_path}"))
         Logger.info(format("Run file path: {run_file_path}"))
         Execute(run_file_path, user=params.hive_user, logoutput=True)
         Execute(run_file_path, user=params.hive_user, logoutput=True)
-        Logger.info("Submitted LLAP app name : {0}".format(LLAP_APP_NAME))
+        Logger.info("Submitted LLAP app name : {0}".format(params.llap_app_name))
 
 
         # We need to check the status of LLAP app to figure out it got
         # We need to check the status of LLAP app to figure out it got
         # launched properly and is in running state. Then go ahead with Hive Interactive Server start.
         # launched properly and is in running state. Then go ahead with Hive Interactive Server start.
-        status = self.check_llap_app_status(LLAP_APP_NAME, params.num_retries_for_checking_llap_status)
+        status = self.check_llap_app_status(params.llap_app_name, params.num_retries_for_checking_llap_status)
         if status:
         if status:
-          Logger.info("LLAP app '{0}' deployed successfully.".format(LLAP_APP_NAME))
+          Logger.info("LLAP app '{0}' deployed successfully.".format(params.llap_app_name))
           return True
           return True
         else:
         else:
-          Logger.error("LLAP app '{0}' deployment unsuccessful.".format(LLAP_APP_NAME))
+          Logger.error("LLAP app '{0}' deployment unsuccessful.".format(params.llap_app_name))
           return False
           return False
       except:
       except:
         # Attempt to clean up the packaged application, or potentially rename it with a .bak
         # Attempt to clean up the packaged application, or potentially rename it with a .bak

+ 1 - 0
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py

@@ -609,6 +609,7 @@ if has_hive_interactive:
   hive_interactive_enabled = default('/configurations/hive-interactive-env/enable_hive_interactive', False)
   hive_interactive_enabled = default('/configurations/hive-interactive-env/enable_hive_interactive', False)
   llap_app_java_opts = default('/configurations/hive-interactive-env/llap_java_opts', '-XX:+AlwaysPreTouch {% if java_version > 7 %}-XX:+UseG1GC -XX:TLABSize=8m -XX:+ResizeTLAB -XX:+UseNUMA -XX:+AggressiveOpts -XX:MetaspaceSize=1024m -XX:InitiatingHeapOccupancyPercent=80 -XX:MaxGCPauseMillis=200{% else %}-XX:+PrintGCDetails -verbose:gc -XX:+PrintGCTimeStamps -XX:+UseNUMA -XX:+UseParallelGC{% endif %}')
   llap_app_java_opts = default('/configurations/hive-interactive-env/llap_java_opts', '-XX:+AlwaysPreTouch {% if java_version > 7 %}-XX:+UseG1GC -XX:TLABSize=8m -XX:+ResizeTLAB -XX:+UseNUMA -XX:+AggressiveOpts -XX:MetaspaceSize=1024m -XX:InitiatingHeapOccupancyPercent=80 -XX:MaxGCPauseMillis=200{% else %}-XX:+PrintGCDetails -verbose:gc -XX:+PrintGCTimeStamps -XX:+UseNUMA -XX:+UseParallelGC{% endif %}')
   hive_interactive_heapsize = hive_heapsize
   hive_interactive_heapsize = hive_heapsize
+  llap_app_name = config['configurations']['hive-interactive-env']['llap_app_name']
   # Ambari upgrade may not add this config as it will force restart of HSI (stack upgrade should)
   # Ambari upgrade may not add this config as it will force restart of HSI (stack upgrade should)
   if 'hive_heapsize' in config['configurations']['hive-interactive-env']:
   if 'hive_heapsize' in config['configurations']['hive-interactive-env']:
     hive_interactive_heapsize = config['configurations']['hive-interactive-env']['hive_heapsize']
     hive_interactive_heapsize = config['configurations']['hive-interactive-env']['hive_heapsize']

+ 2 - 1
ambari-server/src/test/python/stacks/2.5/configs/hsi_default.json

@@ -421,7 +421,8 @@
             "num_llap_nodes" : "1",
             "num_llap_nodes" : "1",
             "num_retries_for_checking_llap_status" : 2,
             "num_retries_for_checking_llap_status" : 2,
             "llap_heap_size":"280",
             "llap_heap_size":"280",
-            "llap_log_level":"INFO"
+            "llap_log_level":"INFO",
+            "llap_app_name":"llap0"
         },
         },
         "hive-interactive-site": {
         "hive-interactive-site": {
             "hive.enforce.sorting": "true",
             "hive.enforce.sorting": "true",

+ 2 - 1
ambari-server/src/test/python/stacks/2.5/configs/hsi_ha.json

@@ -420,7 +420,8 @@
             "num_llap_nodes" : "1",
             "num_llap_nodes" : "1",
             "num_retries_for_checking_llap_status" : 2,
             "num_retries_for_checking_llap_status" : 2,
             "llap_heap_size":"280",
             "llap_heap_size":"280",
-            "llap_log_level":"INFO"
+            "llap_log_level":"INFO",
+            "llap_app_name":"llap0"
         },
         },
         "hive-interactive-site": {
         "hive-interactive-site": {
             "hive.enforce.sorting": "true",
             "hive.enforce.sorting": "true",