fairy 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +674 -0
- data/Makefile +116 -0
- data/README +15 -0
- data/bin/fairy +582 -0
- data/bin/fairy-cat +74 -0
- data/bin/fairy-cp +128 -0
- data/bin/fairy-rm +122 -0
- data/bin/subcmd/controller +41 -0
- data/bin/subcmd/inspector +81 -0
- data/bin/subcmd/master +43 -0
- data/bin/subcmd/node +47 -0
- data/bin/subcmd/processor +54 -0
- data/doc/programming-interface.html +240 -0
- data/doc/programming-interface.rd +300 -0
- data/etc/fairy.conf.tmpl +118 -0
- data/ext/simple_hash/extconf.rb +4 -0
- data/ext/simple_hash/simple_hash.c +42 -0
- data/fairy.gemspec +60 -0
- data/lib/fairy/client/addins.rb +20 -0
- data/lib/fairy/client/barrier.rb +29 -0
- data/lib/fairy/client/basic-group-by.rb +52 -0
- data/lib/fairy/client/cat.rb +41 -0
- data/lib/fairy/client/direct-product.rb +51 -0
- data/lib/fairy/client/equijoin.rb +79 -0
- data/lib/fairy/client/exec.rb +54 -0
- data/lib/fairy/client/filter.rb +62 -0
- data/lib/fairy/client/find.rb +35 -0
- data/lib/fairy/client/group-by.rb +194 -0
- data/lib/fairy/client/here.rb +84 -0
- data/lib/fairy/client/inject.rb +70 -0
- data/lib/fairy/client/input-file.rb +53 -0
- data/lib/fairy/client/input-iota.rb +49 -0
- data/lib/fairy/client/input-local-file.rb +188 -0
- data/lib/fairy/client/input-varray.rb +30 -0
- data/lib/fairy/client/input.rb +42 -0
- data/lib/fairy/client/io-filter.rb +26 -0
- data/lib/fairy/client/junction.rb +31 -0
- data/lib/fairy/client/map.rb +34 -0
- data/lib/fairy/client/merge-group-by.rb +71 -0
- data/lib/fairy/client/output-file.rb +64 -0
- data/lib/fairy/client/output-local-file.rb +60 -0
- data/lib/fairy/client/output-null.rb +47 -0
- data/lib/fairy/client/output-varray.rb +50 -0
- data/lib/fairy/client/output.rb +29 -0
- data/lib/fairy/client/roma-put.rb +62 -0
- data/lib/fairy/client/roma.rb +156 -0
- data/lib/fairy/client/seg-join.rb +61 -0
- data/lib/fairy/client/seg-map.rb +78 -0
- data/lib/fairy/client/seg-shuffle.rb +35 -0
- data/lib/fairy/client/seg-split.rb +27 -0
- data/lib/fairy/client/seg-zip.rb +60 -0
- data/lib/fairy/client/select.rb +38 -0
- data/lib/fairy/client/sort.rb +48 -0
- data/lib/fairy/client/sort18.rb +56 -0
- data/lib/fairy/client/sort19.rb +61 -0
- data/lib/fairy/client/there.rb +47 -0
- data/lib/fairy/client/top_n_into_roma.rb +34 -0
- data/lib/fairy/client/wc.rb +92 -0
- data/lib/fairy/controller.rb +1103 -0
- data/lib/fairy/logger.rb +107 -0
- data/lib/fairy/master/addins.rb +20 -0
- data/lib/fairy/master/atom.rb +17 -0
- data/lib/fairy/master/c-barrier.rb +283 -0
- data/lib/fairy/master/c-basic-group-by.rb +250 -0
- data/lib/fairy/master/c-cat.rb +159 -0
- data/lib/fairy/master/c-direct-product.rb +203 -0
- data/lib/fairy/master/c-exec.rb +68 -0
- data/lib/fairy/master/c-filter.rb +422 -0
- data/lib/fairy/master/c-find.rb +138 -0
- data/lib/fairy/master/c-group-by.rb +64 -0
- data/lib/fairy/master/c-here.rb +80 -0
- data/lib/fairy/master/c-inject.rb +119 -0
- data/lib/fairy/master/c-input-file.rb +46 -0
- data/lib/fairy/master/c-input-iota.rb +66 -0
- data/lib/fairy/master/c-input-local-file.rb +117 -0
- data/lib/fairy/master/c-input-varray.rb +53 -0
- data/lib/fairy/master/c-input.rb +24 -0
- data/lib/fairy/master/c-inputtable.rb +31 -0
- data/lib/fairy/master/c-inputtable18.rb +36 -0
- data/lib/fairy/master/c-inputtable19.rb +35 -0
- data/lib/fairy/master/c-io-filter.rb +28 -0
- data/lib/fairy/master/c-junction.rb +54 -0
- data/lib/fairy/master/c-map.rb +27 -0
- data/lib/fairy/master/c-merge-group-by.rb +241 -0
- data/lib/fairy/master/c-output-file.rb +84 -0
- data/lib/fairy/master/c-output-local-file.rb +19 -0
- data/lib/fairy/master/c-output-null.rb +45 -0
- data/lib/fairy/master/c-output-varray.rb +57 -0
- data/lib/fairy/master/c-output.rb +20 -0
- data/lib/fairy/master/c-seg-join.rb +141 -0
- data/lib/fairy/master/c-seg-map.rb +26 -0
- data/lib/fairy/master/c-seg-shuffle.rb +87 -0
- data/lib/fairy/master/c-seg-split.rb +110 -0
- data/lib/fairy/master/c-seg-zip.rb +132 -0
- data/lib/fairy/master/c-select.rb +27 -0
- data/lib/fairy/master/c-sort.rb +108 -0
- data/lib/fairy/master/c-there.rb +57 -0
- data/lib/fairy/master/c-wc.rb +232 -0
- data/lib/fairy/master/job-interpriter.rb +19 -0
- data/lib/fairy/master/scheduler.rb +24 -0
- data/lib/fairy/master.rb +329 -0
- data/lib/fairy/node/addins.rb +19 -0
- data/lib/fairy/node/p-barrier.rb +95 -0
- data/lib/fairy/node/p-basic-group-by.rb +252 -0
- data/lib/fairy/node/p-direct-product.rb +153 -0
- data/lib/fairy/node/p-exec.rb +30 -0
- data/lib/fairy/node/p-filter.rb +363 -0
- data/lib/fairy/node/p-find.rb +111 -0
- data/lib/fairy/node/p-group-by.rb +1534 -0
- data/lib/fairy/node/p-here.rb +21 -0
- data/lib/fairy/node/p-identity.rb +24 -0
- data/lib/fairy/node/p-inject.rb +127 -0
- data/lib/fairy/node/p-input-file.rb +108 -0
- data/lib/fairy/node/p-input-iota.rb +39 -0
- data/lib/fairy/node/p-input-local-file.rb +61 -0
- data/lib/fairy/node/p-input-varray.rb +26 -0
- data/lib/fairy/node/p-io-filter.rb +28 -0
- data/lib/fairy/node/p-map.rb +40 -0
- data/lib/fairy/node/p-merger-group-by.rb +48 -0
- data/lib/fairy/node/p-output-file.rb +104 -0
- data/lib/fairy/node/p-output-local-file.rb +14 -0
- data/lib/fairy/node/p-output-null.rb +32 -0
- data/lib/fairy/node/p-output-varray.rb +41 -0
- data/lib/fairy/node/p-seg-join.rb +82 -0
- data/lib/fairy/node/p-seg-map.rb +34 -0
- data/lib/fairy/node/p-seg-split.rb +61 -0
- data/lib/fairy/node/p-seg-zip.rb +79 -0
- data/lib/fairy/node/p-select.rb +40 -0
- data/lib/fairy/node/p-single-exportable.rb +90 -0
- data/lib/fairy/node/p-sort.rb +195 -0
- data/lib/fairy/node/p-task.rb +113 -0
- data/lib/fairy/node/p-there.rb +44 -0
- data/lib/fairy/node/p-wc.rb +266 -0
- data/lib/fairy/node.rb +187 -0
- data/lib/fairy/processor.rb +510 -0
- data/lib/fairy/share/base-app.rb +114 -0
- data/lib/fairy/share/block-source.rb +234 -0
- data/lib/fairy/share/conf.rb +396 -0
- data/lib/fairy/share/debug.rb +21 -0
- data/lib/fairy/share/encoding.rb +17 -0
- data/lib/fairy/share/fast-tempfile.rb +93 -0
- data/lib/fairy/share/file-place.rb +176 -0
- data/lib/fairy/share/hash-1.rb +20 -0
- data/lib/fairy/share/hash-md5.rb +28 -0
- data/lib/fairy/share/hash-murmur.rb +69 -0
- data/lib/fairy/share/hash-rb18.rb +20 -0
- data/lib/fairy/share/hash-simple-hash.rb +28 -0
- data/lib/fairy/share/inspector.rb +16 -0
- data/lib/fairy/share/lc/exceptions.rb +82 -0
- data/lib/fairy/share/lc/ja/exceptions.rb +81 -0
- data/lib/fairy/share/locale.rb +17 -0
- data/lib/fairy/share/log.rb +215 -0
- data/lib/fairy/share/pool-dictionary.rb +53 -0
- data/lib/fairy/share/port-marshaled-queue.rb +347 -0
- data/lib/fairy/share/port.rb +1697 -0
- data/lib/fairy/share/reference.rb +45 -0
- data/lib/fairy/share/stdout.rb +56 -0
- data/lib/fairy/share/tr.rb +16 -0
- data/lib/fairy/share/varray.rb +147 -0
- data/lib/fairy/share/vfile.rb +183 -0
- data/lib/fairy/version.rb +8 -0
- data/lib/fairy.rb +206 -0
- data/sample/grep.rb +46 -0
- data/sample/ping.rb +19 -0
- data/sample/sort.rb +102 -0
- data/sample/wordcount.rb +61 -0
- data/spec/README +12 -0
- data/spec/fairy1_spec.rb +31 -0
- data/spec/fairy2_spec.rb +42 -0
- data/spec/fairy3_spec.rb +126 -0
- data/spec/fairy4_spec.rb +63 -0
- data/spec/fairy5_spec.rb +45 -0
- data/spec/fairy6_spec.rb +52 -0
- data/spec/fairy7_spec.rb +58 -0
- data/spec/fairy8_spec.rb +48 -0
- data/spec/mkdat.rb +148 -0
- data/spec/run_all.sh +65 -0
- data/test/testc.rb +7111 -0
- data/tools/cap_recipe/Capfile +144 -0
- data/tools/cap_recipe/cluster.yml.sample +14 -0
- data/tools/fairy_perf_graph.rb +444 -0
- data/tools/git-tag +44 -0
- data/tools/log-analysis.rb +62 -0
- data/tools/svn-ls-diff +38 -0
- data/tools/svn-tags +37 -0
- metadata +298 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (C) 2007-2010 Rakuten, Inc.
|
4
|
+
#
|
5
|
+
|
6
|
+
require "fairy/master/c-io-filter"
|
7
|
+
require "fairy/master/c-inputtable"
|
8
|
+
|
9
|
+
module Fairy
|
10
|
+
class CSelect<CIOFilter
|
11
|
+
Controller.def_export self
|
12
|
+
|
13
|
+
def initialize(controller, opts, block_source)
|
14
|
+
super
|
15
|
+
@block_source = block_source
|
16
|
+
end
|
17
|
+
|
18
|
+
def node_class_name
|
19
|
+
"PSelect"
|
20
|
+
end
|
21
|
+
|
22
|
+
def njob_creation_params
|
23
|
+
[@block_source]
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (C) 2007-2010 Rakuten, Inc.
|
4
|
+
#
|
5
|
+
|
6
|
+
require "fairy/master/c-io-filter"
|
7
|
+
require "fairy/master/c-inputtable"
|
8
|
+
require "fairy/master/c-basic-group-by"
|
9
|
+
|
10
|
+
module Fairy
|
11
|
+
|
12
|
+
module CSort
|
13
|
+
class CPreSort<CBasicGroupBy
|
14
|
+
Controller.def_export self
|
15
|
+
|
16
|
+
def initialize(controller, opts, block_source)
|
17
|
+
super
|
18
|
+
|
19
|
+
@samplings = []
|
20
|
+
|
21
|
+
@pvs = nil
|
22
|
+
@pvs_mutex = Mutex.new
|
23
|
+
@pvs_cv = ConditionVariable.new
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_pvs(buf=nil)
|
27
|
+
# BUG#271対応. 全てのセグメントからサンプルを取るのではなく, 最初のセ
|
28
|
+
# グメントからのみサンプリングを取るようにした.
|
29
|
+
if buf
|
30
|
+
@samplings.push buf
|
31
|
+
|
32
|
+
# BUG#271対応.
|
33
|
+
# if @samplings.size >= number_of_nodes
|
34
|
+
# make_pvs
|
35
|
+
# end
|
36
|
+
make_pvs
|
37
|
+
end
|
38
|
+
|
39
|
+
@pvs_mutex.synchronize do
|
40
|
+
while !@pvs
|
41
|
+
@pvs_cv.wait(@pvs_mutex)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
@pvs
|
45
|
+
end
|
46
|
+
DeepConnect.def_method_spec(self, "DVAL get_pvs(DVAL)")
|
47
|
+
|
48
|
+
def make_pvs
|
49
|
+
no_segment = @opts[:no_segment]
|
50
|
+
no_segment ||= Fairy::CONF.SORT_NO_SEGMENT
|
51
|
+
|
52
|
+
|
53
|
+
cmp_opt = @opts[:cmp_optimize]
|
54
|
+
cmp_opt = CONF.SORT_CMP_OPTIMIZE if cmp_opt.nil?
|
55
|
+
|
56
|
+
if cmp_opt
|
57
|
+
key_proc = eval("proc{#{@block_source.source}}", @context.binding)
|
58
|
+
else
|
59
|
+
key_proc = BBlock.new(@block_source, @context, self)
|
60
|
+
end
|
61
|
+
|
62
|
+
sorted = @samplings.flatten(1).sort_by{|e| key_proc.call(e)}
|
63
|
+
|
64
|
+
#Log::debugf(self, "%s", sorted.inspect)
|
65
|
+
idxes = (1...no_segment).collect{|i| (sorted.size*i).div(no_segment)}
|
66
|
+
@pvs_mutex.synchronize do
|
67
|
+
@pvs = sorted.values_at(*idxes)
|
68
|
+
@pvs_cv.broadcast
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def node_class_name
|
73
|
+
"PSort::PPreSort"
|
74
|
+
end
|
75
|
+
|
76
|
+
def njob_creation_params
|
77
|
+
[@block_source]
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
class CPostSort<CIOFilter
|
82
|
+
Controller.def_export self
|
83
|
+
|
84
|
+
def initialize(controller, opts, block_source)
|
85
|
+
super
|
86
|
+
@block_source = block_source
|
87
|
+
end
|
88
|
+
|
89
|
+
def node_class_name
|
90
|
+
"PSort::PPostSort"
|
91
|
+
end
|
92
|
+
|
93
|
+
def njob_creation_params
|
94
|
+
[@block_source]
|
95
|
+
end
|
96
|
+
|
97
|
+
def create_import(processor)
|
98
|
+
policy = @opts[:postfilter_prequeuing_policy]
|
99
|
+
policy ||= @opts[:prequeuing_policy]
|
100
|
+
|
101
|
+
processor.create_import(policy)
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (C) 2007-2010 Rakuten, Inc.
|
4
|
+
#
|
5
|
+
|
6
|
+
require "fairy/master/c-input"
|
7
|
+
|
8
|
+
module Fairy
|
9
|
+
class CThere<CInput
|
10
|
+
Controller.def_export self
|
11
|
+
|
12
|
+
def initialize(controller, opts, enumerable)
|
13
|
+
super
|
14
|
+
@enumerable = enumerable
|
15
|
+
end
|
16
|
+
|
17
|
+
def node_class_name
|
18
|
+
"PThere"
|
19
|
+
end
|
20
|
+
|
21
|
+
def njob_creation_params
|
22
|
+
# [@enumerable]
|
23
|
+
[]
|
24
|
+
end
|
25
|
+
|
26
|
+
def start
|
27
|
+
@cthere_place = CTherePlace.new(@enumerable)
|
28
|
+
start_create_nodes
|
29
|
+
end
|
30
|
+
|
31
|
+
def input
|
32
|
+
@cthere_place
|
33
|
+
end
|
34
|
+
|
35
|
+
# def create_and_start_nodes
|
36
|
+
# begin
|
37
|
+
# no = 0
|
38
|
+
# @create_node_mutex.synchronize do
|
39
|
+
# nthere = nil
|
40
|
+
# @controller.assign_new_processor(self) do |processor|
|
41
|
+
# nthere = create_node(processor)
|
42
|
+
# end
|
43
|
+
# no += 1
|
44
|
+
# nthere.start
|
45
|
+
# end
|
46
|
+
# rescue BreakCreateNode
|
47
|
+
# # do nothing
|
48
|
+
# Log::debug self, "BREAK CREATE NODE: #{self}"
|
49
|
+
# ensure
|
50
|
+
# self.number_of_nodes = no
|
51
|
+
# end
|
52
|
+
# end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
|
@@ -0,0 +1,232 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (C) 2007-2010 Rakuten, Inc.
|
4
|
+
#
|
5
|
+
|
6
|
+
require "fairy/master/c-io-filter"
|
7
|
+
require "fairy/master/c-input"
|
8
|
+
require "fairy/share/vfile"
|
9
|
+
require "fairy/share/file-place"
|
10
|
+
|
11
|
+
module Fairy
|
12
|
+
class CWC<CInput
|
13
|
+
Controller.def_export self
|
14
|
+
|
15
|
+
def CWC.open(controller, opts, descripter)
|
16
|
+
bfile = CWC.new(controller, opts)
|
17
|
+
bfile.open(desctipter)
|
18
|
+
bfile
|
19
|
+
end
|
20
|
+
DeepConnect.def_single_method_spec(self, "REF open(REF, VAL, VAL)")
|
21
|
+
|
22
|
+
def initialize(controller, opts)
|
23
|
+
super
|
24
|
+
|
25
|
+
@no_of_exports = 0
|
26
|
+
|
27
|
+
# key -> [export, ...]
|
28
|
+
@exports = {}
|
29
|
+
@exports_mutex = Mutex.new
|
30
|
+
@exports_cv = ConditionVariable.new
|
31
|
+
|
32
|
+
# @pre_exports_queue = Queue.new
|
33
|
+
@exports_queue = Queue.new
|
34
|
+
|
35
|
+
@each_export_by_thread = nil
|
36
|
+
@each_export_by_thread_mutex = Mutex.new
|
37
|
+
|
38
|
+
@hash_seed = controller.hash_seed
|
39
|
+
end
|
40
|
+
|
41
|
+
attr_reader :hash_seed
|
42
|
+
|
43
|
+
def node_class_name
|
44
|
+
"PWC"
|
45
|
+
end
|
46
|
+
|
47
|
+
def open(vf)
|
48
|
+
@vfile = vf
|
49
|
+
@cfile_place = CFilePlace.new(@vfile)
|
50
|
+
|
51
|
+
start_create_nodes
|
52
|
+
end
|
53
|
+
DeepConnect.def_method_spec(self, "REF open(DVAL)")
|
54
|
+
|
55
|
+
def input
|
56
|
+
@cfile_place
|
57
|
+
end
|
58
|
+
|
59
|
+
def start_create_nodes
|
60
|
+
super
|
61
|
+
|
62
|
+
start_watch_all_node_imported
|
63
|
+
end
|
64
|
+
|
65
|
+
def each_assigned_filter(&block)
|
66
|
+
super
|
67
|
+
|
68
|
+
@each_export_by_thread_mutex.synchronize do
|
69
|
+
@each_export_by_thread.join if @each_export_by_thread
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def each_export_by(njob, mapper, &block)
|
74
|
+
@each_export_by_thread_mutex.synchronize do
|
75
|
+
return if @each_export_by_thread
|
76
|
+
|
77
|
+
@each_export_by_thread = Thread.start{
|
78
|
+
# すべての njob がそろうまで待つ
|
79
|
+
# 後段が先にスケジュールされてデッドロックするのを避けるため.
|
80
|
+
number_of_nodes
|
81
|
+
|
82
|
+
begin
|
83
|
+
while pair = @exports_queue.pop
|
84
|
+
exp, njob = pair
|
85
|
+
Log::debug(self, "EXPORT_BY, #{exp.key}")
|
86
|
+
block.call exp
|
87
|
+
|
88
|
+
@exports_mutex.synchronize do
|
89
|
+
if @exports[exp.key].first == exp
|
90
|
+
@exports[exp.key][1..-1].each do |e|
|
91
|
+
e.output = exp.output
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
rescue
|
97
|
+
Log::fatal_exception
|
98
|
+
raise
|
99
|
+
end
|
100
|
+
}
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def bind_export(exp, imp)
|
105
|
+
# do nothing
|
106
|
+
end
|
107
|
+
|
108
|
+
def add_exports(key, export, njob)
|
109
|
+
@exports_mutex.synchronize do
|
110
|
+
if exports = @exports[key]
|
111
|
+
export.output = exports.first.output if exports.first.output?
|
112
|
+
export.no = exports.first.no
|
113
|
+
exports.push export
|
114
|
+
else
|
115
|
+
export.no = @no_of_exports
|
116
|
+
@no_of_exports += 1
|
117
|
+
@exports[key] = [export]
|
118
|
+
@exports_queue.push [export, njob]
|
119
|
+
# @pre_exports_queue.push [export, njob]
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def update_exports(key, export, njob)
|
125
|
+
add_exports(key, export, njob)
|
126
|
+
nil
|
127
|
+
end
|
128
|
+
|
129
|
+
def start_watch_all_node_imported
|
130
|
+
Thread.start do
|
131
|
+
# すべての njob がそろうまで待つ
|
132
|
+
# 後段が先にスケジュールされてデッドロックするのを避けるため.
|
133
|
+
Log::debug(self, "START_WATCH_ALL_NODE_IMPORTED: S")
|
134
|
+
number_of_nodes
|
135
|
+
|
136
|
+
Log::debug(self, "START_WATCH_ALL_NODE_IMPORTED: 1")
|
137
|
+
|
138
|
+
Log::debug(self, "START_WATCH_ALL_NODE_IMPORTED: 2")
|
139
|
+
# すべての exports がそろうまで待つ
|
140
|
+
@nodes_status_mutex.synchronize do
|
141
|
+
while !all_node_imported?
|
142
|
+
@nodes_status_cv.wait(@nodes_status_mutex)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
@exports_queue.push nil
|
146
|
+
|
147
|
+
Log::debug(self, "START_WATCH_ALL_NODE_IMPORTED: 4")
|
148
|
+
for key, exports in @exports
|
149
|
+
exports.first.output_no_import = exports.size
|
150
|
+
end
|
151
|
+
Log::debug(self, "START_WATCH_ALL_NODE_IMPORTED: E")
|
152
|
+
end
|
153
|
+
nil
|
154
|
+
end
|
155
|
+
|
156
|
+
def all_node_arrived?
|
157
|
+
@nodes_mutex.synchronize{@number_of_nodes}
|
158
|
+
end
|
159
|
+
|
160
|
+
def all_node_imported?
|
161
|
+
# すべてのnjobがそろったか?
|
162
|
+
return false unless @nodes_mutex.synchronize{@number_of_nodes}
|
163
|
+
|
164
|
+
each_node(:exist_only) do |node|
|
165
|
+
st = @nodes_status[node]
|
166
|
+
# こちらはNG: outputが設定されていないとまずい.
|
167
|
+
# すべてのnodeがそろったとしてもすべてのexportがそろっているとは限らない
|
168
|
+
# unless [:ST_FINISH, :ST_EXPORT_FINISH, :ST_WAIT_EXPORT_FINISH, :ST_ALL_IMPORTED].include?(st)
|
169
|
+
unless [:ST_FINISH, :ST_EXPORT_FINISH, :ST_WAIT_EXPORT_FINISH].include?(st)
|
170
|
+
return false
|
171
|
+
end
|
172
|
+
end
|
173
|
+
true
|
174
|
+
end
|
175
|
+
|
176
|
+
class CPostFilter<CIOFilter
|
177
|
+
Controller.def_export self
|
178
|
+
|
179
|
+
def initialize(controller, opts)
|
180
|
+
super
|
181
|
+
|
182
|
+
@hash_seed = controller.hash_seed
|
183
|
+
end
|
184
|
+
|
185
|
+
attr_reader :hash_seed
|
186
|
+
|
187
|
+
def node_class_name
|
188
|
+
"PWC::PPostFilter"
|
189
|
+
end
|
190
|
+
|
191
|
+
def njob_creation_params
|
192
|
+
[@vfile]
|
193
|
+
end
|
194
|
+
|
195
|
+
def output(vf)
|
196
|
+
@vfile = vf
|
197
|
+
end
|
198
|
+
|
199
|
+
def njob_creation_params
|
200
|
+
[@vfile]
|
201
|
+
end
|
202
|
+
|
203
|
+
def create_import(processor)
|
204
|
+
policy = @opts[:postfilter_prequeuing_policy]
|
205
|
+
policy ||= @opts[:prequeuing_policy]
|
206
|
+
|
207
|
+
processor.create_import(policy)
|
208
|
+
end
|
209
|
+
|
210
|
+
|
211
|
+
def wait_all_output_finished
|
212
|
+
@nodes_status_mutex.synchronize do
|
213
|
+
while !all_node_outputted?
|
214
|
+
@nodes_status_cv.wait(@nodes_status_mutex)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
def all_node_outputted?
|
220
|
+
|
221
|
+
return false unless @number_of_nodes
|
222
|
+
|
223
|
+
all_outputted = true
|
224
|
+
each_node(:exist_only) do |node|
|
225
|
+
st = @nodes_status[node]
|
226
|
+
all_outputted &&= [:ST_FINISH, :ST_OUTPUT_FINISH].include?(st)
|
227
|
+
end
|
228
|
+
all_outputted
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (C) 2007-2010 Rakuten, Inc.
|
4
|
+
#
|
5
|
+
|
6
|
+
module Fairy
|
7
|
+
class JobInterpriter
|
8
|
+
def initialize(controller)
|
9
|
+
@controller = controller
|
10
|
+
end
|
11
|
+
|
12
|
+
def exec(atom)
|
13
|
+
puts "SEND: #{atom.receiver}.#{atom.message}(#{atom.args.map{|e| e.to_s}.join(",")})"
|
14
|
+
ret = atom.receiver.send(atom.message, *atom.args)
|
15
|
+
# このあと何か必要か?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|