mandy 0.4.10 → 0.4.81
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/wrappers/mandy_wrapper.rb +5 -22
- metadata +1 -2
- data/lib/support/hdfs_location.rb +0 -13
@@ -6,16 +6,14 @@ module Mandy
|
|
6
6
|
@@config_path = file_path
|
7
7
|
end
|
8
8
|
|
9
|
-
def run_mandy(script,
|
9
|
+
def run_mandy(script, input_files, options = {})
|
10
10
|
begin
|
11
11
|
#doing this will load all the mandy jobs in memory which will be useful later on
|
12
12
|
require script
|
13
|
-
inputs = [inputs] unless inputs.is_a?(Array)
|
14
|
-
|
15
|
-
hdfs_input = inputs.all? {|i| i.is_a?(File)} ? process_files(inputs) : process_hdfs_locations(inputs)
|
16
|
-
|
17
|
-
run_mandy_hadoop(hdfs_input, script, options)
|
18
13
|
|
14
|
+
hdfs_path = "#{self.class.to_s.split('::').join('-').downcase}/#{SESSION_ID}"
|
15
|
+
put_files_on_hdfs(hdfs_path, input_files)
|
16
|
+
run_mandy_hadoop(hdfs_path, script, options)
|
19
17
|
output_file_path = get_file_from_hdfs(hdfs_path, options)
|
20
18
|
return output_file_path unless block_given?
|
21
19
|
#if a block is given then yield the output file path and then delete this file before returning
|
@@ -26,23 +24,8 @@ module Mandy
|
|
26
24
|
end
|
27
25
|
|
28
26
|
private
|
29
|
-
def process_files(input_files)
|
30
|
-
hdfs_path = "#{self.class.to_s.split('::').join('-').downcase}/#{SESSION_ID}"
|
31
|
-
put_files_on_hdfs(hdfs_path, input_files)
|
32
|
-
hdfs_path
|
33
|
-
end
|
34
|
-
|
35
|
-
def process_locations(input_locations)
|
36
|
-
return input_locations.first if input_locations.size == 1
|
37
|
-
|
38
|
-
hdfs_path = "#{self.class.to_s.split('::').join('-').downcase}/#{SESSION_ID}"
|
39
|
-
input_locations.each_with_index do |location, index|
|
40
|
-
run_command "mandy-cp #{location} #{hdfs_path}/input#{index}"
|
41
|
-
end
|
42
|
-
hdfs_path
|
43
|
-
end
|
44
|
-
|
45
27
|
def put_files_on_hdfs(hdfs_path, input_files)
|
28
|
+
input_files = [input_files] unless input_files.is_a?(Array)
|
46
29
|
input_files.each do |input_file|
|
47
30
|
input_file_path = input_file.is_a?(File) ? File.expand_path(input_file.path) : input_file
|
48
31
|
base_filename = input_file_path.split("/").last
|
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.81
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Kent
|
@@ -70,7 +70,6 @@ files:
|
|
70
70
|
- lib/support/tuple.rb
|
71
71
|
- lib/support/formatting.rb
|
72
72
|
- lib/support/array_serializer.rb
|
73
|
-
- lib/support/hdfs_location.rb
|
74
73
|
- lib/task.rb
|
75
74
|
- lib/dsl.rb
|
76
75
|
- lib/job.rb
|