Class: Rubadoop::MapReduce::CallStreaming

Inherits:
CallJava show all
Defined in:
lib/rubadoop/map_reduce/call_streaming.rb

Direct Known Subclasses

Emr::JobflowBuilder::Step::Streaming

Instance Attribute Summary collapse

Attributes inherited from CallJava

#archives, #args, #confs, #envs, #files, #jar, #main_class

Attributes inherited from BaseDsl

#params

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CallJava

#archive, #arg, #conf, #conf_concat, #env, #file, new_java_call

Methods inherited from BaseDsl

#has_param?, #optional_param

Constructor Details

#initialize(params = {}) ⇒ CallStreaming

Returns a new instance of CallStreaming.



20
21
22
# File 'lib/rubadoop/map_reduce/call_streaming.rb', line 20

def initialize(params = {})
  super(params)
end

Instance Attribute Details

#combinerObject

Returns the value of attribute combiner.



4
5
6
# File 'lib/rubadoop/map_reduce/call_streaming.rb', line 4

def combiner
  @combiner
end

#inputObject

Returns the value of attribute input.



4
5
6
# File 'lib/rubadoop/map_reduce/call_streaming.rb', line 4

def input
  @input
end

#inputformatObject

Returns the value of attribute inputformat.



4
5
6
# File 'lib/rubadoop/map_reduce/call_streaming.rb', line 4

def inputformat
  @inputformat
end

#mapperObject

Returns the value of attribute mapper.



4
5
6
# File 'lib/rubadoop/map_reduce/call_streaming.rb', line 4

def mapper
  @mapper
end

#outputObject

Returns the value of attribute output.



4
5
6
# File 'lib/rubadoop/map_reduce/call_streaming.rb', line 4

def output
  @output
end

#outputformatObject

Returns the value of attribute outputformat.



4
5
6
# File 'lib/rubadoop/map_reduce/call_streaming.rb', line 4

def outputformat
  @outputformat
end

#reducerObject

Returns the value of attribute reducer.



4
5
6
# File 'lib/rubadoop/map_reduce/call_streaming.rb', line 4

def reducer
  @reducer
end

Class Method Details

.new_streaming_call(params = {}, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rubadoop/map_reduce/call_streaming.rb', line 7

def new_streaming_call(params = {}, &block)
  builder = CallStreaming.new(params)
  if block_given?
    if block.arity == 1
      yield builder
    else
      builder.instance_eval &block
    end
  end
  builder
end

Instance Method Details

#to_hObject



37
38
39
40
41
42
43
44
# File 'lib/rubadoop/map_reduce/call_streaming.rb', line 37

def to_h
  built = super
  [:@mapper, :@reducer, :@combiner, :@inputformat, :@input, :@outputformat, :@output].each { |entry|
    value = instance_variable_get(entry)
    built[entry.to_s.delete("@").to_sym] = value unless value.nil?
  }
  built
end

#to_hadoop_cli(opts = {}) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rubadoop/map_reduce/call_streaming.rb', line 24

def to_hadoop_cli(opts = {})
  cmd = super(opts.merge(skip_args: true))
  cmd.concat ['-inputformat', "#{@inputformat}"] if @inputformat
  cmd.concat ['-input', "#{@input}"] if @input
  cmd.concat ['-outputformat', "#{@outputformat}"] if @outputformat
  cmd.concat ['-output', "#{@output}"] if @output
  cmd.concat ['-mapper', "#{@mapper}"] if @mapper
  cmd.concat ['-reducer', "#{@reducer}"] if @reducer
  cmd.concat ['-combiner', "#{@combiner}"] if @combiner
  cmd.concat @args if @args
  cmd
end

#validateObject



46
47
48
49
50
51
# File 'lib/rubadoop/map_reduce/call_streaming.rb', line 46

def validate
  super
  [:@mapper, :@reducer, :@input, :@output].each { |property|
    raise "Missing #{property}" if instance_variable_get(property).nil?
  }
end