tresse 1.1.3 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/tresse.rb +17 -18
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80b7de6139b9cc1d3e7bacd2f86b7c6b0685d431
|
4
|
+
data.tar.gz: 673e625a9a20149d09120348e2ab299a06605c36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 073fe8f17b480a03c32c1a22443ad3024f99c5eeff3da696d9e2313899e447f65daf6104af0f601943d1fb0ec618091ee23d75087a33fb6b3ea1f6ff151b1ca1
|
7
|
+
data.tar.gz: dd3631c389f68d0855a9f73b57f183a3a4c93a7565dc2c57d82a170ca369acbbd211da856310ca8e5242e92917ffab0c13b07d2986f01d30464cdd600bd69050
|
data/CHANGELOG.md
CHANGED
data/lib/tresse.rb
CHANGED
@@ -4,7 +4,7 @@ require 'thread'
|
|
4
4
|
|
5
5
|
module Tresse
|
6
6
|
|
7
|
-
VERSION = '1.
|
7
|
+
VERSION = '1.2.0'
|
8
8
|
|
9
9
|
class << self
|
10
10
|
|
@@ -12,15 +12,6 @@ module Tresse
|
|
12
12
|
|
13
13
|
@work_queue = Queue.new
|
14
14
|
@work_threads = 8.times.collect { |i| make_work_thread }
|
15
|
-
|
16
|
-
@on_error =
|
17
|
-
lambda do |where, err|
|
18
|
-
puts "-" * 80
|
19
|
-
p where
|
20
|
-
p err
|
21
|
-
puts err.backtrace
|
22
|
-
puts "-" * 80
|
23
|
-
end
|
24
15
|
end
|
25
16
|
|
26
17
|
def enqueue(batch)
|
@@ -30,11 +21,6 @@ module Tresse
|
|
30
21
|
batch.group
|
31
22
|
end
|
32
23
|
|
33
|
-
def on_error(&block)
|
34
|
-
|
35
|
-
@on_error = block
|
36
|
-
end
|
37
|
-
|
38
24
|
def max_work_thread_count
|
39
25
|
|
40
26
|
@work_threads.size
|
@@ -73,7 +59,7 @@ module Tresse
|
|
73
59
|
|
74
60
|
rescue => err
|
75
61
|
|
76
|
-
|
62
|
+
batch.error = err
|
77
63
|
end
|
78
64
|
end
|
79
65
|
end
|
@@ -95,6 +81,7 @@ module Tresse
|
|
95
81
|
attr_reader :map_index
|
96
82
|
attr_reader :completed
|
97
83
|
attr_accessor :value
|
84
|
+
attr_reader :error
|
98
85
|
|
99
86
|
def initialize(group, block_or_group)
|
100
87
|
|
@@ -128,6 +115,12 @@ module Tresse
|
|
128
115
|
|
129
116
|
@completed = true
|
130
117
|
end
|
118
|
+
|
119
|
+
def error=(err)
|
120
|
+
|
121
|
+
@error = err
|
122
|
+
@group.send(:receive, self)
|
123
|
+
end
|
131
124
|
end
|
132
125
|
|
133
126
|
class Group
|
@@ -222,7 +215,11 @@ module Tresse
|
|
222
215
|
|
223
216
|
launch
|
224
217
|
|
225
|
-
@reduction_queue.pop
|
218
|
+
r = @reduction_queue.pop
|
219
|
+
|
220
|
+
raise r.error if r.is_a?(Tresse::Batch)
|
221
|
+
|
222
|
+
r
|
226
223
|
end
|
227
224
|
|
228
225
|
def launch
|
@@ -235,7 +232,9 @@ module Tresse
|
|
235
232
|
|
236
233
|
def receive(batch)
|
237
234
|
|
238
|
-
if batch.
|
235
|
+
if batch.error
|
236
|
+
@reduction_queue << batch
|
237
|
+
elsif batch.map_index == 0
|
239
238
|
batch.source
|
240
239
|
Tresse.enqueue(batch)
|
241
240
|
elsif m = @maps[batch.map_index]
|