ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject git commit: AMBARI-4156. MAPREDUCE on HDP1. Using resource management lib (Arsen Babych via aonishuk)
Date Tue, 24 Dec 2013 16:11:55 GMT
Updated Branches:
  refs/heads/trunk 95fb387b9 -> fe8d9ab2c


AMBARI-4156. MAPREDUCE on HDP1. Using resource management lib
(Arsen Babych via aonishuk)


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

Branch: refs/heads/trunk
Commit: fe8d9ab2cd288953e4262d3e8d53466fbd51d7f3
Parents: 95fb387
Author: Andrew Onischuk <aonishuk@hortonworks.com>
Authored: Tue Dec 24 08:10:44 2013 -0800
Committer: Andrew Onischuk <aonishuk@hortonworks.com>
Committed: Tue Dec 24 08:10:44 2013 -0800

----------------------------------------------------------------------
 .../HDP/1.3._/services/MAPREDUCE/metainfo.xml   |  66 +++++++++---
 .../MAPREDUCE/package/scripts/client.py         |  43 ++++++++
 .../MAPREDUCE/package/scripts/historyserver.py  |  59 +++++++++++
 .../MAPREDUCE/package/scripts/jobtracker.py     |  87 ++++++++++++++++
 .../MAPREDUCE/package/scripts/mapreduce.py      |  40 +++++++
 .../MAPREDUCE/package/scripts/params.py         |  49 +++++++++
 .../MAPREDUCE/package/scripts/service.py        |  56 ++++++++++
 .../MAPREDUCE/package/scripts/service_check.py  |  89 ++++++++++++++++
 .../MAPREDUCE/package/scripts/status_params.py  |  33 ++++++
 .../MAPREDUCE/package/scripts/tasktracker.py    | 104 +++++++++++++++++++
 10 files changed, 609 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fe8d9ab2/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/metainfo.xml
b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/metainfo.xml
index 2493a13..a1ca7ba 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/metainfo.xml
@@ -15,30 +15,62 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
+
 <metainfo>
-    <user>mapred</user>
-    <comment>Apache Hadoop Distributed Processing Framework</comment>
-    <version>1.2.0.1.3.3.0</version>
+  <schemaVersion>2.0</schemaVersion>
+  <services>
+    <service>
+      <name>MAPREDUCE</name>
+      <comment>Apache Hadoop NextGen MapReduce (YARN)</comment>
+      <version>1.2.0.1.3.3.0</version>
+      <components>
 
-    <components>
         <component>
-            <name>JOBTRACKER</name>
-            <category>MASTER</category>
+          <name>JOBTRACKER</name>
+          <category>MASTER</category>
+          <commandScript>
+            <script>scripts/jobtracker.py</script>
+            <scriptType>PYTHON</scriptType>
+            <timeout>600</timeout>
+          </commandScript>
         </component>
 
         <component>
-            <name>TASKTRACKER</name>
-            <category>SLAVE</category>
+          <name>TASKTRACKER</name>
+          <category>SLAVE</category>
+          <commandScript>
+            <script>scripts/tasktracker.py</script>
+            <scriptType>PYTHON</scriptType>
+            <timeout>600</timeout>
+          </commandScript>
         </component>
 
         <component>
-            <name>MAPREDUCE_CLIENT</name>
-            <category>CLIENT</category>
+          <name>MAPREDUCE_CLIENT</name>
+          <category>CLIENT</category>
+          <commandScript>
+            <script>scripts/client.py</script>
+            <scriptType>PYTHON</scriptType>
+            <timeout>600</timeout>
+          </commandScript>
         </component>
-    </components>
-    <configuration-dependencies>
-      <config-type>core-site</config-type>
-      <config-type>global</config-type>
-      <config-type>mapred-site</config-type>
-    </configuration-dependencies>
-</metainfo>
+      </components>
+
+
+      <commandScript>
+        <script>scripts/service_check.py</script>
+        <scriptType>PYTHON</scriptType>
+        <timeout>300</timeout>
+      </commandScript>
+
+      <configuration-dependencies>
+        <config-type>capacity-scheduler</config-type>
+        <config-type>core-site</config-type>
+        <config-type>global</config-type>
+        <config-type>mapred-site</config-type>
+        <config-type>mapred-queue-acls</config-type>
+      </configuration-dependencies>
+    </service>
+
+  </services>
+</metainfo>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe8d9ab2/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/client.py
b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/client.py
new file mode 100644
index 0000000..79c644d
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/client.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+import sys
+from resource_management import *
+
+from mapreduce import mapreduce
+from service import service
+
+class Client(Script):
+
+  def install(self, env):
+    self.install_packages(env)
+    self.configure(env)
+
+  def configure(self, env):
+    import params
+    env.set_params(params)
+    mapreduce()
+
+  def status(self, env):
+    raise ClientComponentHasNoStatus()
+
+if __name__ == "__main__":
+  Client().execute()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe8d9ab2/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/historyserver.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/historyserver.py
b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/historyserver.py
new file mode 100644
index 0000000..c582a02
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/historyserver.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+import sys
+from resource_management import *
+
+from mapreduce import mapreduce
+from service import service
+
+class Historyserver(Script):
+  # def install(self, env):
+  #   self.install_packages(env)
+  #   self.configure(env)
+  #
+  # def configure(self, env):
+  #   import params
+  #   env.set_params(params)
+  #   mapreduce()
+
+  def start(self, env):
+    import params
+    env.set_params(params)
+    service('historyserver',
+            action='start'
+    )
+
+  def stop(self, env):
+    import params
+    env.set_params(params)
+
+    service('historyserver',
+            action='stop'
+    )
+
+  # def status(self, env):
+  #   import status_params
+  #   env.set_params(status_params)
+  #   check_process_status(status_params.historyserver_pid_file)
+
+if __name__ == "__main__":
+  Historyserver().execute()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe8d9ab2/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/jobtracker.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/jobtracker.py
b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/jobtracker.py
new file mode 100644
index 0000000..ab33db7
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/jobtracker.py
@@ -0,0 +1,87 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+import sys
+from resource_management import *
+
+from mapreduce import mapreduce
+from service import service
+from historyserver import Historyserver
+
+class Jobtracker(Script):
+  def install(self, env):
+    self.install_packages(env)
+    self.configure(env)
+
+  def configure(self, env):
+    import params
+    env.set_params(params)
+    mapreduce()
+
+  def start(self, env):
+    import params
+    env.set_params(params)
+    self.configure(env) # FOR SECURITY
+    service('jobtracker',
+            action='start'
+    )
+
+    Historyserver().start(env) #TODO HS will be separate component
+
+  def stop(self, env):
+    import params
+    env.set_params(params)
+
+    service('jobtracker',
+            action='stop'
+    )
+
+    Historyserver().stop(env) #TODO HS will be separate component
+
+  def status(self, env):
+    import status_params
+    env.set_params(status_params)
+    check_process_status(status_params.jobtracker_pid_file)
+
+if __name__ == "__main__":
+  Jobtracker().execute()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe8d9ab2/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/mapreduce.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/mapreduce.py
b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/mapreduce.py
new file mode 100644
index 0000000..41e2af1
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/mapreduce.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
+from resource_management import *
+import sys
+
+
+def mapreduce():
+  import params
+
+  Directory([params.mapred_pid_dir,params.mapred_log_dir],
+            owner=params.mapred_user,
+            group=params.user_group,
+            recursive=True
+  )
+
+  Directory(params.mapred_local_dir,
+            owner=params.mapred_user,
+            mode=0755,
+            recursive=True
+  )

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe8d9ab2/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/params.py
b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/params.py
new file mode 100644
index 0000000..dd8569a
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/params.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+from resource_management import *
+import status_params
+
+# server configurations
+config = Script.get_config()
+
+conf_dir = "/etc/hadoop/conf"
+
+mapred_user = status_params.mapred_user
+pid_dir_prefix = status_params.pid_dir_prefix
+mapred_pid_dir = status_params.mapred_pid_dir
+
+historyserver_pid_file = status_params.historyserver_pid_file
+jobtracker_pid_file = status_params.jobtracker_pid_file
+tasktracker_pid_file = status_params.tasktracker_pid_file
+
+hadoop_libexec_dir = '/usr/lib/hadoop/libexec'
+hadoop_bin = "/usr/lib/hadoop/bin"
+user_group = config['configurations']['global']['user_group']
+hdfs_log_dir_prefix = config['configurations']['global']['hdfs_log_dir_prefix']
+mapred_log_dir = format("{hdfs_log_dir_prefix}/{mapred_user}")
+mapred_local_dir = config['configurations']['mapred-site']['mapred.local.dir']
+
+hadoop_jar_location = "/usr/lib/hadoop/"
+smokeuser = config['configurations']['global']['smokeuser']
+security_enabled = config['configurations']['global']['security_enabled']
+smoke_user_keytab = config['configurations']['global']['smokeuser_keytab']
+kinit_path_local = get_kinit_path([default("kinit_path_local",None), "/usr/bin", "/usr/kerberos/bin",
"/usr/sbin"])
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe8d9ab2/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/service.py
b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/service.py
new file mode 100644
index 0000000..f4aa91b
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/service.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
+from resource_management import *
+
+
+def service(
+    name,
+    action='start'):
+
+  import params
+
+  pid_file = format("{mapred_pid_dir}/hadoop-{mapred_user}-{name}.pid")
+  hadoop_daemon = format("export HADOOP_LIBEXEC_DIR={hadoop_libexec_dir} && {hadoop_bin}/hadoop-daemon.sh")
+  cmd = format("{hadoop_daemon} --config {conf_dir}")
+
+  if action == 'start':
+    daemon_cmd = format("{cmd} start {name}")
+    no_op = format("ls {pid_file} >/dev/null 2>&1 && ps `cat {pid_file}`
>/dev/null 2>&1")
+    Execute(daemon_cmd,
+            user=params.mapred_user,
+            not_if=no_op
+    )
+
+    Execute(no_op,
+            user=params.mapred_user,
+            not_if=no_op,
+            initial_wait=5
+    )
+  elif action == 'stop':
+    daemon_cmd = format("{cmd} stop {name}")
+    rm_pid =  format("rm -f {pid_file}")
+
+    Execute(daemon_cmd,
+            user=params.mapred_user
+    )
+    Execute(rm_pid)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe8d9ab2/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/service_check.py
b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/service_check.py
new file mode 100644
index 0000000..c0a4a59
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/service_check.py
@@ -0,0 +1,89 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
+from resource_management import *
+
+class ServiceCheck(Script):
+  def service_check(self, env):
+    import params
+    env.set_params(params)
+
+    jar_location = params.hadoop_jar_location
+    input_file = 'mapredsmokeinput'
+    output_file = "mapredsmokeoutput"
+
+    cleanup_cmd = format("dfs -rmr {output_file} {input_file}")
+    create_file_cmd = format("{cleanup_cmd} ; hadoop dfs -put /etc/passwd {input_file}")
+    test_cmd = format("fs -test -e {output_file}")
+    run_wordcount_job = format("jar {jar_location}/hadoop-examples.jar wordcount {input_file}
{output_file}")
+
+    if params.security_enabled:
+      kinit_cmd = format("{kinit_path_local} -kt {smoke_user_keytab} {smokeuser};")
+
+      Execute(kinit_cmd,
+              user=params.smokeuser
+      )
+
+    ExecuteHadoop(create_file_cmd,
+                  tries=1,
+                  try_sleep=5,
+                  user=params.smokeuser,
+                  conf_dir=params.conf_dir
+    )
+
+    ExecuteHadoop(run_wordcount_job,
+                  tries=1,
+                  try_sleep=5,
+                  user=params.smokeuser,
+                  conf_dir=params.conf_dir,
+                  logoutput=True
+    )
+
+    ExecuteHadoop(test_cmd,
+                  user=params.smokeuser,
+                  conf_dir=params.conf_dir
+    )
+
+if __name__ == "__main__":
+  ServiceCheck().execute()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe8d9ab2/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/status_params.py
b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/status_params.py
new file mode 100644
index 0000000..f964a76
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/status_params.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
+from resource_management import *
+
+config = Script.get_config()
+
+mapred_user = config['configurations']['global']['mapred_user']
+pid_dir_prefix = config['configurations']['global']['hadoop_pid_dir_prefix']
+mapred_pid_dir = format("{pid_dir_prefix}/{mapred_user}")
+
+jobtracker_pid_file = format("{mapred_pid_dir}/hadoop-{mapred_user}-jobtracker.pid")
+tasktracker_pid_file = format("{mapred_pid_dir}/hadoop-{mapred_user}-tasktracker.pid")
+historyserver_pid_file = format("{mapred_pid_dir}/hadoop-{mapred_user}-historyserver.pid")
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe8d9ab2/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/tasktracker.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/tasktracker.py
b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/tasktracker.py
new file mode 100644
index 0000000..77d974b
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3._/services/MAPREDUCE/package/scripts/tasktracker.py
@@ -0,0 +1,104 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+import sys
+from resource_management import *
+
+from mapreduce import mapreduce
+from service import service
+
+class Tasktracker(Script):
+  def install(self, env):
+    self.install_packages(env)
+    self.configure(env)
+
+  def configure(self, env):
+    import params
+    env.set_params(params)
+    mapreduce()
+
+  def start(self, env):
+    import params
+    env.set_params(params)
+    self.configure(env) # FOR SECURITY
+    service('tasktracker',
+            action='start'
+    )
+
+  def stop(self, env):
+    import params
+    env.set_params(params)
+
+    service('tasktracker',
+            action='stop'
+    )
+
+  def status(self, env):
+    import status_params
+    env.set_params(status_params)
+    check_process_status(status_params.tasktracker_pid_file)
+
+if __name__ == "__main__":
+  Tasktracker().execute()
\ No newline at end of file


Mime
View raw message