dynflow 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/lib/dynflow/action.rb +0 -1
- data/lib/dynflow/executors.rb +1 -0
- data/lib/dynflow/executors/parallel/pool.rb +11 -27
- data/lib/dynflow/version.rb +1 -1
- data/lib/dynflow/web/console.rb +0 -3
- data/test/executor_test.rb +9 -9
- data/test/world_test.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '00091e6971f6c6bbcc56f3a03564b2de6f437db1985375caa2171d3f9859a0f7'
|
4
|
+
data.tar.gz: e48ae6152594e70147b362b1e7ae4b0923cc645d38005af56b69c9e6f1cd5a31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e00b1eb7cf2bd103fe79d8a0e3046143f77548c380b2504b4fc3093b5c4a4929160f704f781e0565eacefb7cf493bd7b5ec6a8f5c2a5b0490e3f521285513a73
|
7
|
+
data.tar.gz: 1d3aef7335990a1ff72fecd0b36bb444227f0f216aaf44677d66d453a8d29b470a58e7d2ccee4349ba341a12a4ca14306d6d4c5167f5ac7e375c36fed19362cd
|
data/.travis.yml
CHANGED
data/lib/dynflow/action.rb
CHANGED
data/lib/dynflow/executors.rb
CHANGED
@@ -4,19 +4,15 @@ module Dynflow
|
|
4
4
|
class Pool < Actor
|
5
5
|
class JobStorage
|
6
6
|
def initialize
|
7
|
-
@
|
8
|
-
@jobs = Hash.new { |h, k| h[k] = [] }
|
7
|
+
@jobs = []
|
9
8
|
end
|
10
9
|
|
11
10
|
def add(work)
|
12
|
-
@
|
13
|
-
@jobs[work.execution_plan_id] << work
|
11
|
+
@jobs << work
|
14
12
|
end
|
15
13
|
|
16
14
|
def pop
|
17
|
-
|
18
|
-
execution_plan_id = @round_robin.next
|
19
|
-
@jobs[execution_plan_id].shift.tap { delete execution_plan_id if @jobs[execution_plan_id].empty? }
|
15
|
+
@jobs.shift
|
20
16
|
end
|
21
17
|
|
22
18
|
def queue_size
|
@@ -27,27 +23,15 @@ module Dynflow
|
|
27
23
|
@jobs.empty?
|
28
24
|
end
|
29
25
|
|
30
|
-
def
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
acc.update(plan_id => work_items.count)
|
26
|
+
def queue_size(execution_plan_id = nil)
|
27
|
+
if execution_plan_id
|
28
|
+
@jobs.count do |item|
|
29
|
+
item.respond_to?(:execution_plan_id) && item.execution_plan_id == execution_plan_id
|
30
|
+
end
|
31
|
+
else
|
32
|
+
@jobs.size
|
38
33
|
end
|
39
34
|
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
def tracked?(work)
|
44
|
-
@jobs.has_key? work.execution_plan_id
|
45
|
-
end
|
46
|
-
|
47
|
-
def delete(execution_plan_id)
|
48
|
-
@round_robin.delete execution_plan_id
|
49
|
-
@jobs.delete execution_plan_id
|
50
|
-
end
|
51
35
|
end
|
52
36
|
|
53
37
|
def initialize(world, core, name, pool_size, transaction_adapter)
|
@@ -89,7 +73,7 @@ module Dynflow
|
|
89
73
|
def execution_status(execution_plan_id = nil)
|
90
74
|
{ :pool_size => @pool_size,
|
91
75
|
:free_workers => @free_workers.count,
|
92
|
-
:
|
76
|
+
:queue_size => @jobs.queue_size(execution_plan_id) }
|
93
77
|
end
|
94
78
|
|
95
79
|
private
|
data/lib/dynflow/version.rb
CHANGED
data/lib/dynflow/web/console.rb
CHANGED
@@ -41,9 +41,6 @@ module Dynflow
|
|
41
41
|
load_worlds
|
42
42
|
@executors.each do |w|
|
43
43
|
hash = world.get_execution_status(w.data['id'], nil, 5).value!
|
44
|
-
hash.each do |_queue_name, info|
|
45
|
-
info[:queue_size] = info[:execution_status].values.reduce(:+) || 0
|
46
|
-
end
|
47
44
|
w.data.update(:status => hash)
|
48
45
|
end
|
49
46
|
erb :worlds
|
data/test/executor_test.rb
CHANGED
@@ -594,12 +594,12 @@ module Dynflow
|
|
594
594
|
let(:storage) { Dynflow::Executors::Parallel::Pool::JobStorage.new }
|
595
595
|
it do
|
596
596
|
storage.must_be_empty
|
597
|
-
storage.
|
597
|
+
storage.queue_size.must_equal(0)
|
598
598
|
storage.pop.must_be_nil
|
599
599
|
storage.pop.must_be_nil
|
600
600
|
|
601
601
|
storage.add s = FakeStep.new(1)
|
602
|
-
storage.
|
602
|
+
storage.queue_size.must_equal(1)
|
603
603
|
storage.pop.must_equal s
|
604
604
|
storage.must_be_empty
|
605
605
|
storage.pop.must_be_nil
|
@@ -611,19 +611,19 @@ module Dynflow
|
|
611
611
|
storage.add s22 = FakeStep.new(2)
|
612
612
|
storage.add s31 = FakeStep.new(3)
|
613
613
|
|
614
|
-
storage.
|
615
|
-
storage.
|
616
|
-
storage.
|
614
|
+
storage.queue_size(1).must_equal(3)
|
615
|
+
storage.queue_size(4).must_equal(0)
|
616
|
+
storage.queue_size.must_equal(6)
|
617
617
|
|
618
|
-
storage.pop.must_equal s21
|
619
|
-
storage.pop.must_equal s31
|
620
618
|
storage.pop.must_equal s11
|
621
|
-
storage.pop.must_equal s22
|
622
619
|
storage.pop.must_equal s12
|
623
620
|
storage.pop.must_equal s13
|
621
|
+
storage.pop.must_equal s21
|
622
|
+
storage.pop.must_equal s22
|
623
|
+
storage.pop.must_equal s31
|
624
624
|
|
625
625
|
storage.must_be_empty
|
626
|
-
storage.
|
626
|
+
storage.queue_size.must_equal(0)
|
627
627
|
storage.pop.must_be_nil
|
628
628
|
end
|
629
629
|
end
|
data/test/world_test.rb
CHANGED
@@ -24,16 +24,16 @@ module Dynflow
|
|
24
24
|
|
25
25
|
describe '#get_execution_status' do
|
26
26
|
let(:base) do
|
27
|
-
{ :default => { :pool_size => 5, :free_workers => 5, :
|
28
|
-
:slow => { :pool_size=> 1, :free_workers=> 1, :
|
27
|
+
{ :default => { :pool_size => 5, :free_workers => 5, :queue_size => 0 },
|
28
|
+
:slow => { :pool_size=> 1, :free_workers=> 1, :queue_size => 0} }
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'retrieves correct execution items count' do
|
32
32
|
world.get_execution_status(world.id, nil, 5).value!.must_equal(base)
|
33
33
|
id = 'something like uuid'
|
34
34
|
expected = base.dup
|
35
|
-
expected[:default][:
|
36
|
-
expected[:slow][:
|
35
|
+
expected[:default][:queue_size] = 0
|
36
|
+
expected[:slow][:queue_size] = 0
|
37
37
|
world.get_execution_status(world.id, id, 5).value!.must_equal(expected)
|
38
38
|
end
|
39
39
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Necas
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-01-
|
12
|
+
date: 2019-01-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|