Class: Fairy::CSegShuffle

Inherits:
CIOFilter show all
Defined in:
lib/fairy/master/c-seg-shuffle.rb

Defined Under Namespace

Classes: PortQueue

Instance Attribute Summary

Attributes inherited from CIOFilter

#input

Attributes included from CInputtable

#input

Instance Method Summary collapse

Methods inherited from CIOFilter

#node_class, #output=

Methods included from CInputtable

#break_running, #inputtable?

Methods inherited from CFilter

#abort_create_node, #add_node, #assgin_number_of_nodes?, #bind_export, #break_create_node, #break_running, #create_and_add_node, #create_import, #create_node, #create_nodes, #def_job_pool_variable, #each_export_by, #each_node, #each_node_exist_only, #handle_exception, #input, #job_pool_dict, #job_pool_variable, #nodes, #number_of_nodes, #number_of_nodes=, #pool_dict, #postmapping_policy, #start_create_nodes, #start_export, #start_watch_node_status, #update_status, watch_status, watch_status=, #watch_status?

Constructor Details

#initialize(controller, opts, block_source) ⇒ CSegShuffle

include BInputtable



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/fairy/master/c-seg-shuffle.rb', line 15

def initialize(controller, opts, block_source)
  super
#      @block = @context.create_proc(@block_source.source)

  @node2input = {}
  @input2node = {}
  @input_queue = PortQueue.new
  @output_queue = PortQueue.new

  @block_source = block_source
  @begin_block_source = nil
  if @opts[:BEGIN]
	@begin_block_source = @opts[:BEGIN]
  end
  @end_block_source = nil
  if @opts[:END]
	@end_block_source = @opts[:END]
  end

end

Instance Method Details

#each_assigned_filter(&block) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/fairy/master/c-seg-shuffle.rb', line 44

def each_assigned_filter(&block)
  each_node do |node|
	@input_queue.push node
  end
  @input_queue.push nil

  if @begin_block_source
	bsource = BScript.new(@begin_block_source, @context, self)
	bsource.evaluate
  end
  @block = BBlock.new(@block_source, @context, self)
  begin
	@block.call(@input_queue, @output_queue)
	@output_queue.push nil
  ensure
	if @end_block_source
	  bsource = BSource.new(@end_block_source, @context, self)
	  bsource.evaluate
	end
  end

  no = 0
  @output_queue.each do |node|
	node.no = no
	no += 1
	block.call node
  end
end

#njob_creation_paramsObject



40
41
42
# File 'lib/fairy/master/c-seg-shuffle.rb', line 40

def njob_creation_params
  []
end

#node_class_nameObject



36
37
38
# File 'lib/fairy/master/c-seg-shuffle.rb', line 36

def node_class_name
  "PIdentity"
end