Repository: ambari
Updated Branches:
  refs/heads/trunk 82cfc3ee2 -> 59a74cfda


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/59a74cfd
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/59a74cfd
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/59a74cfd

Branch: refs/heads/trunk
Commit: 59a74cfda17bd3ad559f64fd967aa2dd13398e72
Parents: 82cfc3e
Author: tbeerbower <tbeerbo...@hortonworks.com>
Authored: Thu Jun 18 09:14:49 2015 -0400
Committer: tbeerbower <tbeerbo...@hortonworks.com>
Committed: Thu Jun 18 09:15:03 2015 -0400

----------------------------------------------------------------------
 .../stacks/HDP/2.3/services/stack_advisor.py          | 14 ++++++++------
 .../python/stacks/2.3/common/test_stack_advisor.py    | 13 ++++++++++++-
 2 files changed, 20 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/59a74cfd/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 d65d711..1075a06 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
@@ -63,12 +63,14 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
       if 'views.dir' in serverProperties:
         views_dir = serverProperties['views.dir']
 
-      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 +79,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 = 
'http://{0}:{1}/#/main/views/TEZ/{2}/TEZ_CLUSTER_INSTANCE'.format(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/59a74cfd/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 2f73f18..da85cfc 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
@@ -480,7 +480,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": {
@@ -648,6 +656,7 @@ class TestHDP23StackAdvisor(TestCase):
 
     # 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'] = 
"http://hw11465.home:8080/#/main/views/TEZ/0.7.0.2.3.0.0-2155/TEZ_CLUSTER_INSTANCE";
     self.stackAdvisor.recommendTezConfigurations(configurations, clusterData, 
services, hosts)
     self.assertEquals(configurations, expected)
 
@@ -655,6 +664,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'] = 
"http://hw11465.home:8080/#/main/views/TEZ/0.7.0.2.3.0.0-2155/TEZ_CLUSTER_INSTANCE";
     self.stackAdvisor.recommendTezConfigurations(configurations, clusterData, 
services, hosts)
     self.assertEquals(configurations, expected)
 
@@ -662,6 +672,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'] = 
"http://hw11465.home:8080/#/main/views/TEZ/0.7.0.2.3.0.0-2155/TEZ_CLUSTER_INSTANCE";
     self.stackAdvisor.recommendTezConfigurations(configurations, clusterData, 
services, hosts)
     self.assertEquals(configurations, expected)
 

Reply via email to