Sha256: 227be6799a44e275e98d699bf68b7d2ffb479abe2f62f85f7dae3bdabfec34cf

Contents?: true

Size: 950 Bytes

Versions: 2

Compression:

Stored size: 950 Bytes

Contents

#!/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_folder = ARGV[2]
config = ARGV[3]

require absolute_path(file)

Mandy::Job.jobs.each_with_index do |job, i|
  
  jobconf = job.settings.map { |key, value| %(-jobconf #{key}="#{value}") }.join(' ')
  
  output = File.join(output_folder, "#{i+1}-#{job.name.downcase.gsub(/\W/, '-')}")
  
  command = %($HADOOP_HOME/bin/hadoop jar $HADOOP_HOME/contrib/streaming/hadoop-*-streaming.jar \
                  -additionalconfspec "#{config}" \
                  -input "#{input}"  \
                  -mapper "mandy-map #{filename} '#{job.name}'"  \
                  -reducer "mandy-reduce #{filename} '#{job.name}'"  \
                  -file "#{file}" \
                  -output "#{output}" \
                  #{jobconf})

  `#{command}`

  # puts "#{command}"
  input = output
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trafficbroker-mandy-0.1.2 bin/mandy-hadoop
trafficbroker-mandy-0.1.3 bin/mandy-hadoop