dynflow 1.3.0 → 1.4.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/.rubocop.yml +1 -1
- data/.travis.yml +3 -4
- data/Dockerfile +9 -0
- data/Gemfile +6 -0
- data/Rakefile +1 -0
- data/doc/pages/Gemfile +1 -0
- data/doc/pages/Rakefile +1 -0
- data/doc/pages/plugins/alert_block.rb +1 -0
- data/doc/pages/plugins/div_tag.rb +1 -0
- data/doc/pages/plugins/graphviz.rb +1 -0
- data/doc/pages/plugins/plantuml.rb +1 -0
- data/doc/pages/plugins/play.rb +1 -0
- data/doc/pages/plugins/tags.rb +1 -0
- data/doc/pages/plugins/toc.rb +1 -0
- data/docker-compose.yml +41 -0
- data/dynflow.gemspec +1 -0
- data/examples/clock_benchmark.rb +1 -0
- data/examples/example_helper.rb +19 -2
- data/examples/future_execution.rb +2 -1
- data/examples/memory_limit_watcher.rb +1 -0
- data/examples/orchestrate.rb +4 -5
- data/examples/orchestrate_evented.rb +3 -2
- data/examples/remote_executor.rb +68 -0
- data/examples/singletons.rb +4 -3
- data/examples/sub_plan_concurrency_control.rb +2 -1
- data/examples/sub_plans.rb +3 -2
- data/examples/termination.rb +1 -0
- data/lib/dynflow.rb +20 -0
- data/lib/dynflow/action.rb +28 -3
- data/lib/dynflow/action/cancellable.rb +1 -0
- data/lib/dynflow/action/format.rb +1 -0
- data/lib/dynflow/action/missing.rb +1 -0
- data/lib/dynflow/action/polling.rb +3 -1
- data/lib/dynflow/action/progress.rb +1 -0
- data/lib/dynflow/action/rescue.rb +1 -0
- data/lib/dynflow/action/singleton.rb +1 -0
- data/lib/dynflow/action/suspended.rb +9 -2
- data/lib/dynflow/action/timeouts.rb +2 -1
- data/lib/dynflow/action/with_bulk_sub_plans.rb +2 -1
- data/lib/dynflow/action/with_polling_sub_plans.rb +7 -5
- data/lib/dynflow/action/with_sub_plans.rb +1 -0
- data/lib/dynflow/active_job/queue_adapter.rb +1 -0
- data/lib/dynflow/actor.rb +13 -5
- data/lib/dynflow/actors.rb +1 -0
- data/lib/dynflow/actors/execution_plan_cleaner.rb +1 -0
- data/lib/dynflow/clock.rb +27 -47
- data/lib/dynflow/config.rb +11 -2
- data/lib/dynflow/connectors.rb +1 -0
- data/lib/dynflow/connectors/abstract.rb +1 -0
- data/lib/dynflow/connectors/database.rb +1 -0
- data/lib/dynflow/connectors/direct.rb +1 -0
- data/lib/dynflow/coordinator.rb +1 -0
- data/lib/dynflow/coordinator_adapters.rb +1 -0
- data/lib/dynflow/coordinator_adapters/abstract.rb +1 -0
- data/lib/dynflow/coordinator_adapters/sequel.rb +1 -0
- data/lib/dynflow/dead_letter_silencer.rb +2 -0
- data/lib/dynflow/debug/telemetry/persistence.rb +1 -0
- data/lib/dynflow/delayed_executors.rb +1 -0
- data/lib/dynflow/delayed_executors/abstract.rb +1 -0
- data/lib/dynflow/delayed_executors/abstract_core.rb +1 -0
- data/lib/dynflow/delayed_executors/polling.rb +1 -0
- data/lib/dynflow/delayed_plan.rb +1 -0
- data/lib/dynflow/director.rb +80 -15
- data/lib/dynflow/director/execution_plan_manager.rb +17 -3
- data/lib/dynflow/director/flow_manager.rb +1 -0
- data/lib/dynflow/director/{work_queue.rb → queue_hash.rb} +9 -8
- data/lib/dynflow/director/running_steps_manager.rb +55 -18
- data/lib/dynflow/director/sequence_cursor.rb +1 -0
- data/lib/dynflow/director/sequential_manager.rb +12 -2
- data/lib/dynflow/dispatcher.rb +4 -2
- data/lib/dynflow/dispatcher/abstract.rb +1 -0
- data/lib/dynflow/dispatcher/client_dispatcher.rb +6 -4
- data/lib/dynflow/dispatcher/executor_dispatcher.rb +13 -1
- data/lib/dynflow/errors.rb +1 -0
- data/lib/dynflow/execution_history.rb +1 -0
- data/lib/dynflow/execution_plan.rb +3 -2
- data/lib/dynflow/execution_plan/dependency_graph.rb +1 -0
- data/lib/dynflow/execution_plan/hooks.rb +1 -0
- data/lib/dynflow/execution_plan/output_reference.rb +2 -1
- data/lib/dynflow/execution_plan/steps.rb +1 -0
- data/lib/dynflow/execution_plan/steps/abstract.rb +10 -5
- data/lib/dynflow/execution_plan/steps/abstract_flow_step.rb +2 -0
- data/lib/dynflow/execution_plan/steps/error.rb +1 -0
- data/lib/dynflow/execution_plan/steps/finalize_step.rb +1 -0
- data/lib/dynflow/execution_plan/steps/plan_step.rb +1 -0
- data/lib/dynflow/execution_plan/steps/run_step.rb +1 -0
- data/lib/dynflow/executors.rb +1 -1
- data/lib/dynflow/executors/abstract/core.rb +132 -0
- data/lib/dynflow/executors/parallel.rb +24 -11
- data/lib/dynflow/executors/parallel/core.rb +10 -91
- data/lib/dynflow/executors/parallel/pool.rb +4 -2
- data/lib/dynflow/executors/parallel/worker.rb +2 -1
- data/lib/dynflow/executors/sidekiq/core.rb +121 -0
- data/lib/dynflow/executors/sidekiq/internal_job_base.rb +24 -0
- data/lib/dynflow/executors/sidekiq/orchestrator_jobs.rb +60 -0
- data/lib/dynflow/executors/sidekiq/redis_locking.rb +69 -0
- data/lib/dynflow/executors/sidekiq/serialization.rb +33 -0
- data/lib/dynflow/executors/sidekiq/worker_jobs.rb +42 -0
- data/lib/dynflow/flows.rb +1 -0
- data/lib/dynflow/flows/abstract.rb +1 -0
- data/lib/dynflow/flows/abstract_composed.rb +1 -0
- data/lib/dynflow/flows/atom.rb +1 -0
- data/lib/dynflow/flows/concurrence.rb +1 -0
- data/lib/dynflow/flows/sequence.rb +1 -0
- data/lib/dynflow/logger_adapters.rb +1 -0
- data/lib/dynflow/logger_adapters/abstract.rb +1 -0
- data/lib/dynflow/logger_adapters/delegator.rb +1 -0
- data/lib/dynflow/logger_adapters/formatters.rb +1 -0
- data/lib/dynflow/logger_adapters/formatters/abstract.rb +1 -0
- data/lib/dynflow/logger_adapters/formatters/exception.rb +1 -0
- data/lib/dynflow/logger_adapters/simple.rb +1 -0
- data/lib/dynflow/middleware.rb +1 -0
- data/lib/dynflow/middleware/common/singleton.rb +1 -0
- data/lib/dynflow/middleware/common/transaction.rb +1 -0
- data/lib/dynflow/middleware/register.rb +1 -0
- data/lib/dynflow/middleware/resolver.rb +1 -0
- data/lib/dynflow/middleware/stack.rb +1 -0
- data/lib/dynflow/middleware/world.rb +1 -0
- data/lib/dynflow/persistence.rb +3 -2
- data/lib/dynflow/persistence_adapters.rb +1 -0
- data/lib/dynflow/persistence_adapters/abstract.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel.rb +10 -7
- data/lib/dynflow/persistence_adapters/sequel_migrations/001_initial.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/002_incremental_progress.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/003_parent_action.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/004_coordinator_records.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/005_envelopes.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/006_fix_data_length.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/007_future_execution.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/008_rename_scheduled_plans_to_delayed_plans.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/009_fix_mysql_data_length.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/010_add_execution_plans_label.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/011_placeholder.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/012_add_delayed_plans_serialized_args.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/013_add_action_columns.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/014_add_step_columns.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/015_add_execution_plan_columns.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/016_add_step_queue.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/017_add_delayed_plan_frozen.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/018_add_uuid_column.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/019_update_mysql_time_precision.rb +48 -0
- data/lib/dynflow/rails.rb +1 -0
- data/lib/dynflow/rails/configuration.rb +6 -3
- data/lib/dynflow/rails/daemon.rb +1 -0
- data/lib/dynflow/round_robin.rb +1 -0
- data/lib/dynflow/semaphores.rb +1 -0
- data/lib/dynflow/semaphores/abstract.rb +1 -0
- data/lib/dynflow/semaphores/aggregating.rb +1 -0
- data/lib/dynflow/semaphores/dummy.rb +1 -0
- data/lib/dynflow/semaphores/stateful.rb +1 -0
- data/lib/dynflow/serializable.rb +13 -4
- data/lib/dynflow/serializer.rb +24 -0
- data/lib/dynflow/serializers.rb +1 -0
- data/lib/dynflow/serializers/abstract.rb +1 -0
- data/lib/dynflow/serializers/noop.rb +1 -0
- data/lib/dynflow/stateful.rb +1 -0
- data/lib/dynflow/telemetry.rb +1 -0
- data/lib/dynflow/telemetry_adapters/abstract.rb +1 -0
- data/lib/dynflow/telemetry_adapters/dummy.rb +1 -0
- data/lib/dynflow/telemetry_adapters/statsd.rb +1 -0
- data/lib/dynflow/testing.rb +1 -0
- data/lib/dynflow/testing/assertions.rb +6 -5
- data/lib/dynflow/testing/dummy_execution_plan.rb +1 -0
- data/lib/dynflow/testing/dummy_executor.rb +19 -2
- data/lib/dynflow/testing/dummy_planned_action.rb +1 -0
- data/lib/dynflow/testing/dummy_step.rb +3 -1
- data/lib/dynflow/testing/dummy_world.rb +9 -0
- data/lib/dynflow/testing/factories.rb +6 -1
- data/lib/dynflow/testing/in_thread_executor.rb +22 -3
- data/lib/dynflow/testing/in_thread_world.rb +9 -0
- data/lib/dynflow/testing/managed_clock.rb +1 -0
- data/lib/dynflow/testing/mimic.rb +1 -0
- data/lib/dynflow/throttle_limiter.rb +1 -0
- data/lib/dynflow/transaction_adapters.rb +1 -0
- data/lib/dynflow/transaction_adapters/abstract.rb +1 -0
- data/lib/dynflow/transaction_adapters/active_record.rb +1 -0
- data/lib/dynflow/transaction_adapters/none.rb +1 -0
- data/lib/dynflow/utils.rb +1 -0
- data/lib/dynflow/utils/indifferent_hash.rb +1 -0
- data/lib/dynflow/utils/priority_queue.rb +1 -0
- data/lib/dynflow/version.rb +2 -1
- data/lib/dynflow/watchers/memory_consumption_watcher.rb +1 -0
- data/lib/dynflow/web.rb +1 -0
- data/lib/dynflow/web/console.rb +1 -0
- data/lib/dynflow/web/console_helpers.rb +1 -0
- data/lib/dynflow/web/filtering_helpers.rb +1 -0
- data/lib/dynflow/web/world_helpers.rb +1 -0
- data/lib/dynflow/web_console.rb +1 -0
- data/lib/dynflow/world.rb +11 -1
- data/lib/dynflow/world/invalidation.rb +7 -1
- data/test/abnormal_states_recovery_test.rb +41 -40
- data/test/action_test.rb +160 -110
- data/test/activejob_adapter_test.rb +1 -0
- data/test/batch_sub_tasks_test.rb +12 -11
- data/test/clock_test.rb +2 -1
- data/test/concurrency_control_test.rb +20 -19
- data/test/coordinator_test.rb +20 -21
- data/test/daemon_test.rb +2 -1
- data/test/dead_letter_silencer_test.rb +9 -7
- data/test/dispatcher_test.rb +2 -1
- data/test/execution_plan_cleaner_test.rb +13 -12
- data/test/execution_plan_hooks_test.rb +3 -2
- data/test/execution_plan_test.rb +33 -32
- data/test/executor_test.rb +533 -489
- data/test/future_execution_test.rb +45 -44
- data/test/memory_cosumption_watcher_test.rb +5 -4
- data/test/middleware_test.rb +55 -54
- data/test/persistence_test.rb +56 -53
- data/test/rescue_test.rb +36 -35
- data/test/round_robin_test.rb +13 -12
- data/test/semaphores_test.rb +31 -30
- data/test/support/code_workflow_example.rb +1 -0
- data/test/support/dummy_example.rb +14 -1
- data/test/support/middleware_example.rb +2 -1
- data/test/support/rails/config/environment.rb +1 -0
- data/test/support/rescue_example.rb +1 -0
- data/test/support/test_execution_log.rb +1 -0
- data/test/test_helper.rb +18 -17
- data/test/testing_test.rb +45 -44
- data/test/utils_test.rb +18 -17
- data/test/web_console_test.rb +1 -0
- data/test/world_test.rb +7 -6
- metadata +13 -4
- data/lib/dynflow/executors/abstract.rb +0 -40
data/test/testing_test.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require_relative 'test_helper'
|
2
3
|
|
3
4
|
module Dynflow
|
@@ -13,11 +14,11 @@ module Dynflow
|
|
13
14
|
input = { 'input' => 'input' }
|
14
15
|
action = create_and_plan_action Support::DummyExample::WeightedPolling, input
|
15
16
|
|
16
|
-
action.must_be_kind_of Support::DummyExample::WeightedPolling
|
17
|
-
action.phase.must_equal Action::Plan
|
18
|
-
action.input.must_equal input
|
19
|
-
action.execution_plan.must_be_kind_of Testing::DummyExecutionPlan
|
20
|
-
action.state.must_equal :success
|
17
|
+
_(action).must_be_kind_of Support::DummyExample::WeightedPolling
|
18
|
+
_(action.phase).must_equal Action::Plan
|
19
|
+
_(action.input).must_equal input
|
20
|
+
_(action.execution_plan).must_be_kind_of Testing::DummyExecutionPlan
|
21
|
+
_(action.state).must_equal :success
|
21
22
|
assert_run_phase action
|
22
23
|
assert_finalize_phase action
|
23
24
|
assert_action_planned action, Support::DummyExample::Polling
|
@@ -31,13 +32,13 @@ module Dynflow
|
|
31
32
|
end
|
32
33
|
plan_action(action, {})
|
33
34
|
stubbed_action = action.execution_plan.planned_plan_steps.first
|
34
|
-
stubbed_action.test.must_equal "test"
|
35
|
+
_(stubbed_action.test).must_equal "test"
|
35
36
|
end
|
36
37
|
|
37
38
|
specify '#create_action_presentation' do
|
38
39
|
action = create_action_presentation(Support::DummyExample::WeightedPolling)
|
39
40
|
action.output['message'] = 'make the world a better place'
|
40
|
-
action.humanized_output.must_equal 'You should make the world a better place'
|
41
|
+
_(action.humanized_output).must_equal 'You should make the world a better place'
|
41
42
|
end
|
42
43
|
|
43
44
|
specify '#run_action without suspend' do
|
@@ -45,12 +46,12 @@ module Dynflow
|
|
45
46
|
plan = create_and_plan_action Support::DummyExample::WeightedPolling, input
|
46
47
|
action = run_action plan
|
47
48
|
|
48
|
-
action.must_be_kind_of Support::DummyExample::WeightedPolling
|
49
|
-
action.phase.must_equal Action::Run
|
50
|
-
action.input.must_equal input
|
51
|
-
action.world.must_equal plan.world
|
52
|
-
action.run_step_id.wont_equal action.plan_step_id
|
53
|
-
action.state.must_equal :success
|
49
|
+
_(action).must_be_kind_of Support::DummyExample::WeightedPolling
|
50
|
+
_(action.phase).must_equal Action::Run
|
51
|
+
_(action.input).must_equal input
|
52
|
+
_(action.world).must_equal plan.world
|
53
|
+
_(action.run_step_id).wont_equal action.plan_step_id
|
54
|
+
_(action.state).must_equal :success
|
54
55
|
end
|
55
56
|
|
56
57
|
specify '#run_action with suspend' do
|
@@ -58,25 +59,25 @@ module Dynflow
|
|
58
59
|
plan = create_and_plan_action Support::DummyExample::Polling, input
|
59
60
|
action = run_action plan
|
60
61
|
|
61
|
-
action.output.must_equal 'task' => { 'progress' => 0, 'done' => false }
|
62
|
-
action.run_progress.must_equal 0
|
62
|
+
_(action.output).must_equal 'task' => { 'progress' => 0, 'done' => false }
|
63
|
+
_(action.run_progress).must_equal 0
|
63
64
|
|
64
65
|
3.times { progress_action_time action }
|
65
|
-
action.output.must_equal('task' => { 'progress' => 30, 'done' => false } ,
|
66
|
+
_(action.output).must_equal('task' => { 'progress' => 30, 'done' => false } ,
|
66
67
|
'poll_attempts' => {'total' => 2, 'failed'=> 0 })
|
67
|
-
action.run_progress.must_equal 0.3
|
68
|
+
_(action.run_progress).must_equal 0.3
|
68
69
|
|
69
70
|
run_action action, Dynflow::Action::Polling::Poll
|
70
71
|
run_action action, Dynflow::Action::Polling::Poll
|
71
|
-
action.output.must_equal('task' => { 'progress' => 50, 'done' => false },
|
72
|
+
_(action.output).must_equal('task' => { 'progress' => 50, 'done' => false },
|
72
73
|
'poll_attempts' => {'total' => 4, 'failed' => 0 })
|
73
|
-
action.run_progress.must_equal 0.5
|
74
|
+
_(action.run_progress).must_equal 0.5
|
74
75
|
|
75
76
|
5.times { progress_action_time action }
|
76
77
|
|
77
|
-
action.output.must_equal('task' => { 'progress' => 100, 'done' => true },
|
78
|
+
_(action.output).must_equal('task' => { 'progress' => 100, 'done' => true },
|
78
79
|
'poll_attempts' => {'total' => 9, 'failed' => 0 })
|
79
|
-
action.run_progress.must_equal 1
|
80
|
+
_(action.run_progress).must_equal 1
|
80
81
|
end
|
81
82
|
|
82
83
|
specify '#finalize_action' do
|
@@ -86,15 +87,15 @@ module Dynflow
|
|
86
87
|
$dummy_heavy_progress = false
|
87
88
|
action = finalize_action run
|
88
89
|
|
89
|
-
action.must_be_kind_of Support::DummyExample::WeightedPolling
|
90
|
-
action.phase.must_equal Action::Finalize
|
91
|
-
action.input.must_equal input
|
92
|
-
action.output.must_equal run.output
|
93
|
-
action.world.must_equal plan.world
|
94
|
-
action.finalize_step_id.wont_equal action.run_step_id
|
95
|
-
action.state.must_equal :success
|
90
|
+
_(action).must_be_kind_of Support::DummyExample::WeightedPolling
|
91
|
+
_(action.phase).must_equal Action::Finalize
|
92
|
+
_(action.input).must_equal input
|
93
|
+
_(action.output).must_equal run.output
|
94
|
+
_(action.world).must_equal plan.world
|
95
|
+
_(action.finalize_step_id).wont_equal action.run_step_id
|
96
|
+
_(action.state).must_equal :success
|
96
97
|
|
97
|
-
$dummy_heavy_progress.must_equal 'dummy_heavy_progress'
|
98
|
+
_($dummy_heavy_progress).must_equal 'dummy_heavy_progress'
|
98
99
|
end
|
99
100
|
end
|
100
101
|
|
@@ -104,7 +105,7 @@ module Dynflow
|
|
104
105
|
it 'plans' do
|
105
106
|
action = create_and_plan_action CWE::Commit, sha = 'commit-sha'
|
106
107
|
|
107
|
-
action.input.must_equal({})
|
108
|
+
_(action.input).must_equal({})
|
108
109
|
refute_run_phase action
|
109
110
|
refute_finalize_phase action
|
110
111
|
|
@@ -123,15 +124,15 @@ module Dynflow
|
|
123
124
|
let(:runned_action) { run_action planned_action }
|
124
125
|
|
125
126
|
it 'plans' do
|
126
|
-
planned_action.input.must_equal Utils.stringify_keys(input)
|
127
|
+
_(planned_action.input).must_equal Utils.stringify_keys(input)
|
127
128
|
assert_run_phase planned_action, { commit: "sha", reviewer: "name", result: true}
|
128
129
|
refute_finalize_phase planned_action
|
129
130
|
|
130
|
-
planned_action.execution_plan.planned_plan_steps.must_be_empty
|
131
|
+
_(planned_action.execution_plan.planned_plan_steps).must_be_empty
|
131
132
|
end
|
132
133
|
|
133
134
|
it 'runs' do
|
134
|
-
runned_action.output.fetch(:passed).must_equal runned_action.input.fetch(:result)
|
135
|
+
_(runned_action.output.fetch(:passed)).must_equal runned_action.input.fetch(:result)
|
135
136
|
end
|
136
137
|
end
|
137
138
|
|
@@ -143,15 +144,15 @@ module Dynflow
|
|
143
144
|
|
144
145
|
it 'plans' do
|
145
146
|
assert_run_phase planned_action do |input|
|
146
|
-
input[:commit].must_equal "sha"
|
147
|
+
_(input[:commit]).must_equal "sha"
|
147
148
|
end
|
148
149
|
refute_finalize_phase planned_action
|
149
150
|
|
150
|
-
planned_action.execution_plan.planned_plan_steps.must_be_empty
|
151
|
+
_(planned_action.execution_plan.planned_plan_steps).must_be_empty
|
151
152
|
end
|
152
153
|
|
153
154
|
it 'runs' do
|
154
|
-
runned_action.output.fetch(:passed).must_equal true
|
155
|
+
_(runned_action.output.fetch(:passed)).must_equal true
|
155
156
|
end
|
156
157
|
|
157
158
|
describe 'when something fails' do
|
@@ -160,7 +161,7 @@ module Dynflow
|
|
160
161
|
end
|
161
162
|
|
162
163
|
it 'runs' do
|
163
|
-
runned_action.output.fetch(:passed).must_equal false
|
164
|
+
_(runned_action.output.fetch(:passed)).must_equal false
|
164
165
|
end
|
165
166
|
end
|
166
167
|
end
|
@@ -196,7 +197,7 @@ module Dynflow
|
|
196
197
|
f.wait
|
197
198
|
|
198
199
|
f.value.tap do |plan|
|
199
|
-
plan.state.must_equal :stopped
|
200
|
+
_(plan.state).must_equal :stopped
|
200
201
|
end
|
201
202
|
end
|
202
203
|
end
|
@@ -228,7 +229,7 @@ module Dynflow
|
|
228
229
|
let :failed_execution_plan do
|
229
230
|
plan = world.plan(Support::CodeWorkflowExample::IncomingIssues, failing_issues_data)
|
230
231
|
plan = world.execute(plan.id).value
|
231
|
-
plan.state.must_equal :paused
|
232
|
+
_(plan.state).must_equal :paused
|
232
233
|
plan
|
233
234
|
end
|
234
235
|
|
@@ -238,19 +239,19 @@ module Dynflow
|
|
238
239
|
|
239
240
|
it "is able to execute plans inside the thread" do
|
240
241
|
world.execute(execution_plan.id).value.tap do |plan|
|
241
|
-
plan.state.must_equal :stopped
|
242
|
+
_(plan.state).must_equal :stopped
|
242
243
|
end
|
243
244
|
end
|
244
245
|
|
245
246
|
it "is able to handle errors in the plan" do
|
246
247
|
world.execute(failed_execution_plan.id).value.tap do |plan|
|
247
|
-
plan.state.must_equal :paused
|
248
|
+
_(plan.state).must_equal :paused
|
248
249
|
end
|
249
250
|
end
|
250
251
|
|
251
252
|
it "is able to handle when events" do
|
252
253
|
world.execute(polling_execution_plan.id).value.tap do |plan|
|
253
|
-
plan.state.must_equal :stopped
|
254
|
+
_(plan.state).must_equal :stopped
|
254
255
|
end
|
255
256
|
end
|
256
257
|
|
@@ -268,8 +269,8 @@ module Dynflow
|
|
268
269
|
end
|
269
270
|
|
270
271
|
it 'skips the action and continues automatically' do
|
271
|
-
execution_plan.state.must_equal :stopped
|
272
|
-
execution_plan.result.must_equal :warning
|
272
|
+
_(execution_plan.state).must_equal :stopped
|
273
|
+
_(execution_plan.result).must_equal :warning
|
273
274
|
end
|
274
275
|
end
|
275
276
|
end
|
data/test/utils_test.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require_relative 'test_helper'
|
2
3
|
|
3
4
|
module Dynflow
|
@@ -7,49 +8,49 @@ module Dynflow
|
|
7
8
|
|
8
9
|
it 'can insert elements' do
|
9
10
|
queue.push 1
|
10
|
-
queue.top.must_equal 1
|
11
|
+
_(queue.top).must_equal 1
|
11
12
|
queue.push 2
|
12
|
-
queue.top.must_equal 2
|
13
|
+
_(queue.top).must_equal 2
|
13
14
|
queue.push 3
|
14
|
-
queue.top.must_equal 3
|
15
|
-
queue.to_a.must_equal [1, 2, 3]
|
15
|
+
_(queue.top).must_equal 3
|
16
|
+
_(queue.to_a).must_equal [1, 2, 3]
|
16
17
|
end
|
17
18
|
|
18
19
|
it 'can override the comparator' do
|
19
20
|
queue = Utils::PriorityQueue.new { |a, b| b <=> a }
|
20
21
|
queue.push 1
|
21
|
-
queue.top.must_equal 1
|
22
|
+
_(queue.top).must_equal 1
|
22
23
|
queue.push 2
|
23
|
-
queue.top.must_equal 1
|
24
|
+
_(queue.top).must_equal 1
|
24
25
|
queue.push 3
|
25
|
-
queue.top.must_equal 1
|
26
|
-
queue.to_a.must_equal [3, 2, 1]
|
26
|
+
_(queue.top).must_equal 1
|
27
|
+
_(queue.to_a).must_equal [3, 2, 1]
|
27
28
|
end
|
28
29
|
|
29
30
|
it 'can inspect top element without removing it' do
|
30
|
-
queue.top
|
31
|
+
assert_nil queue.top
|
31
32
|
queue.push(1)
|
32
|
-
queue.top.must_equal 1
|
33
|
+
_(queue.top).must_equal 1
|
33
34
|
queue.push(3)
|
34
|
-
queue.top.must_equal 3
|
35
|
+
_(queue.top).must_equal 3
|
35
36
|
queue.push(2)
|
36
|
-
queue.top.must_equal 3
|
37
|
+
_(queue.top).must_equal 3
|
37
38
|
end
|
38
39
|
|
39
40
|
it 'can report size' do
|
40
41
|
count = 5
|
41
42
|
count.times { queue.push 1 }
|
42
|
-
queue.size.must_equal count
|
43
|
+
_(queue.size).must_equal count
|
43
44
|
end
|
44
45
|
|
45
46
|
it 'pops elements in correct order' do
|
46
47
|
queue.push 1
|
47
48
|
queue.push 3
|
48
49
|
queue.push 2
|
49
|
-
queue.pop.must_equal 3
|
50
|
-
queue.pop.must_equal 2
|
51
|
-
queue.pop.must_equal 1
|
52
|
-
queue.pop
|
50
|
+
_(queue.pop).must_equal 3
|
51
|
+
_(queue.pop).must_equal 2
|
52
|
+
_(queue.pop).must_equal 1
|
53
|
+
assert_nil queue.pop
|
53
54
|
end
|
54
55
|
end
|
55
56
|
end
|
data/test/web_console_test.rb
CHANGED
data/test/world_test.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require_relative 'test_helper'
|
2
3
|
require 'fileutils'
|
3
4
|
|
@@ -11,14 +12,14 @@ module Dynflow
|
|
11
12
|
it 'by default informs about the hostname and the pid running the world' do
|
12
13
|
registered_world = world.coordinator.find_worlds(false, id: world.id).first
|
13
14
|
registered_world.meta.delete('last_seen')
|
14
|
-
registered_world.meta.must_equal('hostname' => Socket.gethostname, 'pid' => Process.pid,
|
15
|
+
_(registered_world.meta).must_equal('hostname' => Socket.gethostname, 'pid' => Process.pid,
|
15
16
|
'queues' => { 'default' => { 'pool_size' => 5 },
|
16
17
|
'slow' => { 'pool_size' => 1 }})
|
17
18
|
end
|
18
19
|
|
19
20
|
it 'is configurable' do
|
20
21
|
registered_world = world.coordinator.find_worlds(false, id: world_with_custom_meta.id).first
|
21
|
-
registered_world.meta['fast'].must_equal true
|
22
|
+
_(registered_world.meta['fast']).must_equal true
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
@@ -29,24 +30,24 @@ module Dynflow
|
|
29
30
|
end
|
30
31
|
|
31
32
|
it 'retrieves correct execution items count' do
|
32
|
-
world.get_execution_status(world.id, nil, 5).value
|
33
|
+
_(world.get_execution_status(world.id, nil, 5).value!).must_equal(base)
|
33
34
|
id = 'something like uuid'
|
34
35
|
expected = base.dup
|
35
36
|
expected[:default][:queue_size] = 0
|
36
37
|
expected[:slow][:queue_size] = 0
|
37
|
-
world.get_execution_status(world.id, id, 5).value
|
38
|
+
_(world.get_execution_status(world.id, id, 5).value!).must_equal(expected)
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
41
42
|
describe '#terminate' do
|
42
43
|
it 'fires an event after termination' do
|
43
44
|
terminated_event = world.terminated
|
44
|
-
terminated_event.resolved
|
45
|
+
_(terminated_event.resolved?).must_equal false
|
45
46
|
world.terminate
|
46
47
|
# wait for termination process to finish, but don't block
|
47
48
|
# the test from running.
|
48
49
|
terminated_event.wait(10)
|
49
|
-
terminated_event.resolved
|
50
|
+
_(terminated_event.resolved?).must_equal true
|
50
51
|
end
|
51
52
|
end
|
52
53
|
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.
|
4
|
+
version: 1.4.0
|
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-
|
12
|
+
date: 2019-10-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -232,6 +232,7 @@ files:
|
|
232
232
|
- ".rubocop.yml"
|
233
233
|
- ".rubocop_todo.yml"
|
234
234
|
- ".travis.yml"
|
235
|
+
- Dockerfile
|
235
236
|
- Gemfile
|
236
237
|
- MIT-LICENSE
|
237
238
|
- README.md
|
@@ -369,6 +370,7 @@ files:
|
|
369
370
|
- doc/pages/source/index.md
|
370
371
|
- doc/pages/source/media/index.md
|
371
372
|
- doc/pages/source/projects/index.md
|
373
|
+
- docker-compose.yml
|
372
374
|
- dynflow.gemspec
|
373
375
|
- examples/clock_benchmark.rb
|
374
376
|
- examples/example_helper.rb
|
@@ -420,10 +422,10 @@ files:
|
|
420
422
|
- lib/dynflow/director.rb
|
421
423
|
- lib/dynflow/director/execution_plan_manager.rb
|
422
424
|
- lib/dynflow/director/flow_manager.rb
|
425
|
+
- lib/dynflow/director/queue_hash.rb
|
423
426
|
- lib/dynflow/director/running_steps_manager.rb
|
424
427
|
- lib/dynflow/director/sequence_cursor.rb
|
425
428
|
- lib/dynflow/director/sequential_manager.rb
|
426
|
-
- lib/dynflow/director/work_queue.rb
|
427
429
|
- lib/dynflow/dispatcher.rb
|
428
430
|
- lib/dynflow/dispatcher/abstract.rb
|
429
431
|
- lib/dynflow/dispatcher/client_dispatcher.rb
|
@@ -442,11 +444,17 @@ files:
|
|
442
444
|
- lib/dynflow/execution_plan/steps/plan_step.rb
|
443
445
|
- lib/dynflow/execution_plan/steps/run_step.rb
|
444
446
|
- lib/dynflow/executors.rb
|
445
|
-
- lib/dynflow/executors/abstract.rb
|
447
|
+
- lib/dynflow/executors/abstract/core.rb
|
446
448
|
- lib/dynflow/executors/parallel.rb
|
447
449
|
- lib/dynflow/executors/parallel/core.rb
|
448
450
|
- lib/dynflow/executors/parallel/pool.rb
|
449
451
|
- lib/dynflow/executors/parallel/worker.rb
|
452
|
+
- lib/dynflow/executors/sidekiq/core.rb
|
453
|
+
- lib/dynflow/executors/sidekiq/internal_job_base.rb
|
454
|
+
- lib/dynflow/executors/sidekiq/orchestrator_jobs.rb
|
455
|
+
- lib/dynflow/executors/sidekiq/redis_locking.rb
|
456
|
+
- lib/dynflow/executors/sidekiq/serialization.rb
|
457
|
+
- lib/dynflow/executors/sidekiq/worker_jobs.rb
|
450
458
|
- lib/dynflow/flows.rb
|
451
459
|
- lib/dynflow/flows/abstract.rb
|
452
460
|
- lib/dynflow/flows/abstract_composed.rb
|
@@ -489,6 +497,7 @@ files:
|
|
489
497
|
- lib/dynflow/persistence_adapters/sequel_migrations/016_add_step_queue.rb
|
490
498
|
- lib/dynflow/persistence_adapters/sequel_migrations/017_add_delayed_plan_frozen.rb
|
491
499
|
- lib/dynflow/persistence_adapters/sequel_migrations/018_add_uuid_column.rb
|
500
|
+
- lib/dynflow/persistence_adapters/sequel_migrations/019_update_mysql_time_precision.rb
|
492
501
|
- lib/dynflow/rails.rb
|
493
502
|
- lib/dynflow/rails/configuration.rb
|
494
503
|
- lib/dynflow/rails/daemon.rb
|
@@ -1,40 +0,0 @@
|
|
1
|
-
module Dynflow
|
2
|
-
module Executors
|
3
|
-
class Abstract
|
4
|
-
include Algebrick::TypeCheck
|
5
|
-
attr_reader :world, :logger
|
6
|
-
|
7
|
-
def initialize(world)
|
8
|
-
@world = Type! world, World
|
9
|
-
@logger = world.logger
|
10
|
-
end
|
11
|
-
|
12
|
-
# @param execution_plan_id [String] id of execution plan
|
13
|
-
# @param finished [Concurrent::Promises::ResolvableFuture]
|
14
|
-
# @param wait_for_acceptance [TrueClass|FalseClass] should the executor confirm receiving
|
15
|
-
# the event, disable if calling executor from within executor
|
16
|
-
# @return [Concurrent::Promises::ResolvableFuture]
|
17
|
-
# @raise when execution_plan_id is not accepted
|
18
|
-
def execute(execution_plan_id, finished = Concurrent::Promises.resolvable_future, wait_for_acceptance = true)
|
19
|
-
raise NotImplementedError
|
20
|
-
end
|
21
|
-
|
22
|
-
def event(execution_plan_id, step_id, event, future = Concurrent::Promises.resolvable_future)
|
23
|
-
raise NotImplementedError
|
24
|
-
end
|
25
|
-
|
26
|
-
def terminate(future = Concurrent::Promises.resolvable_future)
|
27
|
-
raise NotImplementedError
|
28
|
-
end
|
29
|
-
|
30
|
-
def execution_status(execution_plan_id = nil)
|
31
|
-
raise NotImplementedError
|
32
|
-
end
|
33
|
-
|
34
|
-
# @return [Concurrent::Promises::ResolvableFuture]
|
35
|
-
def initialized
|
36
|
-
raise NotImplementedError
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|