trafficbroker-mandy 0.1.5 → 0.1.6

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.
data/bin/mandy-hadoop CHANGED
@@ -19,18 +19,16 @@ require absolute_path(file)
19
19
 
20
20
  Mandy::Job.jobs.each_with_index do |job, i|
21
21
 
22
- jobconf = job.settings.map { |key, value| %(-jobconf #{key}="#{value}") }.join(' ')
23
-
22
+ jobconf = job.settings.map { |key, value| %(-D #{key}='#{value}') }.join(' ')
24
23
  output = File.join(output_folder, "#{i+1}-#{job.name.downcase.gsub(/\W/, '-')}")
25
24
 
26
- command = %($HADOOP_HOME/bin/hadoop jar $HADOOP_HOME/contrib/streaming/hadoop-*-streaming.jar \
27
- -additionalconfspec "#{config}" \
25
+ command = %($HADOOP_HOME/bin/hadoop jar $HADOOP_HOME/contrib/streaming/hadoop-*-streaming.jar #{jobconf}\
26
+ -conf '#{config}' \
28
27
  -input "#{input}" \
29
28
  -mapper "mandy-map #{filename} '#{job.name}'" \
30
29
  -reducer "mandy-reduce #{filename} '#{job.name}'" \
31
30
  -file "#{file}" \
32
- -output "#{output}" \
33
- #{jobconf})
31
+ -output "#{output}")
34
32
 
35
33
  `#{command}`
36
34
 
data/bin/mandy-rm CHANGED
@@ -5,7 +5,7 @@ if ARGV.size==0
5
5
  exit
6
6
  end
7
7
 
8
- file = ARGV[1]
9
- config = ARGV[0]
8
+ file = ARGV[0]
9
+ config = ARGV[1]
10
10
 
11
11
  `$HADOOP_HOME/bin/hadoop fs -conf #{config} -rmr #{file}`
data/lib/mandy.rb CHANGED
@@ -6,6 +6,8 @@
6
6
  reducers/base_reducer
7
7
  reducers/pass_through_reducer
8
8
  reducers/sum_reducer
9
+ reducers/max_reducer
10
+ reducers/min_reducer
9
11
  dsl
10
12
  job
11
13
  test_runner
@@ -0,0 +1,10 @@
1
+ module Mandy
2
+ module Reducers
3
+ class MaxReducer < Base
4
+ def reducer(key,values)
5
+ values.map! {|value| value.to_f}
6
+ emit(key, values.max)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Mandy
2
+ module Reducers
3
+ class MinReducer < Base
4
+ def reducer(key,values)
5
+ values.map! {|value| value.to_f}
6
+ emit(key, values.min)
7
+ end
8
+ end
9
+ end
10
+ end
data/lib/support/tuple.rb CHANGED
@@ -17,7 +17,12 @@ module Mandy
17
17
  new(*str.split(SEPERATOR))
18
18
  end
19
19
 
20
+ def inspect
21
+ %(<Tuple #{self.to_s}>)
22
+ end
23
+
20
24
  def ==(other)
25
+ return false unless self.class == other.class
21
26
  self.name == other.name && self.value == other.value
22
27
  end
23
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trafficbroker-mandy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Kent
@@ -46,6 +46,8 @@ files:
46
46
  - lib/reducers/base_reducer.rb
47
47
  - lib/reducers/pass_through_reducer.rb
48
48
  - lib/reducers/sum_reducer.rb
49
+ - lib/reducers/max_reducer.rb
50
+ - lib/reducers/min_reducer.rb
49
51
  - lib/test_runner.rb
50
52
  has_rdoc: false
51
53
  homepage: