asynchronic 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/asynchronic/process.rb +10 -0
- data/lib/asynchronic/version.rb +1 -1
- data/spec/jobs.rb +71 -0
- data/spec/process/life_cycle_examples.rb +14 -0
- data/spec/queue_engine/synchronic_spec.rb +4 -0
- data/spec/worker/worker_examples.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a56b4d0f2c929275129ed42f2ff2d92e26b9646
|
4
|
+
data.tar.gz: 74208ec62350e6bea9f0dcfb512ed6150a2e1517
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8801974149b1b5715904b908d55f69c57bd922fbb4c4b8aa9586d7164f3a21302d81b63015b548a3a5997fcabf8368296f87ec97b927a943f0b72916014b5762
|
7
|
+
data.tar.gz: 08cd125a279e9593c9aec42b8858831762bba28e5cd1c63bf645a1a9177acb00e21db47b5ca890ef8c3930df795526542395b5bf6531758942aff7f68f19915a
|
data/lib/asynchronic/process.rb
CHANGED
@@ -67,6 +67,16 @@ module Asynchronic
|
|
67
67
|
Process.new environment, id.remove_last(2) if id.nested?
|
68
68
|
end
|
69
69
|
|
70
|
+
def real_error
|
71
|
+
childs = processes
|
72
|
+
|
73
|
+
return error.message if childs.empty?
|
74
|
+
|
75
|
+
childs.each do |child|
|
76
|
+
return child.real_error if child.error
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
70
80
|
def dependencies
|
71
81
|
return [] unless parent
|
72
82
|
data_store[:dependencies].map { |d| parent[d] }
|
data/lib/asynchronic/version.rb
CHANGED
data/spec/jobs.rb
CHANGED
@@ -237,4 +237,75 @@ class DataJob < Asynchronic::Job
|
|
237
237
|
set :value, params[:input]
|
238
238
|
nil
|
239
239
|
end
|
240
|
+
end
|
241
|
+
|
242
|
+
|
243
|
+
class NestedJobWithErrorInChild < Asynchronic::Job
|
244
|
+
|
245
|
+
def call
|
246
|
+
async Child_1
|
247
|
+
async Child_2
|
248
|
+
async Child_3
|
249
|
+
nil
|
250
|
+
end
|
251
|
+
|
252
|
+
class Child_1 < Asynchronic::Job
|
253
|
+
def call
|
254
|
+
async Child_1_1
|
255
|
+
async Child_1_2
|
256
|
+
nil
|
257
|
+
end
|
258
|
+
|
259
|
+
class Child_1_1 < Asynchronic::Job
|
260
|
+
def call
|
261
|
+
nil
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
class Child_1_2 < Asynchronic::Job
|
266
|
+
def call
|
267
|
+
nil
|
268
|
+
end
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
class Child_2 < Asynchronic::Job
|
273
|
+
def call
|
274
|
+
async Child_2_1
|
275
|
+
async Child_2_2
|
276
|
+
async Child_2_3
|
277
|
+
nil
|
278
|
+
end
|
279
|
+
|
280
|
+
class Child_2_1 < Asynchronic::Job
|
281
|
+
def call
|
282
|
+
nil
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
class Child_2_2 < Asynchronic::Job
|
287
|
+
def call
|
288
|
+
raise "Error in Child_2_2"
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
class Child_2_3 < Asynchronic::Job
|
293
|
+
def call
|
294
|
+
nil
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
class Child_3 < Asynchronic::Job
|
300
|
+
def call
|
301
|
+
async Child_3_1
|
302
|
+
nil
|
303
|
+
end
|
304
|
+
|
305
|
+
class Child_3_1 < Asynchronic::Job
|
306
|
+
def call
|
307
|
+
nil
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
240
311
|
end
|
@@ -462,4 +462,18 @@ module LifeCycleExamples
|
|
462
462
|
process.data.must_equal text: 'Input was 1', value: 1
|
463
463
|
end
|
464
464
|
|
465
|
+
it 'NestedJobWithErrorInChild' do
|
466
|
+
process = create NestedJobWithErrorInChild, queue: :test_queue
|
467
|
+
|
468
|
+
process.enqueue
|
469
|
+
|
470
|
+
Timeout.timeout(1) do
|
471
|
+
until process.status == :aborted
|
472
|
+
execute queue_engine[:test_queue]
|
473
|
+
end
|
474
|
+
end
|
475
|
+
|
476
|
+
process.real_error.must_equal "Error in Child_2_2"
|
477
|
+
end
|
478
|
+
|
465
479
|
end
|
@@ -4,6 +4,11 @@ module WorkerExamples
|
|
4
4
|
let(:queue_name) { :test_worker }
|
5
5
|
let(:queue) { env.queue queue_name }
|
6
6
|
|
7
|
+
after do
|
8
|
+
data_store.clear
|
9
|
+
queue_engine.clear
|
10
|
+
end
|
11
|
+
|
7
12
|
def enqueue_processes
|
8
13
|
processes = 5.times.map do
|
9
14
|
env.create_process(WorkerJob, queue: :test_worker).tap(&:enqueue)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asynchronic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Naiman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|