Skip to content

Commit

Permalink
Merge pull request #56 from continuuity/feature/jobtracker-support
Browse files Browse the repository at this point in the history
Feature/jobtracker support
  • Loading branch information
wolf31o2 committed May 20, 2014
2 parents 5936075 + f5d3aec commit 53859b3
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 1 deletion.
39 changes: 39 additions & 0 deletions recipes/hadoop_mapreduce_jobtracker.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#
# Cookbook Name:: hadoop
# Recipe:: hadoop_mapreduce_jobtracker
#
# Copyright (C) 2013-2014 Continuuity, Inc.
#
# Licensed 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.
#

include_recipe 'hadoop::default'

# TODO: check for these and set them up
# mapreduce.cluster.local.dir = #{hadoop_tmp_dir}/mapred/local
# mapreduce.jobtracker.system.dir = #{hadoop_tmp_dir}/mapred/system
# mapreduce.jobtracker.staging.root.dir = #{hadoop_tmp_dir}/mapred/staging
# mapreduce.cluster.temp.dir = #{hadoop_tmp_dir}/mapred/temp

# Only CDH supports a JobTracker package
package 'hadoop-0.20-mapreduce-jobtracker' do
action :install
only_if { node['hadoop']['distribution'] == 'cdh' }
end

service 'hadoop-0.20-mapreduce-jobtracker' do
status_command 'service hadoop-0.20-mapreduce-jobtracker status'
supports [:restart => true, :reload => false, :status => true]
action :nothing
only_if { node['hadoop']['distribution'] == 'cdh' }
end
33 changes: 33 additions & 0 deletions recipes/hadoop_mapreduce_tasktracker.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# Cookbook Name:: hadoop
# Recipe:: hadoop_mapreduce_tasktracker
#
# Copyright (C) 2013-2014 Continuuity, Inc.
#
# Licensed 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.
#

include_recipe 'hadoop::default'

# Only CDH supports a TaskTracker package
package 'hadoop-0.20-mapreduce-tasktracker' do
action :install
only_if { node['hadoop']['distribution'] == 'cdh' }
end

service 'hadoop-0.20-mapreduce-tasktracker' do
status_command 'service hadoop-0.20-mapreduce-tasktracker status'
supports [:restart => true, :reload => false, :status => true]
action :nothing
only_if { node['hadoop']['distribution'] == 'cdh' }
end
2 changes: 1 addition & 1 deletion spec/hadoop_mapreduce_historyserver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
end.converge(described_recipe)
end

it 'install hadoop-mapreduce-historyserver package' do
it 'installs hadoop-mapreduce-historyserver package' do
expect(chef_run).to install_package('hadoop-mapreduce-historyserver')
end

Expand Down
34 changes: 34 additions & 0 deletions spec/hadoop_mapreduce_jobtracker_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
require 'spec_helper'

describe 'hadoop::hadoop_mapreduce_jobtracker' do
context 'on Centos 6.4 with CDH' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'centos', version: 6.4) do |node|
node.automatic['domain'] = 'example.com'
node.override['hadoop']['distribution'] = 'cdh'
stub_command('update-alternatives --display hadoop-conf | grep best | awk \'{print $5}\' | grep /etc/hadoop/conf.chef').and_return(false)
end.converge(described_recipe)
end

it 'installs hadoop-0.20-mapreduce-jobtracker package' do
expect(chef_run).to install_package('hadoop-0.20-mapreduce-jobtracker')
end

it 'creates hadoop-0.20-mapreduce-jobtracker service resource, but does not run it' do
expect(chef_run).to_not start_service('hadoop-0.20-mapreduce-jobtracker')
end
end

context 'on Centos 6.4 with HDP' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'centos', version: 6.4) do |node|
node.automatic['domain'] = 'example.com'
stub_command('update-alternatives --display hadoop-conf | grep best | awk \'{print $5}\' | grep /etc/hadoop/conf.chef').and_return(false)
end.converge(described_recipe)
end

it 'does not install hadoop-0.20-mapreduce-jobtracker package' do
expect(chef_run).not_to install_package('hadoop-0.20-mapreduce-jobtracker')
end
end
end
34 changes: 34 additions & 0 deletions spec/hadoop_mapreduce_tasktracker_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
require 'spec_helper'

describe 'hadoop::hadoop_mapreduce_tasktracker' do
context 'on Centos 6.4 with CDH' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'centos', version: 6.4) do |node|
node.automatic['domain'] = 'example.com'
node.override['hadoop']['distribution'] = 'cdh'
stub_command('update-alternatives --display hadoop-conf | grep best | awk \'{print $5}\' | grep /etc/hadoop/conf.chef').and_return(false)
end.converge(described_recipe)
end

it 'installs hadoop-0.20-mapreduce-tasktracker package' do
expect(chef_run).to install_package('hadoop-0.20-mapreduce-tasktracker')
end

it 'creates hadoop-0.20-mapreduce-tasktracker service resource, but does not run it' do
expect(chef_run).to_not start_service('hadoop-0.20-mapreduce-tasktracker')
end
end

context 'on Centos 6.4 with HDP' do
let(:chef_run) do
ChefSpec::Runner.new(platform: 'centos', version: 6.4) do |node|
node.automatic['domain'] = 'example.com'
stub_command('update-alternatives --display hadoop-conf | grep best | awk \'{print $5}\' | grep /etc/hadoop/conf.chef').and_return(false)
end.converge(described_recipe)
end

it 'does not install hadoop-0.20-mapreduce-tasktracker package' do
expect(chef_run).not_to install_package('hadoop-0.20-mapreduce-tasktracker')
end
end
end

0 comments on commit 53859b3

Please sign in to comment.