You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by fb...@apache.org on 2015/06/03 01:52:08 UTC

ambari git commit: AMBARI-11597 [WinTP2] Test Hive setup working with Tez

Repository: ambari
Updated Branches:
  refs/heads/trunk 8d82fe45e -> 216275d95


AMBARI-11597 [WinTP2] Test Hive setup working with Tez

+Added Hive setup step when working with Tez.


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

Branch: refs/heads/trunk
Commit: 216275d9572461be8437296e12d980f0ec68eaf7
Parents: 8d82fe4
Author: Florian Barca <fb...@hortonworks.com>
Authored: Tue Jun 2 16:51:55 2015 -0700
Committer: Florian Barca <fb...@hortonworks.com>
Committed: Tue Jun 2 16:51:55 2015 -0700

----------------------------------------------------------------------
 .../0.12.0.2.0/package/files/hiveTezSetup.cmd   | 58 ++++++++++++++++++++
 .../HIVE/0.12.0.2.0/package/scripts/hive.py     |  8 +++
 .../package/scripts/params_windows.py           |  2 +
 3 files changed, 68 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/216275d9/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/files/hiveTezSetup.cmd
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/files/hiveTezSetup.cmd b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/files/hiveTezSetup.cmd
new file mode 100644
index 0000000..10d6a1c
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/files/hiveTezSetup.cmd
@@ -0,0 +1,58 @@
+@echo off
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements.  See the NOTICE file distributed with
+rem this work for additional information regarding copyright ownership.
+rem The ASF licenses this file to You under the Apache License, Version 2.0
+rem (the "License"); you may not use this file except in compliance with
+rem the License.  You may obtain a copy of the License at
+rem
+rem     http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
+
+if not defined HADOOP_HOME (
+  set EXITCODE=5
+  goto :errorexit
+)
+if not defined HIVE_HOME (
+  set EXITCODE=6
+  goto :errorexit
+)
+if not defined TEZ_HOME (
+  set EXITCODE=7
+  goto :errorexit
+)
+
+set EXITCODE=0
+
+if not exist %HIVE_HOME%\conf\hive-tez-configured (
+  %HADOOP_HOME%\bin\hadoop.cmd fs -mkdir /apps/tez
+  set EXITCODE=%ERRORLEVEL%
+  if %EXITCODE% neq 0 goto :errorexit
+
+  %HADOOP_HOME%\bin\hadoop.cmd fs -chmod -R 755 /apps/tez
+  set EXITCODE=%ERRORLEVEL%
+  if %EXITCODE% neq 0 goto :errorexit
+
+  %HADOOP_HOME%\bin\hadoop.cmd fs -chown -R hadoop:users /apps/tez
+  set EXITCODE=%ERRORLEVEL%
+  if %EXITCODE% neq 0 goto :errorexit
+
+  %HADOOP_HOME%\bin\hadoop.cmd fs -put %TEZ_HOME%\* /apps/tez
+  set EXITCODE=%ERRORLEVEL%
+  if %EXITCODE% neq 0 goto :errorexit
+
+  %HADOOP_HOME%\bin\hadoop.cmd fs -rm -r -skipTrash /apps/tez/conf
+  set EXITCODE=%ERRORLEVEL%
+  if %EXITCODE% neq 0 goto :errorexit
+
+  echo done > %HIVE_HOME%\conf\hive-tez-configured
+)
+goto :eof
+
+:errorexit
+exit /B %EXITCODE%

http://git-wip-us.apache.org/repos/asf/ambari/blob/216275d9/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
index f0aab9c..32edf71 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
@@ -87,6 +87,14 @@ def hive(name=None):
                 logoutput=True
         )
 
+  if name == "hiveserver2":
+    if params.hive_execution_engine == "tez":
+      # Init the tez app dir in hadoop
+      script_file = __file__.replace('/', os.sep)
+      cmd_file = os.path.normpath(os.path.join(os.path.dirname(script_file), "..", "files", "hiveTezSetup.cmd"))
+
+      Execute("cmd /c " + cmd_file, logoutput=True, user=params.hadoop_user)
+
 
 @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
 def hive(name=None):

http://git-wip-us.apache.org/repos/asf/ambari/blob/216275d9/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_windows.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_windows.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_windows.py
index 329fe0c..506e869 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_windows.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_windows.py
@@ -50,6 +50,8 @@ hive_metastore_user_passwd = config['configurations']['hive-site']['javax.jdo.op
 
 hive_exclude_packages = []
 
+hive_execution_engine = config["configurations"]["hive-site"]["hive.execution.engine"]
+
 ######## Metastore Schema
 init_metastore_schema = not config['configurations']['hive-site']['datanucleus.autoCreateSchema']