fairy 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. data/LICENSE +674 -0
  2. data/Makefile +116 -0
  3. data/README +15 -0
  4. data/bin/fairy +582 -0
  5. data/bin/fairy-cat +74 -0
  6. data/bin/fairy-cp +128 -0
  7. data/bin/fairy-rm +122 -0
  8. data/bin/subcmd/controller +41 -0
  9. data/bin/subcmd/inspector +81 -0
  10. data/bin/subcmd/master +43 -0
  11. data/bin/subcmd/node +47 -0
  12. data/bin/subcmd/processor +54 -0
  13. data/doc/programming-interface.html +240 -0
  14. data/doc/programming-interface.rd +300 -0
  15. data/etc/fairy.conf.tmpl +118 -0
  16. data/ext/simple_hash/extconf.rb +4 -0
  17. data/ext/simple_hash/simple_hash.c +42 -0
  18. data/fairy.gemspec +60 -0
  19. data/lib/fairy/client/addins.rb +20 -0
  20. data/lib/fairy/client/barrier.rb +29 -0
  21. data/lib/fairy/client/basic-group-by.rb +52 -0
  22. data/lib/fairy/client/cat.rb +41 -0
  23. data/lib/fairy/client/direct-product.rb +51 -0
  24. data/lib/fairy/client/equijoin.rb +79 -0
  25. data/lib/fairy/client/exec.rb +54 -0
  26. data/lib/fairy/client/filter.rb +62 -0
  27. data/lib/fairy/client/find.rb +35 -0
  28. data/lib/fairy/client/group-by.rb +194 -0
  29. data/lib/fairy/client/here.rb +84 -0
  30. data/lib/fairy/client/inject.rb +70 -0
  31. data/lib/fairy/client/input-file.rb +53 -0
  32. data/lib/fairy/client/input-iota.rb +49 -0
  33. data/lib/fairy/client/input-local-file.rb +188 -0
  34. data/lib/fairy/client/input-varray.rb +30 -0
  35. data/lib/fairy/client/input.rb +42 -0
  36. data/lib/fairy/client/io-filter.rb +26 -0
  37. data/lib/fairy/client/junction.rb +31 -0
  38. data/lib/fairy/client/map.rb +34 -0
  39. data/lib/fairy/client/merge-group-by.rb +71 -0
  40. data/lib/fairy/client/output-file.rb +64 -0
  41. data/lib/fairy/client/output-local-file.rb +60 -0
  42. data/lib/fairy/client/output-null.rb +47 -0
  43. data/lib/fairy/client/output-varray.rb +50 -0
  44. data/lib/fairy/client/output.rb +29 -0
  45. data/lib/fairy/client/roma-put.rb +62 -0
  46. data/lib/fairy/client/roma.rb +156 -0
  47. data/lib/fairy/client/seg-join.rb +61 -0
  48. data/lib/fairy/client/seg-map.rb +78 -0
  49. data/lib/fairy/client/seg-shuffle.rb +35 -0
  50. data/lib/fairy/client/seg-split.rb +27 -0
  51. data/lib/fairy/client/seg-zip.rb +60 -0
  52. data/lib/fairy/client/select.rb +38 -0
  53. data/lib/fairy/client/sort.rb +48 -0
  54. data/lib/fairy/client/sort18.rb +56 -0
  55. data/lib/fairy/client/sort19.rb +61 -0
  56. data/lib/fairy/client/there.rb +47 -0
  57. data/lib/fairy/client/top_n_into_roma.rb +34 -0
  58. data/lib/fairy/client/wc.rb +92 -0
  59. data/lib/fairy/controller.rb +1103 -0
  60. data/lib/fairy/logger.rb +107 -0
  61. data/lib/fairy/master/addins.rb +20 -0
  62. data/lib/fairy/master/atom.rb +17 -0
  63. data/lib/fairy/master/c-barrier.rb +283 -0
  64. data/lib/fairy/master/c-basic-group-by.rb +250 -0
  65. data/lib/fairy/master/c-cat.rb +159 -0
  66. data/lib/fairy/master/c-direct-product.rb +203 -0
  67. data/lib/fairy/master/c-exec.rb +68 -0
  68. data/lib/fairy/master/c-filter.rb +422 -0
  69. data/lib/fairy/master/c-find.rb +138 -0
  70. data/lib/fairy/master/c-group-by.rb +64 -0
  71. data/lib/fairy/master/c-here.rb +80 -0
  72. data/lib/fairy/master/c-inject.rb +119 -0
  73. data/lib/fairy/master/c-input-file.rb +46 -0
  74. data/lib/fairy/master/c-input-iota.rb +66 -0
  75. data/lib/fairy/master/c-input-local-file.rb +117 -0
  76. data/lib/fairy/master/c-input-varray.rb +53 -0
  77. data/lib/fairy/master/c-input.rb +24 -0
  78. data/lib/fairy/master/c-inputtable.rb +31 -0
  79. data/lib/fairy/master/c-inputtable18.rb +36 -0
  80. data/lib/fairy/master/c-inputtable19.rb +35 -0
  81. data/lib/fairy/master/c-io-filter.rb +28 -0
  82. data/lib/fairy/master/c-junction.rb +54 -0
  83. data/lib/fairy/master/c-map.rb +27 -0
  84. data/lib/fairy/master/c-merge-group-by.rb +241 -0
  85. data/lib/fairy/master/c-output-file.rb +84 -0
  86. data/lib/fairy/master/c-output-local-file.rb +19 -0
  87. data/lib/fairy/master/c-output-null.rb +45 -0
  88. data/lib/fairy/master/c-output-varray.rb +57 -0
  89. data/lib/fairy/master/c-output.rb +20 -0
  90. data/lib/fairy/master/c-seg-join.rb +141 -0
  91. data/lib/fairy/master/c-seg-map.rb +26 -0
  92. data/lib/fairy/master/c-seg-shuffle.rb +87 -0
  93. data/lib/fairy/master/c-seg-split.rb +110 -0
  94. data/lib/fairy/master/c-seg-zip.rb +132 -0
  95. data/lib/fairy/master/c-select.rb +27 -0
  96. data/lib/fairy/master/c-sort.rb +108 -0
  97. data/lib/fairy/master/c-there.rb +57 -0
  98. data/lib/fairy/master/c-wc.rb +232 -0
  99. data/lib/fairy/master/job-interpriter.rb +19 -0
  100. data/lib/fairy/master/scheduler.rb +24 -0
  101. data/lib/fairy/master.rb +329 -0
  102. data/lib/fairy/node/addins.rb +19 -0
  103. data/lib/fairy/node/p-barrier.rb +95 -0
  104. data/lib/fairy/node/p-basic-group-by.rb +252 -0
  105. data/lib/fairy/node/p-direct-product.rb +153 -0
  106. data/lib/fairy/node/p-exec.rb +30 -0
  107. data/lib/fairy/node/p-filter.rb +363 -0
  108. data/lib/fairy/node/p-find.rb +111 -0
  109. data/lib/fairy/node/p-group-by.rb +1534 -0
  110. data/lib/fairy/node/p-here.rb +21 -0
  111. data/lib/fairy/node/p-identity.rb +24 -0
  112. data/lib/fairy/node/p-inject.rb +127 -0
  113. data/lib/fairy/node/p-input-file.rb +108 -0
  114. data/lib/fairy/node/p-input-iota.rb +39 -0
  115. data/lib/fairy/node/p-input-local-file.rb +61 -0
  116. data/lib/fairy/node/p-input-varray.rb +26 -0
  117. data/lib/fairy/node/p-io-filter.rb +28 -0
  118. data/lib/fairy/node/p-map.rb +40 -0
  119. data/lib/fairy/node/p-merger-group-by.rb +48 -0
  120. data/lib/fairy/node/p-output-file.rb +104 -0
  121. data/lib/fairy/node/p-output-local-file.rb +14 -0
  122. data/lib/fairy/node/p-output-null.rb +32 -0
  123. data/lib/fairy/node/p-output-varray.rb +41 -0
  124. data/lib/fairy/node/p-seg-join.rb +82 -0
  125. data/lib/fairy/node/p-seg-map.rb +34 -0
  126. data/lib/fairy/node/p-seg-split.rb +61 -0
  127. data/lib/fairy/node/p-seg-zip.rb +79 -0
  128. data/lib/fairy/node/p-select.rb +40 -0
  129. data/lib/fairy/node/p-single-exportable.rb +90 -0
  130. data/lib/fairy/node/p-sort.rb +195 -0
  131. data/lib/fairy/node/p-task.rb +113 -0
  132. data/lib/fairy/node/p-there.rb +44 -0
  133. data/lib/fairy/node/p-wc.rb +266 -0
  134. data/lib/fairy/node.rb +187 -0
  135. data/lib/fairy/processor.rb +510 -0
  136. data/lib/fairy/share/base-app.rb +114 -0
  137. data/lib/fairy/share/block-source.rb +234 -0
  138. data/lib/fairy/share/conf.rb +396 -0
  139. data/lib/fairy/share/debug.rb +21 -0
  140. data/lib/fairy/share/encoding.rb +17 -0
  141. data/lib/fairy/share/fast-tempfile.rb +93 -0
  142. data/lib/fairy/share/file-place.rb +176 -0
  143. data/lib/fairy/share/hash-1.rb +20 -0
  144. data/lib/fairy/share/hash-md5.rb +28 -0
  145. data/lib/fairy/share/hash-murmur.rb +69 -0
  146. data/lib/fairy/share/hash-rb18.rb +20 -0
  147. data/lib/fairy/share/hash-simple-hash.rb +28 -0
  148. data/lib/fairy/share/inspector.rb +16 -0
  149. data/lib/fairy/share/lc/exceptions.rb +82 -0
  150. data/lib/fairy/share/lc/ja/exceptions.rb +81 -0
  151. data/lib/fairy/share/locale.rb +17 -0
  152. data/lib/fairy/share/log.rb +215 -0
  153. data/lib/fairy/share/pool-dictionary.rb +53 -0
  154. data/lib/fairy/share/port-marshaled-queue.rb +347 -0
  155. data/lib/fairy/share/port.rb +1697 -0
  156. data/lib/fairy/share/reference.rb +45 -0
  157. data/lib/fairy/share/stdout.rb +56 -0
  158. data/lib/fairy/share/tr.rb +16 -0
  159. data/lib/fairy/share/varray.rb +147 -0
  160. data/lib/fairy/share/vfile.rb +183 -0
  161. data/lib/fairy/version.rb +8 -0
  162. data/lib/fairy.rb +206 -0
  163. data/sample/grep.rb +46 -0
  164. data/sample/ping.rb +19 -0
  165. data/sample/sort.rb +102 -0
  166. data/sample/wordcount.rb +61 -0
  167. data/spec/README +12 -0
  168. data/spec/fairy1_spec.rb +31 -0
  169. data/spec/fairy2_spec.rb +42 -0
  170. data/spec/fairy3_spec.rb +126 -0
  171. data/spec/fairy4_spec.rb +63 -0
  172. data/spec/fairy5_spec.rb +45 -0
  173. data/spec/fairy6_spec.rb +52 -0
  174. data/spec/fairy7_spec.rb +58 -0
  175. data/spec/fairy8_spec.rb +48 -0
  176. data/spec/mkdat.rb +148 -0
  177. data/spec/run_all.sh +65 -0
  178. data/test/testc.rb +7111 -0
  179. data/tools/cap_recipe/Capfile +144 -0
  180. data/tools/cap_recipe/cluster.yml.sample +14 -0
  181. data/tools/fairy_perf_graph.rb +444 -0
  182. data/tools/git-tag +44 -0
  183. data/tools/log-analysis.rb +62 -0
  184. data/tools/svn-ls-diff +38 -0
  185. data/tools/svn-tags +37 -0
  186. metadata +298 -0
@@ -0,0 +1,40 @@
1
+ # encoding: UTF-8
2
+ #
3
+ # Copyright (C) 2007-2010 Rakuten, Inc.
4
+ #
5
+
6
+ require "fairy/node/p-io-filter"
7
+ require "fairy/node/p-single-exportable"
8
+
9
+ module Fairy
10
+ class PSelect<PSingleExportFilter
11
+ Processor.def_export self
12
+
13
+ def initialize(id, ntask, bjob, opts, block_source)
14
+ super
15
+ @block_source = block_source
16
+ end
17
+
18
+ # def start
19
+ # super do
20
+ # @map_proc = BBlock.new(@block_source, @context, self)
21
+ # @import.each do |e|
22
+ # if @map_proc.yield(e)
23
+ # @export.push e
24
+ # end
25
+ # end
26
+ # end
27
+ # end
28
+
29
+ def basic_each(&block)
30
+ @map_proc = BBlock.new(@block_source, @context, self)
31
+ @input.each do |e|
32
+ # if !(v = @map_proc.yield(e)) || v.kind_of?(Import::CTLTOKEN_NULLVALUE)
33
+ if !(v = @map_proc.yield(e)) || Import::CTLTOKEN_NULLVALUE === v
34
+ next
35
+ end
36
+ block.call e
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,90 @@
1
+ # encoding: UTF-8
2
+ #
3
+ # Copyright (C) 2007-2010 Rakuten, Inc.
4
+ #
5
+
6
+ require "fairy/node/p-io-filter"
7
+
8
+ module Fairy
9
+ module PSingleExportable
10
+ include Enumerable
11
+
12
+ END_OF_STREAM = PFilter::END_OF_STREAM
13
+
14
+ ST_WAIT_EXPORT_FINISH = :ST_WAIT_EXPORT_FINISH
15
+ ST_EXPORT_FINISH = :ST_EXPORT_FINISH
16
+
17
+ def initialize(id, ntask, bjob, opts=nil, *rests)
18
+ super
19
+ end
20
+
21
+ attr_reader :export
22
+
23
+ # def no=(no)
24
+ # super
25
+ # @export.no = no
26
+ # end
27
+
28
+ # とりあえず
29
+ # def start(&block)
30
+ # super do
31
+ # begin
32
+ # if @import
33
+ # @export.add_key(@import.key)
34
+ # end
35
+ # block.call
36
+ # ensure
37
+ # @export.push END_OF_STREAM
38
+ # wait_export_finish
39
+ # end
40
+ # end
41
+ # end
42
+
43
+ def start_export
44
+ Log::debug(self, "START_EXPORT")
45
+
46
+ policy = @opts[:postqueuing_policy]
47
+ @export = Export.new(policy)
48
+ @export.njob_id = @id
49
+ @export.no = @no
50
+ @export.key = @key
51
+
52
+ start do
53
+ each{|e| @export.push e}
54
+ @export.push END_OF_STREAM
55
+ end
56
+
57
+ @export
58
+ end
59
+
60
+ def start(&block)
61
+ super do
62
+ begin
63
+ block.call
64
+ ensure
65
+ # @export.push END_OF_STREAM
66
+ end
67
+ end
68
+ end
69
+
70
+ def terminate
71
+ @wait_cv = @terminate_mon.new_cv
72
+ wait_export_finish
73
+ super
74
+ end
75
+
76
+ def wait_export_finish
77
+ self.status = ST_WAIT_EXPORT_FINISH
78
+ @export.fib_wait_finish(@wait_cv)
79
+ self.status = ST_EXPORT_FINISH
80
+ end
81
+ end
82
+
83
+ class PSingleExportFilter<PIOFilter
84
+ include PSingleExportable
85
+ end
86
+
87
+ class PSingleExportInput<PIOFilter
88
+ include PSingleExportable
89
+ end
90
+ end
@@ -0,0 +1,195 @@
1
+ # encoding: UTF-8
2
+ #
3
+ # Copyright (C) 2007-2010 Rakuten, Inc.
4
+ #
5
+
6
+ require "fairy/node/p-io-filter"
7
+ require "fairy/node/p-basic-group-by"
8
+
9
+ module Fairy
10
+ module PSort
11
+ class PPreSort<PBasicGroupBy
12
+ Processor.def_export self
13
+
14
+ ST_ALL_IMPORTED = :ST_ALL_IMPORTED
15
+ ST_WAIT_EXPORT_FINISH = :ST_WAIT_EXPORT_FINISH
16
+ ST_EXPORT_FINISH = :ST_EXPORT_FINISH
17
+
18
+ def initialize(id, ntask, bjob, opts, block_source)
19
+ super
20
+ @block_source = block_source
21
+
22
+ @exports = []
23
+ def @exports.each_pair(&block)
24
+ each_with_index do |item, idx|
25
+ block.call(idx, item) if item
26
+ end
27
+ end
28
+ @exports_queue = Queue.new
29
+
30
+ @counter = []
31
+
32
+ @pvs = nil
33
+ if @opts[:pvs]
34
+ @pvs = @opts[:pvs].dc_deep_copy
35
+ end
36
+
37
+ #start_watch_exports
38
+ end
39
+
40
+ def add_export(key, export)
41
+ @exports[key] = export
42
+ # @exports_queue.push [key, export]
43
+ # [BUG#171]同期処理でないとまずい.
44
+ @bjob.add_exports(key, export, self)
45
+ end
46
+
47
+ def start_export
48
+ Log::debug(self, "START_EXPORT")
49
+
50
+ start do
51
+ sample_line_no = @opts[:sampling_max]
52
+ sample_line_no ||= CONF.SORT_SAMPLING_MAX
53
+
54
+ hash_opt = @opts[:cmp_optimize]
55
+ hash_opt = CONF.SORT_CMP_OPTIMIZE if hash_opt.nil?
56
+
57
+ if hash_opt
58
+ @key_proc = eval("proc{#{@block_source.source}}", @context.binding)
59
+ else
60
+ @key_proc = BBlock.new(@block_source, @context, self)
61
+ end
62
+
63
+ buf = []
64
+ no = 0
65
+ begin
66
+ if @pvs
67
+ sampling = false
68
+ Log::debugf(self, "%s", @pvs.inspect)
69
+ init_exports
70
+ elsif self.no == 0
71
+ sampling = true
72
+ else
73
+ sampling = false
74
+ @pvs = @bjob.get_pvs
75
+ Log::debugf(self, "%s", @pvs.inspect)
76
+ init_exports
77
+ end
78
+
79
+ @input.each do |e|
80
+ if sampling
81
+ no += 1
82
+ buf.push e
83
+ if no >= sample_line_no
84
+ sampling = false
85
+ @pvs = @bjob.get_pvs(buf)
86
+ Log::debugf(self, "%s", @pvs.inspect)
87
+ init_exports
88
+ buf.each{|e| hashing(e)}
89
+ end
90
+ else
91
+ hashing(e)
92
+ end
93
+ end
94
+ if sampling
95
+ @pvs = @bjob.get_pvs(buf)
96
+ Log::debugf(self, "%s", @pvs.inspect)
97
+ init_exports
98
+ buf.each{|e| hashing(e)}
99
+ end
100
+ rescue
101
+ Log::debug_exception(self)
102
+ raise
103
+ ensure
104
+ @exports_queue.push nil
105
+ @exports.each_pair do |key, export|
106
+ next unless export
107
+ Log::debug(self, "G0 #{key} => #{@counter[key]}")
108
+ export.push END_OF_STREAM
109
+ end
110
+ end
111
+ end
112
+ end
113
+
114
+ def init_exports
115
+ policy = @opts[:postqueuing_policy]
116
+ (@pvs.size+1).times do |idx|
117
+ export = Export.new(policy)
118
+ @exports[idx] = export
119
+
120
+ export.njob_id = @id
121
+ export.no = idx
122
+ export.add_key(idx)
123
+ add_export(idx, export)
124
+ @counter[idx] = 0
125
+ end
126
+ end
127
+
128
+ def hashing(e)
129
+ if Import::CTLTOKEN_NULLVALUE === (key = @key_proc.call(e))
130
+ return
131
+ end
132
+
133
+ unless idx = @pvs.find_index{|pv| key < @key_proc.call(pv)}
134
+ idx = @pvs.size
135
+ end
136
+
137
+ #Log::debug(self, "#{@pvs.inspect}")
138
+ #Log::debug(self, "#{idx}")
139
+
140
+
141
+ export = @exports[idx]
142
+ export.push e
143
+ @counter[idx] += 1
144
+ end
145
+
146
+ def hash_key(e)
147
+ @key_proc.yield(e)
148
+ end
149
+ end
150
+
151
+ class PPostSort<PSingleExportFilter
152
+ Processor.def_export self
153
+
154
+ def initialize(id, ntask, bjob, opts, block_source)
155
+ super
156
+ @block_source = block_source
157
+
158
+ @buffering_policy = @opts[:buffering_policy]
159
+ @buffering_policy ||= CONF.SORT_BUFFERING_POLICY
160
+
161
+ unless CONF.BUG234
162
+ @cmp_optimize = CONF.SORT_CMP_OPTIMIZE
163
+ @cmp_optimize = opts[:cmp_optimize] if opts.key?(:cmp_optimize)
164
+ end
165
+ end
166
+
167
+ def basic_each(&block)
168
+ @key_value_buffer =
169
+ eval("#{@buffering_policy[:buffering_class]}").new(self, @buffering_policy)
170
+ if @cmp_optimize
171
+ @hash_proc = eval("proc{#{@block_source.source}}")
172
+ else
173
+ @hash_proc = BBlock.new(@block_source, @context, self)
174
+ end
175
+
176
+ @input.each do |e|
177
+ @key_value_buffer.push(e)
178
+ e = nil
179
+ end
180
+ @key_value_buffer.each do |values|
181
+ values.each(&block)
182
+ end
183
+ @key_value_buffer = nil
184
+ end
185
+
186
+ def hash_key(e)
187
+ @hash_proc.yield(e)
188
+ end
189
+ end
190
+
191
+
192
+ end
193
+ end
194
+
195
+
@@ -0,0 +1,113 @@
1
+ # encoding: UTF-8
2
+ #
3
+ # Copyright (C) 2007-2010 Rakuten, Inc.
4
+ #
5
+
6
+ module Fairy
7
+ class PTask
8
+ Processor.def_export self
9
+
10
+ END_OF_STREAM = :END_OF_STREAM
11
+
12
+ ST_INIT = :ST_INIT
13
+ ST_ACTIVATE = :ST_ACTIVATE
14
+ ST_FINISH = :ST_FINISH
15
+
16
+ def initialize(id, processor)
17
+ @id = id
18
+ Log::info self, "CREATE PTask"
19
+
20
+ @processor = processor
21
+
22
+ @njobs = []
23
+ @njob_seq = -1
24
+ @njob_seq_mutex = Mutex.new
25
+
26
+ @status = ST_INIT
27
+ @status_mon = processor.njob_mon
28
+ @status_cv = @status_mon.new_cv
29
+
30
+ start_watch_status
31
+ end
32
+
33
+ attr_reader :processor
34
+
35
+ def log_id
36
+ "PTask[#{@id}]"
37
+ end
38
+
39
+ #
40
+ # njob methods
41
+ #
42
+ def njob_next_id
43
+ @njob_seq_mutex.synchronize do
44
+ @njob_seq += 1
45
+
46
+ format("%02d-%02d", @id, @njob_seq)
47
+ end
48
+ end
49
+
50
+ def create_njob(njob_class_name, bjob, opts, *rests)
51
+ klass = @processor.import(njob_class_name)
52
+ #Log::debugf(self, "KKKKKKKKKKLAS: %s", klass)
53
+ njob = klass.new(njob_next_id, self, bjob, opts, *rests)
54
+ @njobs.push njob
55
+ Log.debugf(self, "Njob number of %d", @njobs.size)
56
+ njob
57
+ end
58
+ DeepConnect.def_method_spec(self, "REF create_njob(VAL, REF, VAL, *DEFAULT)")
59
+
60
+ def abort_running
61
+ @status_mon.synchronize do
62
+ @njobs.last.abort_running unless [ST_INIT, ST_FINISH].include?(@status)
63
+ end
64
+ end
65
+
66
+ #
67
+ # status methods.
68
+ #
69
+ def status=(val)
70
+ @status_mon.synchronize do
71
+ @status = val
72
+ @status_cv.broadcast
73
+ end
74
+ end
75
+
76
+ def start_watch_status
77
+ # 初期状態通知
78
+ notice_status(@status)
79
+
80
+ @processor.njob_mon.entry do
81
+ @status_mon.synchronize do
82
+ old_status = nil
83
+ loop do
84
+ @status_cv.wait_while{old_status == @status}
85
+ old_status = @status
86
+ notice_status(@status)
87
+ break if @status == ST_FINISH
88
+ end
89
+ end
90
+ end
91
+ nil
92
+ end
93
+
94
+ def update_status(node, st)
95
+ self.status = st
96
+ end
97
+
98
+ def notice_status(st)
99
+ # @status_mon.entry do
100
+ @processor.update_status(self, st)
101
+ # end
102
+ end
103
+
104
+ def to_s
105
+ "#<#{self.class}:##{@id} #{@njobs.collect{|f| f.class.to_s}.join('-').gsub(/Fairy::/, "")}>"
106
+ end
107
+
108
+ end
109
+ end
110
+
111
+
112
+
113
+
@@ -0,0 +1,44 @@
1
+ # encoding: UTF-8
2
+ #
3
+ # Copyright (C) 2007-2010 Rakuten, Inc.
4
+ #
5
+
6
+ require "fairy/node/p-filter"
7
+ require "fairy/node/p-single-exportable"
8
+
9
+ module Fairy
10
+ class PThere<PFilter
11
+ Processor.def_export self
12
+
13
+ include PSingleExportable
14
+
15
+ def initialize(id, ntask, bjob, opts)
16
+ super
17
+ end
18
+
19
+ def open(nthere_place)
20
+ self.no = nthere_place.no
21
+ @enumerable = nthere_place.enumerable
22
+ end
23
+
24
+ def basic_each(&block)
25
+ @enumerable.each do |e|
26
+ if e.__deep_connect_reference? && !PORT_KEEP_IDENTITY_CLASS_SET[e.class]
27
+ e = e.deep_connect_deep_copy
28
+ end
29
+ block.call e
30
+ end
31
+ end
32
+
33
+ # def start
34
+ # super do
35
+ # @enumerable.each do |e|
36
+ # if e.__deep_connect_reference? && !PORT_KEEP_IDENTITY_CLASS_SET[e.class]
37
+ # e = e.deep_connect_deep_copy
38
+ # end
39
+ # @export.push e
40
+ # end
41
+ # end
42
+ # end
43
+ end
44
+ end