Repository: ambari Updated Branches: refs/heads/branch-2.1 3b4e83824 -> 516c4c312
AMBARI-11824 - Views: Tez View should automatically work out of the box in Ambari 2.1 (tbeerbower) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/516c4c31 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/516c4c31 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/516c4c31 Branch: refs/heads/branch-2.1 Commit: 516c4c312c264eb9d6ecf66cce61df57a51a7d43 Parents: 3b4e838 Author: tbeerbower <tbeerbo...@hortonworks.com> Authored: Thu Jun 18 20:10:57 2015 -0400 Committer: tbeerbower <tbeerbo...@hortonworks.com> Committed: Thu Jun 18 20:12:02 2015 -0400 ---------------------------------------------------------------------- .../stacks/HDP/2.3/services/stack_advisor.py | 18 ++++++++++++------ .../stacks/2.3/common/test_stack_advisor.py | 17 ++++++++++++++++- 2 files changed, 28 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/516c4c31/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py index b1f4fb0..4c14b83 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py @@ -55,6 +55,7 @@ class HDP23StackAdvisor(HDP22StackAdvisor): server_host = socket.getfqdn() server_port = '8080' + server_protocol = 'http' views_dir = '/var/lib/ambari-server/resources/views/' if serverProperties: @@ -62,13 +63,18 @@ class HDP23StackAdvisor(HDP22StackAdvisor): server_port = serverProperties['client.api.port'] if 'views.dir' in serverProperties: views_dir = serverProperties['views.dir'] + if 'api.ssl' in serverProperties: + if serverProperties['api.ssl'].lower() == 'true': + server_protocol = 'https' - if os.path.exists(views_dir) and os.path.isdir(views_dir): + views_work_dir = os.path.join(views_dir, 'work') + + if os.path.exists(views_work_dir) and os.path.isdir(views_work_dir): last_version = '0.0.0' - for file in os.listdir(views_dir): - if fnmatch.fnmatch(file, 'tez-view*.jar'): - current_version = file.lstrip("tez-view-")[:-4] # E.g.: tez-view-2.1.0.2043.jar - if self.versionCompare(current_version, last_version) >= 0: + for file in os.listdir(views_work_dir): + if fnmatch.fnmatch(file, 'TEZ{*}'): + current_version = file.lstrip("TEZ{").rstrip("}") # E.g.: TEZ{0.7.0.2.3.0.0-2154} + if self.versionCompare(current_version.replace("-", "."), last_version.replace("-", ".")) >= 0: latest_tez_jar_version = current_version last_version = current_version pass @@ -77,7 +83,7 @@ class HDP23StackAdvisor(HDP22StackAdvisor): pass if latest_tez_jar_version: - tez_url = 'http://{0}:{1}/views/TEZ/{2}/TEZ_CLUSTER_INSTANCE'.format(server_host, server_port, latest_tez_jar_version) + tez_url = '{0}://{1}:{2}/#/main/views/TEZ/{3}/TEZ_CLUSTER_INSTANCE'.format(server_protocol, server_host, server_port, latest_tez_jar_version) putTezProperty("tez.tez-ui.history-url.base", tez_url) pass http://git-wip-us.apache.org/repos/asf/ambari/blob/516c4c31/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py index fd35f1c..dedadeb 100644 --- a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py +++ b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py @@ -17,6 +17,7 @@ limitations under the License. ''' import os +import socket from unittest import TestCase from mock.mock import patch, MagicMock @@ -489,7 +490,15 @@ class TestHDP23StackAdvisor(TestCase): self.stackAdvisor.recommendHIVEConfigurations(configurations, clusterData, services, hosts) self.assertEquals(configurations, expected) - def test_recommendTezConfigurations(self): + @patch('os.path.exists') + @patch('os.path.isdir') + @patch('os.listdir') + def test_recommendTezConfigurations(self, os_listdir_mock, os_isdir_mock, os_exists_mock): + + os_exists_mock.return_value = True + os_isdir_mock.return_value = True + os_listdir_mock.return_value = ['TEZ{0.7.0.2.3.0.0-2155}'] + self.maxDiff = None configurations = { "yarn-site": { @@ -655,8 +664,12 @@ class TestHDP23StackAdvisor(TestCase): self.stackAdvisor.recommendTezConfigurations(configurations, clusterData, services, hosts) self.assertEquals(configurations, expected) + server_host = socket.getfqdn() + tez_ui_url = "http://" + server_host + ":8080/#/main/views/TEZ/0.7.0.2.3.0.0-2155/TEZ_CLUSTER_INSTANCE" + # Test JDK1.7 services['ambari-server-properties'] = {'java.home': '/usr/jdk64/jdk1.7.3_23'} + expected['tez-site']['properties']['tez.tez-ui.history-url.base'] = tez_ui_url self.stackAdvisor.recommendTezConfigurations(configurations, clusterData, services, hosts) self.assertEquals(configurations, expected) @@ -664,6 +677,7 @@ class TestHDP23StackAdvisor(TestCase): services['ambari-server-properties'] = {'java.home': '/usr/jdk64/jdk1.8_44'} expected['tez-site']['properties']['tez.am.launch.cmd-opts'] = "-XX:+PrintGCDetails -verbose:gc -XX:+PrintGCTimeStamps -XX:+UseNUMA -XX:+UseG1GC -XX:+ResizeTLAB" expected['tez-site']['properties']['tez.task.launch.cmd-opts'] = "-XX:+PrintGCDetails -verbose:gc -XX:+PrintGCTimeStamps -XX:+UseNUMA -XX:+UseG1GC -XX:+ResizeTLAB" + expected['tez-site']['properties']['tez.tez-ui.history-url.base'] = tez_ui_url self.stackAdvisor.recommendTezConfigurations(configurations, clusterData, services, hosts) self.assertEquals(configurations, expected) @@ -671,6 +685,7 @@ class TestHDP23StackAdvisor(TestCase): services['ambari-server-properties'] = {'java.home': '/usr/jdk64/jdk1.9.2_44'} expected['tez-site']['properties']['tez.am.launch.cmd-opts'] = "-XX:+PrintGCDetails -verbose:gc -XX:+PrintGCTimeStamps -XX:+UseNUMA -XX:+UseG1GC -XX:+ResizeTLAB" expected['tez-site']['properties']['tez.task.launch.cmd-opts'] = "-XX:+PrintGCDetails -verbose:gc -XX:+PrintGCTimeStamps -XX:+UseNUMA -XX:+UseG1GC -XX:+ResizeTLAB" + expected['tez-site']['properties']['tez.tez-ui.history-url.base'] = tez_ui_url self.stackAdvisor.recommendTezConfigurations(configurations, clusterData, services, hosts) self.assertEquals(configurations, expected)