You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2014/11/05 02:10:11 UTC

git commit: AMBARI-8152. Pig Service check fails because tez tarball is not copied to HDFS (alejandro)

Repository: ambari
Updated Branches:
  refs/heads/trunk 2b36334f2 -> d6b88232c


AMBARI-8152. Pig Service check fails because tez tarball is not copied to HDFS (alejandro)


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

Branch: refs/heads/trunk
Commit: d6b88232cf3356e6b707b77841c7903a8ed97a96
Parents: 2b36334
Author: Alejandro Fernandez <af...@hortonworks.com>
Authored: Tue Nov 4 16:59:36 2014 -0800
Committer: Alejandro Fernandez <af...@hortonworks.com>
Committed: Tue Nov 4 17:09:51 2014 -0800

----------------------------------------------------------------------
 .../2.0.6/services/PIG/package/scripts/params.py    | 16 +++++++++++++++-
 .../services/PIG/package/scripts/service_check.py   |  9 +++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d6b88232/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/params.py
index 5f658b4..8cbd1a5 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/params.py
@@ -44,6 +44,7 @@ hadoop_conf_dir = "/etc/hadoop/conf"
 pig_conf_dir = "/etc/pig/conf"
 hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
 hdfs_principal_name = config['configurations']['hadoop-env']['hdfs_principal_name']
+hdfs_user_keytab = config['configurations']['hadoop-env']['hdfs_user_keytab']
 smokeuser = config['configurations']['cluster-env']['smokeuser']
 user_group = config['configurations']['cluster-env']['user_group']
 security_enabled = config['configurations']['cluster-env']['security_enabled']
@@ -56,4 +57,17 @@ java64_home = config['hostLevelParams']['java_home']
 
 pig_properties = config['configurations']['pig-properties']['content']
 
-log4j_props = config['configurations']['pig-log4j']['content']
\ No newline at end of file
+log4j_props = config['configurations']['pig-log4j']['content']
+
+import functools
+#create partial functions with common arguments for every HdfsDirectory call
+#to create hdfs directory we need to call params.HdfsDirectory in code
+HdfsDirectory = functools.partial(
+  HdfsDirectory,
+  conf_dir=hadoop_conf_dir,
+  hdfs_user=hdfs_principal_name if security_enabled else hdfs_user,
+  security_enabled = security_enabled,
+  keytab = hdfs_user_keytab,
+  kinit_path_local = kinit_path_local,
+  bin_dir = hadoop_bin_dir
+)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d6b88232/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/service_check.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/service_check.py
index 88c46e2..80aa269 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/service_check.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/PIG/package/scripts/service_check.py
@@ -20,6 +20,7 @@ Ambari Agent
 """
 
 from resource_management import *
+from resource_management.libraries.functions.dynamic_variable_interpretation import copy_tarballs_to_hdfs
 
 class PigServiceCheck(Script):
   def service_check(self, env):
@@ -80,6 +81,14 @@ class PigServiceCheck(Script):
       )
 
       # Check for Pig-on-Tez
+      copy_tarballs_to_hdfs('tez', params.smokeuser, params.hdfs_user, params.user_group)
+
+      if params.security_enabled:
+        kinit_cmd = format("{kinit_path_local} -kt {smoke_user_keytab} {smokeuser};")
+        Execute(kinit_cmd,
+                user=params.smokeuser
+        )
+
       Execute( format("pig -x tez {tmp_dir}/pigSmoke.sh"),
         tries     = 3,
         try_sleep = 5,