ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smoha...@apache.org
Subject ambari git commit: AMBARI-19721. Use llapstatus command watch mode from HDP 2.6 onwards (Swapan Shridhar via smohanty)
Date Thu, 26 Jan 2017 03:49:39 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 be21bf95b -> 924d117a5


AMBARI-19721. Use llapstatus command watch mode from HDP 2.6 onwards (Swapan Shridhar via
smohanty)


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

Branch: refs/heads/branch-2.5
Commit: 924d117a5e67663d84f016555dd97e0a73bec5c2
Parents: be21bf9
Author: Sumit Mohanty <smohanty@hortonworks.com>
Authored: Wed Jan 25 19:49:21 2017 -0800
Committer: Sumit Mohanty <smohanty@hortonworks.com>
Committed: Wed Jan 25 19:49:21 2017 -0800

----------------------------------------------------------------------
 .../package/scripts/hive_server_interactive.py  | 179 ++++++----
 .../HIVE/configuration/hive-interactive-env.xml |  13 +
 .../stacks/2.5/HIVE/test_hive_server_int.py     | 343 ++++++++++++++++---
 3 files changed, 415 insertions(+), 120 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/924d117a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py
index acfddc2..5c56823 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py
@@ -254,6 +254,7 @@ class HiveServerInteractiveDefault(HiveServerInteractive):
     """
     def _llap_start(self, env, cleanup=False):
       import params
+      Logger.info("Entered _llap_start()")
       env.set_params(params)
 
       if params.hive_server_interactive_ha:
@@ -261,7 +262,11 @@ class HiveServerInteractiveDefault(HiveServerInteractive):
         Check llap app state
         """
         Logger.info("HSI HA is enabled. Checking if LLAP is already running ...")
-        status = self.check_llap_app_status(params.llap_app_name, 2, params.hive_server_interactive_ha)
+        if params.stack_supports_hive_interactive_ga:
+          status = self.check_llap_app_status_in_llap_ga(params.llap_app_name, 2, params.hive_server_interactive_ha)
+        else:
+          status = self.check_llap_app_status_in_llap_tp(params.llap_app_name, 2, params.hive_server_interactive_ha)
+
         if status:
           Logger.info("LLAP app '{0}' is already running.".format(params.llap_app_name))
           return True
@@ -348,7 +353,10 @@ class HiveServerInteractiveDefault(HiveServerInteractive):
 
         # 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.
-        status = self.check_llap_app_status(params.llap_app_name, params.num_retries_for_checking_llap_status)
+        if params.stack_supports_hive_interactive_ga:
+          status = self.check_llap_app_status_in_llap_ga(params.llap_app_name, params.num_retries_for_checking_llap_status)
+        else:
+          status = self.check_llap_app_status_in_llap_tp(params.llap_app_name, params.num_retries_for_checking_llap_status)
         if status:
           Logger.info("LLAP app '{0}' deployed successfully.".format(params.llap_app_name))
           return True
@@ -421,9 +429,9 @@ class HiveServerInteractiveDefault(HiveServerInteractive):
       Execute(llap_kinit_cmd, user=params.hive_user)
 
     """
-    Get llap app status data.
+    Get llap app status data for LLAP Tech Preview code base.
     """
-    def _get_llap_app_status_info(self, app_name):
+    def _get_llap_app_status_info_in_llap_tp(self, app_name):
       import status_params
       LLAP_APP_STATUS_CMD_TIMEOUT = 0
 
@@ -433,6 +441,29 @@ class HiveServerInteractiveDefault(HiveServerInteractive):
       Logger.info("Received 'llapstatus' command 'output' : {0}".format(output))
       return self._make_valid_json(output)
 
+    """
+    Get llap app status data for LLAP GA code base.
+
+    Parameters: 'percent_desired_instances_to_be_up' : A value b/w 0.0 and 1.0.
+                'total_timeout' : Total wait time while checking the status via llapstatus
command
+                'refresh_rate' : Frequency of polling for llapstatus.
+    """
+    def _get_llap_app_status_info_in_llap_ga(self, percent_desired_instances_to_be_up, total_timeout,
refresh_rate):
+      import status_params
+
+      # llapstatus comamnd : llapstatus -w -r <percent containers to wait for to be Up>
-i <refresh_rate> -t <total timeout for this comand>
+      # -w : Watch mode waits until all LLAP daemons are running or subset of the nodes are
running (threshold can be specified via -r option) (Default wait until all nodes are running)
+      # -r : When watch mode is enabled (-w), wait until the specified threshold of nodes
are running (Default 1.0 which means 100% nodes are running)
+      # -i : Amount of time in seconds to wait until subsequent status checks in watch mode
(Default: 1sec)
+      # -t : Exit watch mode if the desired state is not attained until the specified timeout
(Default: 300sec)
+      #
+      #            example : llapstatus -w -r 0.8 -i 2 -t 150
+      llap_status_cmd = format("{stack_root}/current/hive-server2-hive2/bin/hive --service
llapstatus -w -r {percent_desired_instances_to_be_up} -i {refresh_rate} -t {total_timeout}")
+      code, output, error = shell.checked_call(llap_status_cmd, user=status_params.hive_user,
stderr=subprocess.PIPE,
+                                               logoutput=False)
+      Logger.info("Received 'llapstatus' command 'output' : {0}".format(output))
+      return self._make_valid_json(output)
+
 
     """
     Remove extra lines from 'llapstatus' status output (eg: because of MOTD logging) so as
to have a valid JSON data to be passed in
@@ -520,73 +551,21 @@ class HiveServerInteractiveDefault(HiveServerInteractive):
     Parameters: llap_app_name : deployed llap app name.
                 num_retries :   Number of retries to check the LLAP app status.
     """
-    def check_llap_app_status(self, llap_app_name, num_retries, return_immediately_if_stopped=False):
-      # counters based on various states.
+    def check_llap_app_status_in_llap_tp(self, llap_app_name, num_retries, return_immediately_if_stopped=False):
+      Logger.info("Entered check_llap_app_status_in_hdp_tp")
       curr_time = time.time()
-
+      num_retries = int(num_retries)
       if num_retries <= 0:
+        Logger.info("Read 'num_retries' as : {0}. Setting it to : {1}".format(num_retries,
2))
         num_retries = 2
       if num_retries > 20:
+        Logger.info("Read 'num_retries' as : {0}. Setting it to : {1}".format(num_retries,
20))
         num_retries = 20
+
       @retry(times=num_retries, sleep_time=2, err_class=Fail)
       def do_retries():
-        live_instances = 0
-        desired_instances = 0
-
-        percent_desired_instances_to_be_up = 80 # Used in 'RUNNING_PARTIAL' state.
-        llap_app_info = self._get_llap_app_status_info(llap_app_name)
-        if llap_app_info is None or 'state' not in llap_app_info:
-          Logger.error("Malformed JSON data received for LLAP app. Exiting ....")
-          return False
-
-        if return_immediately_if_stopped and (llap_app_info['state'].upper() in ('APP_NOT_FOUND',
'COMPLETE')):
-          return False
-
-        if llap_app_info['state'].upper() == 'RUNNING_ALL':
-          Logger.info(
-            "LLAP app '{0}' in '{1}' state.".format(llap_app_name, llap_app_info['state']))
-          return True
-        elif llap_app_info['state'].upper() == 'RUNNING_PARTIAL':
-          # Check how many instances were up.
-          if 'liveInstances' in llap_app_info and 'desiredInstances' in llap_app_info:
-            live_instances = llap_app_info['liveInstances']
-            desired_instances = llap_app_info['desiredInstances']
-          else:
-            Logger.info(
-              "LLAP app '{0}' is in '{1}' state, but 'instances' information not available
in JSON received. " \
-              "Exiting ....".format(llap_app_name, llap_app_info['state']))
-            Logger.info(llap_app_info)
-            return False
-          if desired_instances == 0:
-            Logger.info("LLAP app '{0}' desired instance are set to 0. Exiting ....".format(llap_app_name))
-            return False
-
-          percentInstancesUp = 0
-          if live_instances > 0:
-            percentInstancesUp = float(live_instances) / desired_instances * 100
-          if percentInstancesUp >= percent_desired_instances_to_be_up:
-            Logger.info("LLAP app '{0}' in '{1}' state. Live Instances : '{2}'  >= {3}%
of Desired Instances : " \
-                        "'{4}'.".format(llap_app_name, llap_app_info['state'],
-                                       llap_app_info['liveInstances'],
-                                       percent_desired_instances_to_be_up,
-                                       llap_app_info['desiredInstances']))
-            return True
-          else:
-            Logger.info("LLAP app '{0}' in '{1}' state. Live Instances : '{2}'. Desired Instances
: " \
-                        "'{3}' after {4} secs.".format(llap_app_name, llap_app_info['state'],
-                                                       llap_app_info['liveInstances'],
-                                                       llap_app_info['desiredInstances'],
-                                                       time.time() - curr_time))
-            raise Fail("App state is RUNNING_PARTIAL. Live Instances : '{0}', Desired Instance
: '{1}'".format(llap_app_info['liveInstances'],
-                                                                                        
                  llap_app_info['desiredInstances']))
-        elif llap_app_info['state'].upper() in ['APP_NOT_FOUND', 'LAUNCHING', 'COMPLETE']:
-          status_str = format("LLAP app '{0}' current state is {1}.".format(llap_app_name,
llap_app_info['state']))
-          Logger.info(status_str)
-          raise Fail(status_str)
-        else:  # Covers any unknown that we get.
-          Logger.info(
-            "LLAP app '{0}' current state is '{1}'. Expected : 'RUNNING'.".format(llap_app_name,
llap_app_info['state']))
-          return False
+        llap_app_info = self._get_llap_app_status_info_in_llap_tp(llap_app_name)
+        return self._verify_llap_app_status(llap_app_info, llap_app_name, return_immediately_if_stopped,
curr_time)
 
       try:
         status = do_retries()
@@ -597,6 +576,21 @@ class HiveServerInteractiveDefault(HiveServerInteractive):
         traceback.print_exc()
         return False
 
+    def check_llap_app_status_in_llap_ga(self, llap_app_name, num_retries, return_immediately_if_stopped=False):
+      Logger.info("Entered check_llap_app_status_in_llap_ga()")
+      curr_time = time.time()
+      total_timeout = int(num_retries) * 20; # Total wait time while checking the status
via llapstatus command
+      Logger.info("Calculated 'total_timeout' : {0} using config 'num_retries_for_checking_llap_status'
: {1}".format(total_timeout, num_retries))
+      refresh_rate = 2 # Frequency of checking the llapstatus
+      percent_desired_instances_to_be_up = 80 # Out of 100.
+      llap_app_info = self._get_llap_app_status_info_in_llap_ga(percent_desired_instances_to_be_up/100.0,
total_timeout, refresh_rate)
+
+      try:
+        return self._verify_llap_app_status(llap_app_info, llap_app_name, return_immediately_if_stopped,
curr_time)
+      except Exception as e:
+        Logger.info(e.message)
+        return False
+
     def get_log_folder(self):
       import params
       return params.hive_log_dir
@@ -605,6 +599,63 @@ class HiveServerInteractiveDefault(HiveServerInteractive):
       import params
       return params.hive_user
 
+    def _verify_llap_app_status(self, llap_app_info, llap_app_name, return_immediately_if_stopped,
curr_time):
+      if llap_app_info is None or 'state' not in llap_app_info:
+        Logger.error("Malformed JSON data received for LLAP app. Exiting ....")
+        return False
+
+      # counters based on various states.
+      live_instances = 0
+      desired_instances = 0
+      percent_desired_instances_to_be_up = 80 # Used in 'RUNNING_PARTIAL' state.
+      if return_immediately_if_stopped and (llap_app_info['state'].upper() in ('APP_NOT_FOUND',
'COMPLETE')):
+        return False
+      if llap_app_info['state'].upper() == 'RUNNING_ALL':
+        Logger.info(
+          "LLAP app '{0}' in '{1}' state.".format(llap_app_name, llap_app_info['state']))
+        return True
+      elif llap_app_info['state'].upper() == 'RUNNING_PARTIAL':
+        # Check how many instances were up.
+        if 'liveInstances' in llap_app_info and 'desiredInstances' in llap_app_info:
+          live_instances = llap_app_info['liveInstances']
+          desired_instances = llap_app_info['desiredInstances']
+        else:
+          Logger.info(
+            "LLAP app '{0}' is in '{1}' state, but 'instances' information not available
in JSON received. " \
+            "Exiting ....".format(llap_app_name, llap_app_info['state']))
+          Logger.info(llap_app_info)
+          return False
+        if desired_instances == 0:
+          Logger.info("LLAP app '{0}' desired instance are set to 0. Exiting ....".format(llap_app_name))
+          return False
+
+        percentInstancesUp = 0
+        if live_instances > 0:
+          percentInstancesUp = float(live_instances) / desired_instances * 100
+        if percentInstancesUp >= percent_desired_instances_to_be_up:
+          Logger.info("LLAP app '{0}' in '{1}' state. Live Instances : '{2}'  >= {3}%
of Desired Instances : " \
+                      "'{4}'.".format(llap_app_name, llap_app_info['state'],
+                                      llap_app_info['liveInstances'],
+                                      percent_desired_instances_to_be_up,
+                                      llap_app_info['desiredInstances']))
+          return True
+        else:
+          Logger.info("LLAP app '{0}' in '{1}' state. Live Instances : '{2}'. Desired Instances
: " \
+                      "'{3}' after {4} secs.".format(llap_app_name, llap_app_info['state'],
+                                                     llap_app_info['liveInstances'],
+                                                     llap_app_info['desiredInstances'],
+                                                     time.time() - curr_time))
+          raise Fail("App state is RUNNING_PARTIAL. Live Instances : '{0}', Desired Instance
: '{1}'".format(llap_app_info['liveInstances'],
+                                                                                        
                  llap_app_info['desiredInstances']))
+      elif llap_app_info['state'].upper() in ['APP_NOT_FOUND', 'LAUNCHING', 'COMPLETE']:
+        status_str = format("LLAP app '{0}' current state is {1}.".format(llap_app_name,
llap_app_info['state']))
+        Logger.info(status_str)
+        raise Fail(status_str)
+      else:  # Covers any unknown that we get.
+        Logger.info(
+          "LLAP app '{0}' current state is '{1}'. Expected : 'RUNNING'.".format(llap_app_name,
llap_app_info['state']))
+        return False
+
 @OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
 class HiveServerInteractiveWindows(HiveServerInteractive):
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/924d117a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/configuration/hive-interactive-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/configuration/hive-interactive-env.xml
b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/configuration/hive-interactive-env.xml
index 0c9ce62..787dcb1 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/configuration/hive-interactive-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/configuration/hive-interactive-env.xml
@@ -49,6 +49,19 @@
     <display-name>LLAP app java opts</display-name>
     <on-ambari-upgrade add="false"/>
   </property>
+  <property>
+    <name>num_retries_for_checking_llap_status</name>
+    <value>15</value>
+    <description>After starting LLAP app, retry count to check LLAP status before starting
HiveServer2.</description>
+    <display-name>Number of retries while checking LLAP app status</display-name>
+    <value-attributes>
+      <type>int</type>
+      <minimum>1</minimum>
+      <maximum>20</maximum>
+      <increment-step>1</increment-step>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
 
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/924d117a/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py b/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
index 9de0378..2bc28e5 100644
--- a/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
+++ b/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
@@ -894,42 +894,42 @@ class TestHiveServerInteractive(RMFTestCase):
 
 
 
-  # Tests for fn : 'check_llap_app_status()'
+  # Tests for fn : 'check_llap_app_status_in_hdp_tp()'
 
 
   # Status : RUNNING
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_running_all_wait_negative(self, mock_get_llap_app_status_data,
sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_running_all_wait_negative_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('running.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, -1)
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, -1)
     self.assertEqual(status, True)
 
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_running_all_wait_0(self, mock_get_llap_app_status_data,
sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_running_all_wait_0_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('running.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, 0)
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, 0)
     self.assertEqual(status, True)
 
 
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_running_all_wait_2(self, mock_get_llap_app_status_data,
sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_running_all_wait_2_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('running.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, 2)
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, 2)
     self.assertEqual(status, True)
 
 
@@ -937,36 +937,36 @@ class TestHiveServerInteractive(RMFTestCase):
 
   # Status : RUNNING_PARTIAL (2 out of 3 running -> < 80% instances ON)
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_one_container_down_wait_negative(self, mock_get_llap_app_status_data,
sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_one_container_down_wait_negative_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('oneContainerDown.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, -1)
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, -1)
     self.assertEqual(status, False)
 
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_one_container_down_wait_0(self, mock_get_llap_app_status_data,
sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_one_container_down_wait_0_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('oneContainerDown.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, 0)
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, 0)
     self.assertEqual(status, False)
 
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_one_container_down_wait_2(self, mock_get_llap_app_status_data,
sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_one_container_down_wait_2_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('oneContainerDown.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, 2)
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, 2)
     self.assertEqual(status, False)
 
 
@@ -974,37 +974,37 @@ class TestHiveServerInteractive(RMFTestCase):
 
   # Status : RUNNING_PARTIAL (4 out of 5 running -> > 80% instances ON)
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_two_container_down_1_wait_negative(self, mock_get_llap_app_status_data,
sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_two_container_down_1_wait_negative_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('oneContainerDown1.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, -1)
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, -1)
     self.assertEqual(status, True)
 
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_two_container_down_1_wait_0(self, mock_get_llap_app_status_data,
sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_two_container_down_1_wait_0_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('oneContainerDown1.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, 0)
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, 0)
     self.assertEqual(status, True)
 
 
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_two_container_down_1_wait_2(self, mock_get_llap_app_status_data,
sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_two_container_down_1_wait_2_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('oneContainerDown1.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, 2)
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, 2)
     self.assertEqual(status, True)
 
 
@@ -1012,36 +1012,36 @@ class TestHiveServerInteractive(RMFTestCase):
 
   # Status : LAUNCHING
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_starting_wait_negative(self, mock_get_llap_app_status_data,
sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_starting_wait_negative_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('starting.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, -1)
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, -1)
     self.assertEqual(status, False)
 
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_starting_wait_0(self, mock_get_llap_app_status_data, sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_starting_wait_0_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('starting.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, 0)
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, 0)
     self.assertEqual(status, False)
 
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_starting_wait_2(self, mock_get_llap_app_status_data, sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_starting_wait_2_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('starting.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, 2)
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, 2)
     self.assertEqual(status, False)
 
 
@@ -1050,36 +1050,36 @@ class TestHiveServerInteractive(RMFTestCase):
 
   # Status : COMPLETE
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_complete_wait_negative(self, mock_get_llap_app_status_data,
sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_complete_wait_negative_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('appComplete.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, -1)
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, -1)
     self.assertEqual(status, False)
 
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_complete_wait_0(self, mock_get_llap_app_status_data, sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_complete_wait_0_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('appComplete.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, 0)
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, 0)
     self.assertEqual(status, False)
 
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_complete_wait_2(self, mock_get_llap_app_status_data, sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_complete_wait_2_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('appComplete.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, 2)
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, 2)
     self.assertEqual(status, False)
 
 
@@ -1087,36 +1087,267 @@ class TestHiveServerInteractive(RMFTestCase):
 
   # Status : APP_NOT_FOUND
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_invalid_wait_negative(self, mock_get_llap_app_status_data,
sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_invalid_wait_negative_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('invalidApp.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, -1)
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, -1)
     self.assertEqual(status, False)
 
 
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_invalid_wait_0(self, mock_get_llap_app_status_data, sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_invalid_wait_0_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('invalidApp.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, 0)
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, 0)
     self.assertEqual(status, False)
 
 
   @patch("time.sleep")
-  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info')
-  def test_check_llap_app_status_invalid_wait_2(self, mock_get_llap_app_status_data, sleep_mock):
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_tp')
+  def test_check_llap_app_status_invalid_wait_2_in_llap_tp(self, mock_get_llap_app_status_data,
sleep_mock):
     sleep_mock.return_value = 1
 
     llap_app_json = self.load_json('invalidApp.json')
     mock_get_llap_app_status_data.return_value = llap_app_json
 
-    status = self.hsi.check_llap_app_status(self.llap_app_name, 2)
-    self.assertEqual(status, False)
\ No newline at end of file
+    status = self.hsi.check_llap_app_status_in_llap_tp(self.llap_app_name, 2)
+    self.assertEqual(status, False)
+
+
+
+
+
+  # Tests for fn : 'check_llap_app_status_in_llap_ga()'
+
+
+  # Status : RUNNING
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_running_all_wait_negative_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('running.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, -1)
+    self.assertEqual(status, True)
+
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_running_all_wait_0_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('running.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, 0)
+    self.assertEqual(status, True)
+
+
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_running_all_wait_2_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('running.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, 2)
+    self.assertEqual(status, True)
+
+
+
+
+  # Status : RUNNING_PARTIAL (2 out of 3 running -> < 80% instances ON)
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_one_container_down_wait_negative_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('oneContainerDown.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, -1)
+    self.assertEqual(status, False)
+
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_one_container_down_wait_0_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('oneContainerDown.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, 0)
+    self.assertEqual(status, False)
+
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_one_container_down_wait_2_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('oneContainerDown.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, 2)
+    self.assertEqual(status, False)
+
+
+
+
+  # Status : RUNNING_PARTIAL (4 out of 5 running -> > 80% instances ON)
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_two_container_down_1_wait_negative_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('oneContainerDown1.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, -1)
+    self.assertEqual(status, True)
+
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_two_container_down_1_wait_0_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('oneContainerDown1.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, 0)
+    self.assertEqual(status, True)
+
+
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_two_container_down_1_wait_2_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('oneContainerDown1.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, 2)
+    self.assertEqual(status, True)
+
+
+
+
+  # Status : LAUNCHING
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_starting_wait_negative_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('starting.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, -1)
+    self.assertEqual(status, False)
+
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_starting_wait_0_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('starting.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, 0)
+    self.assertEqual(status, False)
+
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_starting_wait_2_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('starting.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, 2)
+    self.assertEqual(status, False)
+
+
+
+
+
+  # Status : COMPLETE
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_complete_wait_negative_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('appComplete.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, -1)
+    self.assertEqual(status, False)
+
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_complete_wait_0_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('appComplete.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, 0)
+    self.assertEqual(status, False)
+
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_complete_wait_2_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('appComplete.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, 2)
+    self.assertEqual(status, False)
+
+
+
+
+  # Status : APP_NOT_FOUND
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_invalid_wait_negative_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('invalidApp.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, -1)
+    self.assertEqual(status, False)
+
+
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_invalid_wait_0_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('invalidApp.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, 0)
+    self.assertEqual(status, False)
+
+
+  @patch("time.sleep")
+  @patch('hive_server_interactive.HiveServerInteractiveDefault._get_llap_app_status_info_in_llap_ga')
+  def test_check_llap_app_status_invalid_wait_2_in_llap_ga(self, mock_get_llap_app_status_data,
sleep_mock):
+    sleep_mock.return_value = 1
+
+    llap_app_json = self.load_json('invalidApp.json')
+    mock_get_llap_app_status_data.return_value = llap_app_json
+
+    status = self.hsi.check_llap_app_status_in_llap_ga(self.llap_app_name, 2)
+    self.assertEqual(status, False)


Mime
View raw message