Module: Wukong::LocalCommand

Included in:
Script
Defined in:
lib/wukong/script/local_command.rb

Overview

Local execution Options

Instance Method Summary collapse

Instance Method Details

#execute_local_workflowObject



7
8
9
10
# File 'lib/wukong/script/local_command.rb', line 7

def execute_local_workflow
  Log.info "  Reading STDIN / Writing STDOUT"
  execute_command!(local_commandline)
end

#local_commandlineObject

Commandline string to execute the job in local mode

With an input path of ‘-’, just uses $stdin With an output path of ‘-’, just uses $stdout



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/wukong/script/local_command.rb', line 24

def local_commandline
  @input_paths = input_paths.map(&:strip).join(' ')
  cmd_input_str  = (input_paths == '-') ? "" : "cat '#{input_paths}' | "
  cmd_output_str = (output_path == '-') ? "" : "> '#{output_path}'"

  if (reducer || options[:reduce_command])
    %Q{ #{cmd_input_str} #{mapper_commandline} | #{local_mode_sort_commandline} | #{reducer_commandline} #{cmd_output_str} }
  else
    %Q{ #{cmd_input_str} #{mapper_commandline} | #{local_mode_sort_commandline} #{cmd_output_str} }
  end

end

#local_mode_sort_commandlineObject

program, including arg, to sort input between mapper and reducer in local mode. You could override to for example run ‘sort -n’ (numeric sort).



14
15
16
# File 'lib/wukong/script/local_command.rb', line 14

def local_mode_sort_commandline
  'sort'
end