mandy 0.4 → 0.4.1
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 +28 -4
- data/bin/mandy-get +2 -0
- data/bin/mandy-hadoop +2 -0
- data/bin/mandy-local +1 -0
- data/bin/mandy-put +3 -0
- data/bin/mandy-rm +3 -0
- data/bin/mandy-run +3 -0
- data/lib/mandy.rb +4 -0
- data/readme.md +4 -0
- metadata +1 -1
data/bin/mandy
CHANGED
@@ -3,9 +3,33 @@
|
|
3
3
|
require "rubygems"
|
4
4
|
require "mandy"
|
5
5
|
|
6
|
+
# Hadoop Home Detection
|
7
|
+
hadoop_home = `echo $HADOOP_HOME`.chomp
|
8
|
+
|
9
|
+
if hadoop_home== ''
|
10
|
+
puts "You need to set the HADOOP_HOME environment variable to point to your hadoop install :("
|
11
|
+
puts "Try setting 'export HADOOP_HOME=/my/hadoop/path' in your ~/.profile maybe?"
|
12
|
+
exit(1)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Hadoop Version Detection
|
16
|
+
hadoop_version = `$HADOOP_HOME/bin/hadoop version 2>&1`
|
17
|
+
|
18
|
+
if hadoop_version =~ /No such file or directory/
|
19
|
+
puts("Mandy failed to find Hadoop in #{hadoop_home} :(")
|
20
|
+
puts
|
21
|
+
puts hadoop_version
|
22
|
+
exit(1)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Status & Help Message
|
6
26
|
puts "\nYou are running Mandy!"
|
7
|
-
puts "
|
8
|
-
puts
|
27
|
+
puts "========================"
|
28
|
+
puts
|
29
|
+
puts "Using #{hadoop_version.split("\n").first} located at #{`echo $HADOOP_HOME`}"
|
30
|
+
puts
|
31
|
+
puts "Available Mandy Commands"
|
32
|
+
puts '------------------------'
|
9
33
|
|
10
34
|
{
|
11
35
|
'mandy-install' => 'Installs the Mandy Rubygem on several hosts via ssh.',
|
@@ -17,6 +41,6 @@ puts ''
|
|
17
41
|
'mandy-map' => 'Run a map task reading on STDIN and writing to STDOUT',
|
18
42
|
'mandy-reduce' => 'Run a reduce task reading on STDIN and writing to STDOUT'
|
19
43
|
}.each do |command, description|
|
20
|
-
|
44
|
+
|
21
45
|
puts "#{command.ljust(15)} #{description}"
|
22
|
-
end
|
46
|
+
end
|
data/bin/mandy-get
CHANGED
data/bin/mandy-hadoop
CHANGED
data/bin/mandy-local
CHANGED
data/bin/mandy-put
CHANGED
data/bin/mandy-rm
CHANGED
data/bin/mandy-run
CHANGED
data/lib/mandy.rb
CHANGED
@@ -30,6 +30,7 @@ require "cgi"
|
|
30
30
|
module Mandy
|
31
31
|
class << self
|
32
32
|
attr_accessor :local_input
|
33
|
+
attr_accessor :autorun
|
33
34
|
def stores
|
34
35
|
@stores||={}
|
35
36
|
end
|
@@ -44,9 +45,12 @@ module Mandy
|
|
44
45
|
module_function :job
|
45
46
|
end
|
46
47
|
|
48
|
+
Mandy.autorun = true
|
49
|
+
|
47
50
|
at_exit do
|
48
51
|
raise $! if $!
|
49
52
|
caller = Kernel.caller.first
|
53
|
+
next unless Mandy.autorun
|
50
54
|
next if caller.nil?
|
51
55
|
caller = caller.split(':').first
|
52
56
|
next if caller =~ /bin\/(rake|mandy)/
|
data/readme.md
CHANGED
@@ -8,4 +8,8 @@ Run the word count example locally with...
|
|
8
8
|
|
9
9
|
mandy-local examples/word_count.rb examples/alice.txt examples/output
|
10
10
|
|
11
|
+
Mandy more examples can be found at http://github.com/trafficbroker/mandy-lab
|
12
|
+
|
13
|
+
We are very light on documentation at the moment we are aware of the problem and are working hard to rectify it.
|
14
|
+
|
11
15
|
Mandy is licensed under the MIT Licence, please see LICENCE for further information.
|