Class: Fairy::PSort::PPostSort
- Inherits:
-
Fairy::PSingleExportFilter
- Object
- Fairy::PFilter
- Fairy::PIOFilter
- Fairy::PSingleExportFilter
- Fairy::PSort::PPostSort
- Defined in:
- lib/fairy/node/p-sort.rb
Constant Summary
Constants included from Fairy::PSingleExportable
Fairy::PSingleExportable::END_OF_STREAM, Fairy::PSingleExportable::ST_EXPORT_FINISH, Fairy::PSingleExportable::ST_WAIT_EXPORT_FINISH
Constants inherited from Fairy::PIOFilter
Fairy::PIOFilter::ST_WAIT_IMPORT
Constants inherited from Fairy::PFilter
Fairy::PFilter::END_OF_STREAM, Fairy::PFilter::ST_ACTIVATE, Fairy::PFilter::ST_FINISH, Fairy::PFilter::ST_INIT
Instance Attribute Summary
Attributes included from Fairy::PSingleExportable
Attributes inherited from Fairy::PFilter
#IGNORE_EXCEPTION, #id, #log_id, #ntask
Instance Method Summary collapse
- #basic_each(&block) ⇒ Object
- #hash_key(e) ⇒ Object
-
#initialize(id, ntask, bjob, opts, block_source) ⇒ PPostSort
constructor
A new instance of PPostSort.
Methods included from Fairy::PSingleExportable
#start, #start_export, #terminate, #wait_export_finish
Methods inherited from Fairy::PIOFilter
Methods inherited from Fairy::PFilter
#abort_running, #basic_start, #break_running, #each, #global_break, #global_break_from_other, #handle_exception, #key, #key=, #next, #no, #no=, #notice_status, #processor, #start, #start_export, #start_watch_status, #status=, #terminate, #terminate_proc
Constructor Details
#initialize(id, ntask, bjob, opts, block_source) ⇒ PPostSort
Returns a new instance of PPostSort.
156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/fairy/node/p-sort.rb', line 156 def initialize(id, ntask, bjob, opts, block_source) super @block_source = block_source @buffering_policy = @opts[:buffering_policy] @buffering_policy ||= CONF.SORT_BUFFERING_POLICY unless CONF.BUG234 @cmp_optimize = CONF.SORT_CMP_OPTIMIZE @cmp_optimize = opts[:cmp_optimize] if opts.key?(:cmp_optimize) end end |
Instance Method Details
#basic_each(&block) ⇒ Object
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/fairy/node/p-sort.rb', line 169 def basic_each(&block) @key_value_buffer = eval("#{@buffering_policy[:buffering_class]}").new(self, @buffering_policy) if @cmp_optimize @hash_proc = eval("proc{#{@block_source.source}}") else @hash_proc = BBlock.new(@block_source, @context, self) end @input.each do |e| @key_value_buffer.push(e) e = nil end @key_value_buffer.each do |values| values.each(&block) end @key_value_buffer = nil end |
#hash_key(e) ⇒ Object
188 189 190 |
# File 'lib/fairy/node/p-sort.rb', line 188 def hash_key(e) @hash_proc.yield(e) end |