mandy 0.5.3 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/bin/mandy-hadoop +8 -1
  3. data/lib/mandy/packer.rb +2 -2
  4. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.3
1
+ 0.5.5
data/bin/mandy-hadoop CHANGED
@@ -11,6 +11,10 @@ options = OpenStruct.new
11
11
  OptionParser.new do |opts|
12
12
  opts.banner = "USAGE: mandy-hadoop script input output [options]"
13
13
 
14
+ opts.on("-i", "--input-format class", "Set the hadoop input format type") do |format_class|
15
+ options.input_format = format_class
16
+ end
17
+
14
18
  opts.on("-p", "--payload PAYLOAD", "Add a working directory to be sent to the cluster.") do |payload|
15
19
  options.payload = payload
16
20
  end
@@ -68,6 +72,8 @@ payload = Mandy::Packer.pack(file, options.payload || ARGV[0], gemfile(options.g
68
72
  cmdenv = options.cmdenv
69
73
  set_env(cmdenv)
70
74
 
75
+ inputformat = !options.input_format.nil? ? options.input_format : "TextInputFormat"
76
+
71
77
  at_exit do
72
78
  puts
73
79
  puts "Cleaning up..."
@@ -93,13 +99,14 @@ begin
93
99
  command = %($HADOOP_HOME/bin/hadoop jar $HADOOP_HOME/contrib/streaming/hadoop-*-streaming.jar #{jobconf}\
94
100
  -files "#{payload}","#{bootstrap_file}" \
95
101
  -conf '#{config}' \
102
+ -inputformat '#{inputformat}' \
96
103
  #{input} \
97
104
  #{ inputreader.nil? ? '' : "-inputreader \"#{inputreader}\"" } \
98
105
  -mapper "ruby bootstrap.rb #{File.basename(payload)} map #{filename} '#{job.name}'" \
99
106
  -reducer "ruby bootstrap.rb #{File.basename(payload)} reduce #{filename} '#{job.name}'" \
100
107
  #{ cmdenv.nil? ? '' : "-cmdenv #{cmdenv}" }\
101
108
  -output "#{output}" 2>&1)
102
-
109
+
103
110
  result = []
104
111
  IO.popen(command, 'r') do |subprocess|
105
112
  while line = subprocess.gets
data/lib/mandy/packer.rb CHANGED
@@ -22,8 +22,8 @@ module Mandy
22
22
  end
23
23
 
24
24
  def self.cleanup!(file)
25
- tmp_dir = File.dirname(file)
26
- FileUtils.rm_r(tmp_dir)
25
+ return false unless File.extname(file) == '.tar'
26
+ `rm #{file}`
27
27
  end
28
28
  end
29
29
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 3
9
- version: 0.5.3
8
+ - 5
9
+ version: 0.5.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Andy Kent
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2009-10-19 00:00:00 +01:00
18
+ date: 2010-08-20 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency