mandy 0.4 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
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 "Here are the commands at your disposal..."
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
@@ -2,6 +2,8 @@
2
2
  require 'optparse'
3
3
  require 'ostruct'
4
4
 
5
+ exec('mandy-get -h') unless ARGV.size >= 2
6
+
5
7
  options = OpenStruct.new
6
8
 
7
9
  OptionParser.new do |opts|
data/bin/mandy-hadoop CHANGED
@@ -5,6 +5,8 @@ require 'optparse'
5
5
  require 'ostruct'
6
6
  require 'cgi'
7
7
 
8
+ exec('mandy-hadoop -h') unless ARGV.size >= 3
9
+
8
10
  options = OpenStruct.new
9
11
 
10
12
  OptionParser.new do |opts|
data/bin/mandy-local CHANGED
@@ -3,6 +3,7 @@ require 'optparse'
3
3
  require 'ostruct'
4
4
  require 'cgi'
5
5
 
6
+ exec('mandy-local -h') unless ARGV.size >= 3
6
7
 
7
8
  options = OpenStruct.new
8
9
 
data/bin/mandy-put CHANGED
@@ -2,6 +2,9 @@
2
2
  require 'optparse'
3
3
  require 'ostruct'
4
4
 
5
+ exec('mandy-put -h') unless ARGV.size >= 2
6
+
7
+
5
8
  options = OpenStruct.new
6
9
 
7
10
  OptionParser.new do |opts|
data/bin/mandy-rm CHANGED
@@ -2,6 +2,9 @@
2
2
  require 'optparse'
3
3
  require 'ostruct'
4
4
 
5
+ exec('mandy-rm -h') unless ARGV.size >= 1
6
+
7
+
5
8
  options = OpenStruct.new
6
9
 
7
10
  OptionParser.new do |opts|
data/bin/mandy-run CHANGED
@@ -5,6 +5,9 @@ require 'optparse'
5
5
  require 'ostruct'
6
6
  require 'json'
7
7
 
8
+ exec('mandy-local -h') unless ARGV.size >= 2
9
+
10
+
8
11
  options = OpenStruct.new
9
12
 
10
13
  OptionParser.new do |opts|
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.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mandy
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.4"
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Kent