lib/wukong/script/local_command.rb in wukong-1.4.2 vs lib/wukong/script/local_command.rb in wukong-1.4.5

- old
+ new

@@ -4,11 +4,19 @@ # =========================================================================== # # Local execution Options # + # 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 sort_command + 'sort' + end + def local_command input_path, output_path - %Q{ cat #{input_path} | #{map_command} | sort | #{reduce_command} > '#{output_path}'} + cmd_input_str = (input_path == '-') ? "" : "cat '#{input_path}' | " + cmd_output_str = (output_path == '-') ? "" : "> '#{output_path}'" + %Q{ #{cmd_input_str} #{map_command} | #{sort_command} | #{reduce_command} #{cmd_output_str} } end end end