Sha256: ee5a4d1cabffa37ddd7934641f4768656f0038082bd79ba19c61eb3c314204a9

Contents?: true

Size: 974 Bytes

Versions: 6

Compression:

Stored size: 974 Bytes

Contents

module Wukong
  #
  # Local execution Options
  #
  module LocalCommand

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

    # program, including arg, to sort input between mapper and reducer in local
    # mode. You could override to for example run 'sort -n' (numeric sort).
    def local_mode_sort_commandline
      'sort'
    end

    #
    # 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
    #
    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}'"
      %Q{ #{cmd_input_str} #{mapper_commandline} | #{local_mode_sort_commandline} | #{reducer_commandline} #{cmd_output_str} }
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wukong-2.0.0 lib/wukong/script/local_command.rb
wukong-1.5.4 lib/wukong/script/local_command.rb
wukong-1.5.3 lib/wukong/script/local_command.rb
wukong-1.5.2 lib/wukong/script/local_command.rb
wukong-1.5.1 lib/wukong/script/local_command.rb
wukong-1.5.0 lib/wukong/script/local_command.rb