Class: Chef::Knife::HadoopMapredJobKill

Inherits:
Chef::Knife show all
Includes:
HadoopBase
Defined in:
lib/chef/knife/hadoop_mapred_job_kill.rb

Instance Method Summary collapse

Methods included from HadoopBase

#db_connection, #hdfs_connection, included, #locate_config_value, #msg_pair

Instance Method Details

#runObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/chef/knife/hadoop_mapred_job_kill.rb', line 52

def run
  $stdout.sync = true

  Chef::Log.debug("username: #{Chef::Config[:knife][:mapred_mgmt_host]}")
  Chef::Log.debug("password: #{Chef::Config[:knife][:mapred_mgmt_port]}")

  filter = "#{Chef::Config[:knife][:filter]}".downcase
  case filter
  when 'id'
    RestClient.delete "http://#{Chef::Config[:knife][:mapred_mgmt_host]}:#{Chef::Config[:knife][:mapred_mgmt_port]}/job/kill/id/#{Chef::Config[:knife][:jobid]}"
  when 'name'
    RestClient.delete "http://#{Chef::Config[:knife][:mapred_mgmt_host]}:#{Chef::Config[:knife][:mapred_mgmt_port]}/job/kill/name/#{Chef::Config[:knife][:jobname]}"
  end
end