Repository: ambari
Updated Branches:
  refs/heads/trunk f635d05d5 -> 7acc90952


AMBARI-17825. Fix the empty value which may get passed back from 
'get_llap_cap_percent_slider' fn.


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

Branch: refs/heads/trunk
Commit: 7acc909522ae996fcf5124ad339bad6a17d44fc5
Parents: f635d05
Author: Swapan Shridhar <[email protected]>
Authored: Wed Jul 20 18:36:50 2016 -0700
Committer: Swapan Shridhar <[email protected]>
Committed: Wed Jul 20 23:57:44 2016 -0700

----------------------------------------------------------------------
 .../stacks/HDP/2.5/services/stack_advisor.py          | 14 ++++++++------
 .../python/stacks/2.5/common/test_stack_advisor.py    | 12 ++++++------
 2 files changed, 14 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7acc9095/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py 
b/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
index 315020b..5e380d8 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
@@ -947,15 +947,17 @@ class HDP25StackAdvisor(HDP24StackAdvisor):
   Returns the current LLAP queue capacity percentage value. 
(llap_queue_capacity)
   """
   def get_llap_cap_percent_slider(self, services, configurations):
+    llap_slider_cap_percentage = 0
     if 'llap_queue_capacity' in 
services['configurations']['hive-interactive-env']['properties']:
       llap_slider_cap_percentage = float(
         
services['configurations']['hive-interactive-env']['properties']['llap_queue_capacity'])
-      if llap_slider_cap_percentage <= 0 :
-        if 'hive-interactive-env' in configurations and \
-            'llap_queue_capacity' in 
configurations["hive-interactive-env"]["properties"]:
-          llap_slider_cap_percentage = 
configurations["hive-interactive-env"]["properties"]["llap_queue_capacity"]
-      assert (llap_slider_cap_percentage > 0), "'llap_queue_capacity' is set 
to 0."
-      return llap_slider_cap_percentage
+      Logger.error("'llap_queue_capacity' not present in 
services['configurations']['hive-interactive-env']['properties'].")
+    if llap_slider_cap_percentage <= 0 :
+      if 'hive-interactive-env' in configurations and \
+          'llap_queue_capacity' in 
configurations["hive-interactive-env"]["properties"]:
+        llap_slider_cap_percentage = 
float(configurations["hive-interactive-env"]["properties"]["llap_queue_capacity"])
+    assert (llap_slider_cap_percentage > 0), "'llap_queue_capacity' is set to 
: {0}. Should be > 0.".format(llap_slider_cap_percentage)
+    return llap_slider_cap_percentage
 
 
   """

http://git-wip-us.apache.org/repos/asf/ambari/blob/7acc9095/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py 
b/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
index 7c8a6e7..502d1a4 100644
--- a/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
@@ -5142,8 +5142,9 @@ class TestHDP25StackAdvisor(TestCase):
 
 
   # Test 28: (1). only 'default' queue exists at root level in 
capacity-scheduler, and
-  #          'capacity-scheduler' configs are passed-in as single "/n" 
separated string  and
+  #          'capacity-scheduler' configs are passed-in as single "/n" 
separated string,
   #          (2). configuration change detected for 'enable_hive_interactive'
+  #          (3). 'llap_queue_capacity' is passed in as 0, so that it can be 
read from configurations.
   #         Expected : Configurations values recommended for llap related 
configs.
   def 
test_recommendYARNConfigurations_five_node_manager_llap_configs_updated_4(self):
     # 3 node managers and yarn.nodemanager.resource.memory-mb": "204800"
@@ -5243,7 +5244,7 @@ class TestHDP25StackAdvisor(TestCase):
           {
             'properties': {
               'enable_hive_interactive': 'true',
-              'llap_queue_capacity':'50'
+              'llap_queue_capacity':'0' # Intentionally kept '0' so as to read 
it from configurations.
             }
           },
         "hive-interactive-site":
@@ -5295,17 +5296,16 @@ class TestHDP25StackAdvisor(TestCase):
     configurations = {
     }
 
-
     self.stackAdvisor.recommendYARNConfigurations(configurations, clusterData, 
services, self.hosts)
 
-    
self.assertEqual(configurations['hive-interactive-env']['properties']['num_llap_nodes'],
 '2')
+    
self.assertEqual(configurations['hive-interactive-env']['properties']['num_llap_nodes'],
 '1')
 
-    
self.assertEqual(configurations['hive-interactive-site']['properties']['hive.llap.daemon.yarn.container.mb'],
 '204800')
+    
self.assertEqual(configurations['hive-interactive-site']['properties']['hive.llap.daemon.yarn.container.mb'],
 '151552')
 
     
self.assertEqual(configurations['hive-interactive-site']['properties']['hive.llap.daemon.num.executors'],
 '3')
     
self.assertEqual(configurations['hive-interactive-site']['properties']['hive.llap.io.threadpool.size'],
 '3')
 
-    
self.assertEqual(configurations['hive-interactive-site']['properties']['hive.llap.io.memory.size'],
 '201728')
+    
self.assertEqual(configurations['hive-interactive-site']['properties']['hive.llap.io.memory.size'],
 '148480')
     
self.assertEqual(configurations['hive-interactive-site']['properties']['hive.llap.io.enabled'],
 'true')
 
     
self.assertEqual(configurations['hive-interactive-env']['properties']['llap_heap_size'],
 '2457')

Reply via email to