#!/usr/bin/env ruby def absolute_path(path) path =~ /^\// ? path : File.join(Dir.pwd, path) end file = ARGV[0] filename = File.basename(file) input = ARGV[1] output = ARGV[2] config = ARGV[3] require absolute_path(file) jobconf = Mandy::Job.default.settings.map { |key, value| %(-jobconf #{key}="#{value}") }.join(' ') command = %($HADOOP_HOME/bin/hadoop jar $HADOOP_HOME/contrib/streaming/hadoop-*-streaming.jar \ -additionalconfspec "#{config}" \ -input "#{input}" \ -mapper "mandy-map #{filename}" \ -reducer "mandy-reduce #{filename}" \ -file "#{file}" \ -output "#{output}" \ #{jobconf}) `#{command}` # puts "#{command}"