asynchronic 1.2.1 → 1.2.2
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.rb +1 -1
- data/lib/asynchronic/process.rb +22 -14
- data/lib/asynchronic/queue_engine/in_memory.rb +3 -0
- data/lib/asynchronic/queue_engine/ost.rb +4 -0
- data/lib/asynchronic/queue_engine/synchronic.rb +3 -0
- data/lib/asynchronic/version.rb +1 -1
- data/spec/queue_engine/synchronic_spec.rb +7 -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: df76d108620383f31881d300c27a58c8ed159ed5
|
4
|
+
data.tar.gz: 999c8387fca556bed70fc2ac5578a83e1ebc9156
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe94f5bdce4c457d78d0c46653d8299b23f7ae9ecff911f3d321572921c694e4e96265cbb9c65cd0fc6d925740c4697118fe0222ff3db97a58b4c8874ff2dcbf
|
7
|
+
data.tar.gz: 0dc6bbd6de6502feee5003452381d18413ede5492ba3a173eba522e2a4080178bce9379f0f1f3efcfe29dfcb92dec47eb98e795f6c2aa384456c3c3713f80b3c
|
data/lib/asynchronic.rb
CHANGED
data/lib/asynchronic/process.rb
CHANGED
@@ -85,21 +85,15 @@ module Asynchronic
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def wakeup
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
completed!
|
94
|
-
else
|
95
|
-
processes.each do |p|
|
96
|
-
p.enqueue if p.ready?
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
parent.wakeup if parent && finalized?
|
88
|
+
Asynchronic.logger.info('Asynchronic') { "Wakeup started #{type} (#{id})" }
|
89
|
+
if environment.queue_engine.asynchronic?
|
90
|
+
data_store.synchronize(id) { wakeup_children }
|
91
|
+
else
|
92
|
+
wakeup_children
|
102
93
|
end
|
94
|
+
Asynchronic.logger.info('Asynchronic') { "Wakeup finalized #{type} (#{id})" }
|
95
|
+
|
96
|
+
parent.wakeup if parent && finalized?
|
103
97
|
end
|
104
98
|
|
105
99
|
def nest(type, params={})
|
@@ -182,6 +176,20 @@ module Asynchronic
|
|
182
176
|
end
|
183
177
|
end
|
184
178
|
|
179
|
+
def wakeup_children
|
180
|
+
if waiting?
|
181
|
+
if processes.any?(&:aborted?)
|
182
|
+
abort! Error.new "Error caused by #{processes.select(&:aborted?).map{|p| p.name}.join(', ')}"
|
183
|
+
elsif processes.all?(&:completed?)
|
184
|
+
completed!
|
185
|
+
else
|
186
|
+
processes.each do |p|
|
187
|
+
p.enqueue if p.ready?
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
185
193
|
def infer_dependencies(params)
|
186
194
|
params.values.select { |v| v.respond_to?(:proxy?) && v.proxy_class == DataStore::LazyValue }
|
187
195
|
.map { |v| Process.new(environment, v.data_store.scope).name }
|
data/lib/asynchronic/version.rb
CHANGED
@@ -23,5 +23,12 @@ describe Asynchronic::QueueEngine::Synchronic do
|
|
23
23
|
process = Asynchronic[pid]
|
24
24
|
process.result.must_equal 20
|
25
25
|
end
|
26
|
+
|
27
|
+
it 'Graph job' do
|
28
|
+
pid = GraphJob.enqueue input: 100
|
29
|
+
process = Asynchronic[pid]
|
30
|
+
process.must_be_completed
|
31
|
+
process.result.must_equal '10%' => 20, '20%' => 40
|
32
|
+
end
|
26
33
|
|
27
34
|
end
|
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.2.
|
4
|
+
version: 1.2.2
|
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-01-
|
11
|
+
date: 2017-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|