tresse 1.1.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/lib/tresse.rb +17 -18
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a79478c19e535535d6939c00b57f34348dc024d3
4
- data.tar.gz: f614a4fbc5b34a37617e3bb09863d09c5a1a95c6
3
+ metadata.gz: 80b7de6139b9cc1d3e7bacd2f86b7c6b0685d431
4
+ data.tar.gz: 673e625a9a20149d09120348e2ab299a06605c36
5
5
  SHA512:
6
- metadata.gz: 59dc4a2a63a63dfe420ae6ffb65b0a7e5083f55da03f630d74e42cb4f3c174081bf430e668820d55af76a6843f0db7b954f24a45e57978b8a33cb5ae2f1d5b24
7
- data.tar.gz: e35f1a82c2c2e5aa65c5b17e0ca76d2aef068b9c9177b6f9a79f9fa2622ba2100e9663117ec333e0f70687a8383ba6d990fd844176dcfad03d958fe81cf91d3f
6
+ metadata.gz: 073fe8f17b480a03c32c1a22443ad3024f99c5eeff3da696d9e2313899e447f65daf6104af0f601943d1fb0ec618091ee23d75087a33fb6b3ea1f6ff151b1ca1
7
+ data.tar.gz: dd3631c389f68d0855a9f73b57f183a3a4c93a7565dc2c57d82a170ca369acbbd211da856310ca8e5242e92917ffab0c13b07d2986f01d30464cdd600bd69050
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
  # CHANGELOG.md
3
3
 
4
4
 
5
+ ## tresse 1.2.0 released 2019-09-17
6
+
7
+ * Re-raise errors at reduction stage
8
+
9
+
5
10
  ## tresse 1.1.3 released 2019-09-17
6
11
 
7
12
  * Fix ready for reduction check (prevent it from hanging)
data/lib/tresse.rb CHANGED
@@ -4,7 +4,7 @@ require 'thread'
4
4
 
5
5
  module Tresse
6
6
 
7
- VERSION = '1.1.3'
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
- @on_error.call(:in_worker_thread, err)
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.map_index == 0
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]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tresse
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux