mandy 0.4.994 → 0.4.995
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/mandy-hadoop +23 -7
- data/bin/mandy-kill +26 -0
- metadata +3 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.995
|
data/bin/mandy-hadoop
CHANGED
@@ -5,6 +5,7 @@ require 'optparse'
|
|
5
5
|
require 'ostruct'
|
6
6
|
require 'cgi'
|
7
7
|
|
8
|
+
errors = false
|
8
9
|
options = OpenStruct.new
|
9
10
|
|
10
11
|
OptionParser.new do |opts|
|
@@ -53,24 +54,26 @@ inputs = ARGV[1].split(",")
|
|
53
54
|
input = inputs.map {|path| "-input \"#{path}\""}.join(" ")
|
54
55
|
|
55
56
|
output_folder = ARGV[2]
|
56
|
-
config = options.config || 'cluster.xml'
|
57
|
-
puts "Packaging
|
57
|
+
config = absolute_path(options.config || 'cluster.xml')
|
58
|
+
puts "Packaging code for distribution..."
|
58
59
|
payload = Mandy::Packer.pack(file, options.payload || ARGV[0], gemfile(options.gemfile))
|
59
60
|
cmdenv = options.cmdenv
|
60
61
|
|
61
62
|
at_exit do
|
63
|
+
puts
|
62
64
|
puts "Cleaning up..."
|
63
65
|
Mandy::Packer.cleanup!(payload)
|
64
|
-
puts "
|
66
|
+
puts errors ? "Completed with errors!" : "Completed Successfully!"
|
65
67
|
end
|
66
68
|
|
67
69
|
puts "Loading Mandy scripts..."
|
68
70
|
require absolute_path(file)
|
69
71
|
|
70
72
|
output = nil
|
73
|
+
puts
|
71
74
|
begin
|
72
75
|
Mandy::Job.jobs.each_with_index do |job, i|
|
73
|
-
puts "
|
76
|
+
puts "Submitting Job: [#{i+1}] #{job.name}..."
|
74
77
|
|
75
78
|
jobconf = job.settings.map { |key, value| %(-D #{key}='#{value}') }.join(' ')
|
76
79
|
output = File.join(output_folder, "#{i+1}-#{job.name.downcase.gsub(/\W/, '-')}")
|
@@ -88,15 +91,28 @@ begin
|
|
88
91
|
#{ cmdenv.nil? ? '' : "-cmdenv #{cmdenv}" }\
|
89
92
|
-output "#{output}" 2>&1)
|
90
93
|
|
91
|
-
result =
|
92
|
-
|
93
|
-
|
94
|
+
result = []
|
95
|
+
IO.popen(command, 'r') do |subprocess|
|
96
|
+
while line = subprocess.gets
|
97
|
+
if line.include?('Running job:')
|
98
|
+
job_id = line.split(' ').last.strip
|
99
|
+
puts "Job ID: #{job_id}"
|
100
|
+
puts "Kill Command: mandy-kill #{job_id} -c #{config}"
|
101
|
+
end
|
102
|
+
puts "Tracking URL: #{line.split(' ').last.strip}" if line.include?('Tracking URL:')
|
103
|
+
result << line
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
raise(Mandy::HadoopJobFailure.new(job, result.join("\n"))) unless $?.to_i==0
|
108
|
+
puts
|
94
109
|
# puts "#{command}"
|
95
110
|
input = "-input #{output}"
|
96
111
|
end
|
97
112
|
# print out the output location so caller can know where to get the results from
|
98
113
|
puts output
|
99
114
|
rescue Mandy::HadoopJobFailure => e
|
115
|
+
errors = true
|
100
116
|
STDERR.puts e.to_s
|
101
117
|
exit(1)
|
102
118
|
end
|
data/bin/mandy-kill
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'optparse'
|
3
|
+
require 'ostruct'
|
4
|
+
|
5
|
+
exec('mandy-kill -h') unless ARGV.size >= 1
|
6
|
+
|
7
|
+
|
8
|
+
options = OpenStruct.new
|
9
|
+
|
10
|
+
OptionParser.new do |opts|
|
11
|
+
opts.banner = "USAGE: mandy-kill job [options]"
|
12
|
+
|
13
|
+
opts.on("-c", "--conf HADOOP_CONF", "Use this cluster xml config file.") do |config|
|
14
|
+
options.config = config
|
15
|
+
end
|
16
|
+
|
17
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
18
|
+
puts opts
|
19
|
+
exit
|
20
|
+
end
|
21
|
+
end.parse!
|
22
|
+
|
23
|
+
job = ARGV[0]
|
24
|
+
config = options.config || 'cluster.xml'
|
25
|
+
|
26
|
+
`$HADOOP_HOME/bin/hadoop job -conf #{config} -kill #{job}`
|
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.995
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Kent
|
@@ -27,6 +27,7 @@ description: Mandy is Ruby Map/Reduce Framework built onto of the Hadoop Distrib
|
|
27
27
|
email: andy.kent@me.com
|
28
28
|
executables:
|
29
29
|
- mandy
|
30
|
+
- mandy-kill
|
30
31
|
- mandy-hadoop
|
31
32
|
- mandy-local
|
32
33
|
- mandy-map
|
@@ -48,6 +49,7 @@ files:
|
|
48
49
|
- bin/mandy
|
49
50
|
- bin/mandy-hadoop
|
50
51
|
- bin/mandy-local
|
52
|
+
- bin/mandy-kill
|
51
53
|
- bin/mandy-map
|
52
54
|
- bin/mandy-put
|
53
55
|
- bin/mandy-get
|