dynflow 1.0.0 → 1.0.1
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 +5 -5
- data/lib/dynflow/delayed_executors/abstract_core.rb +15 -1
- data/lib/dynflow/executors.rb +2 -1
- data/lib/dynflow/version.rb +1 -1
- data/test/future_execution_test.rb +14 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 35bd7c7bd52da4f68946edb03d5d388d09f53cea
|
4
|
+
data.tar.gz: 35800095dee5a7edc92ed87d605edc66e8190c34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2415804bf8a2c1a0b502db7bf685915aa7ae90365bd3316db269bdd187fa0d98357e1452181f23cbcf779c495fa4293046336a5ae700926b59566d9f47fe0187
|
7
|
+
data.tar.gz: 9fb0b84f75bcc2055d523d61a706393eeb14479ce5939b73ec0d3b242aaf888c3a129a561acea88b598bcf3954b99deae3ea4919eede8b04f729e33b3dc6b528
|
@@ -46,8 +46,12 @@ module Dynflow
|
|
46
46
|
def process(delayed_plans, check_time)
|
47
47
|
processed_plan_uuids = []
|
48
48
|
delayed_plans.each do |plan|
|
49
|
+
fix_plan_state(plan)
|
49
50
|
with_error_handling do
|
50
|
-
if
|
51
|
+
if plan.execution_plan.state != :scheduled
|
52
|
+
# in case the previous process was terminated after running the plan, but before deleting the delayed plan record.
|
53
|
+
@logger.info("Execution plan #{plan.execution_plan_uuid} is expected to be in 'scheduled' state, was '#{plan.execution_plan.state}', skipping")
|
54
|
+
elsif !plan.start_before.nil? && plan.start_before < check_time
|
51
55
|
@logger.debug "Failing plan #{plan.execution_plan_uuid}"
|
52
56
|
plan.timeout
|
53
57
|
else
|
@@ -63,6 +67,16 @@ module Dynflow
|
|
63
67
|
world.persistence.delete_delayed_plans(:execution_plan_uuid => processed_plan_uuids) unless processed_plan_uuids.empty?
|
64
68
|
end
|
65
69
|
|
70
|
+
private
|
71
|
+
|
72
|
+
# handle the case, where the process was termintated while planning was in progress before
|
73
|
+
def fix_plan_state(plan)
|
74
|
+
if plan.execution_plan.state == :planning
|
75
|
+
@logger.info("Execution plan #{plan.execution_plan_uuid} is expected to be in 'scheduled' state, was '#{plan.execution_plan.state}', auto-fixing")
|
76
|
+
plan.execution_plan.set_state(:scheduled, true)
|
77
|
+
plan.execution_plan.save
|
78
|
+
end
|
79
|
+
end
|
66
80
|
end
|
67
81
|
end
|
68
82
|
end
|
data/lib/dynflow/executors.rb
CHANGED
@@ -8,9 +8,10 @@ module Dynflow
|
|
8
8
|
# we should wrap it with this method, and we can ensure here to do
|
9
9
|
# necessary cleanup, such as cleaning ActiveRecord connections
|
10
10
|
def self.run_user_code
|
11
|
+
clear_connections = defined?(::ActiveRecord) && ActiveRecord::Base.connected? && ActiveRecord::Base.connection.open_transactions.zero?
|
11
12
|
yield
|
12
13
|
ensure
|
13
|
-
::ActiveRecord::Base.clear_active_connections! if
|
14
|
+
::ActiveRecord::Base.clear_active_connections! if clear_connections
|
14
15
|
end
|
15
16
|
|
16
17
|
end
|
data/lib/dynflow/version.rb
CHANGED
@@ -25,6 +25,20 @@ module Dynflow
|
|
25
25
|
end
|
26
26
|
let(:execution_plan) { delayed_plan.execution_plan }
|
27
27
|
|
28
|
+
describe 'abstract executor' do
|
29
|
+
let(:abstract_delayed_executor) { DelayedExecutors::AbstractCore.new(world) }
|
30
|
+
|
31
|
+
it 'handles wrong plan state' do
|
32
|
+
delayed_plan.execution_plan.state = :planning
|
33
|
+
abstract_delayed_executor.send(:process, [delayed_plan], @start_at)
|
34
|
+
delayed_plan.execution_plan.state.must_equal :planned
|
35
|
+
|
36
|
+
delayed_plan.execution_plan.set_state(:running, true)
|
37
|
+
abstract_delayed_executor.send(:process, [delayed_plan], @start_at)
|
38
|
+
delayed_plan.execution_plan.state.must_equal :running
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
28
42
|
it 'returns the progress as 0' do
|
29
43
|
execution_plan.progress.must_equal 0
|
30
44
|
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.0.
|
4
|
+
version: 1.0.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: 2018-
|
12
|
+
date: 2018-04-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -602,7 +602,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
602
602
|
version: '0'
|
603
603
|
requirements: []
|
604
604
|
rubyforge_project:
|
605
|
-
rubygems_version: 2.
|
605
|
+
rubygems_version: 2.6.12
|
606
606
|
signing_key:
|
607
607
|
specification_version: 4
|
608
608
|
summary: DYNamic workFLOW engine
|