Class: Swineherd::Script::WukongScript

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/swineherd/script/wukong_script.rb

Instance Attribute Summary

Attributes included from Common

#attributes, #input, #options, #output

Instance Method Summary collapse

Methods included from Common

#env, #initialize, #refresh!, #run

Instance Method Details

#cmdObject



18
19
20
21
22
# File 'lib/swineherd/script/wukong_script.rb', line 18

def cmd
  raise "No wukong input specified" if input.empty?
  Log.info("Launching Wukong script in hadoop mode")
  "ruby #{script} #{wukong_args(@options)} --run #{input.join(',')} #{output.join(',')}"
end

#local_cmdObject



24
25
26
27
28
# File 'lib/swineherd/script/wukong_script.rb', line 24

def local_cmd
  inputs = input.map{|path| path += File.directory?(path) ? "/*" : ""}.join(',')
  Log.info("Launching Wukong script in local mode")
  "ruby #{script} #{wukong_args(@options)} --run=local #{inputs} #{output.join(',')}"
end

#scriptObject

Don’t treat wukong scripts as templates



14
15
16
# File 'lib/swineherd/script/wukong_script.rb', line 14

def script
  @source
end

#wukong_args(options) ⇒ Object



7
8
9
# File 'lib/swineherd/script/wukong_script.rb', line 7

def wukong_args options
  options.map{|param,val| "--#{param}=#{val}" }.join(' ')
end