dynflow 1.8.2 → 1.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/.rubocop.yml +11 -5
- data/.rubocop_todo.yml +777 -345
- data/Gemfile +4 -3
- data/Rakefile +1 -0
- data/doc/pages/Gemfile +4 -3
- 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 +6 -6
- data/doc/pages/plugins/plantuml.rb +2 -3
- data/doc/pages/plugins/play.rb +1 -2
- data/doc/pages/plugins/tags.rb +2 -8
- data/doc/pages/plugins/toc.rb +1 -1
- data/dynflow.gemspec +11 -10
- data/examples/clock_benchmark.rb +1 -0
- data/examples/example_helper.rb +4 -3
- data/examples/future_execution.rb +0 -2
- data/examples/memory_limit_watcher.rb +8 -8
- data/examples/orchestrate.rb +9 -21
- data/examples/orchestrate_evented.rb +18 -33
- data/examples/remote_executor.rb +9 -11
- data/examples/singletons.rb +1 -0
- data/examples/sub_plan_concurrency_control.rb +0 -1
- data/examples/sub_plans.rb +1 -0
- data/examples/sub_plans_v2.rb +1 -0
- data/lib/dynflow/action/cancellable.rb +1 -0
- data/lib/dynflow/action/format.rb +1 -4
- data/lib/dynflow/action/missing.rb +4 -4
- data/lib/dynflow/action/polling.rb +2 -3
- data/lib/dynflow/action/progress.rb +1 -4
- data/lib/dynflow/action/rescue.rb +1 -2
- data/lib/dynflow/action/singleton.rb +1 -0
- data/lib/dynflow/action/suspended.rb +1 -0
- data/lib/dynflow/action/timeouts.rb +2 -1
- data/lib/dynflow/action/with_bulk_sub_plans.rb +1 -0
- data/lib/dynflow/action/with_polling_sub_plans.rb +1 -1
- data/lib/dynflow/action/with_sub_plans.rb +20 -19
- data/lib/dynflow/action.rb +37 -37
- data/lib/dynflow/active_job/queue_adapter.rb +2 -1
- data/lib/dynflow/actor.rb +2 -2
- data/lib/dynflow/actors/execution_plan_cleaner.rb +1 -0
- data/lib/dynflow/actors.rb +1 -0
- data/lib/dynflow/clock.rb +3 -4
- data/lib/dynflow/config.rb +6 -5
- data/lib/dynflow/connectors/abstract.rb +11 -10
- data/lib/dynflow/connectors/database.rb +2 -2
- data/lib/dynflow/connectors/direct.rb +2 -3
- data/lib/dynflow/connectors.rb +1 -0
- data/lib/dynflow/coordinator.rb +21 -9
- data/lib/dynflow/coordinator_adapters/abstract.rb +1 -0
- data/lib/dynflow/coordinator_adapters/sequel.rb +1 -0
- data/lib/dynflow/coordinator_adapters.rb +1 -2
- data/lib/dynflow/dead_letter_silencer.rb +1 -0
- data/lib/dynflow/debug/telemetry/persistence.rb +3 -2
- data/lib/dynflow/delayed_executors/abstract.rb +1 -2
- data/lib/dynflow/delayed_executors/abstract_core.rb +1 -1
- data/lib/dynflow/delayed_executors/polling.rb +1 -2
- data/lib/dynflow/delayed_executors.rb +1 -2
- data/lib/dynflow/delayed_plan.rb +6 -6
- data/lib/dynflow/director/execution_plan_manager.rb +1 -1
- data/lib/dynflow/director/flow_manager.rb +1 -0
- data/lib/dynflow/director/queue_hash.rb +2 -1
- data/lib/dynflow/director/running_steps_manager.rb +3 -2
- data/lib/dynflow/director/sequence_cursor.rb +1 -2
- data/lib/dynflow/director/sequential_manager.rb +1 -0
- data/lib/dynflow/director.rb +12 -11
- data/lib/dynflow/dispatcher/abstract.rb +1 -0
- data/lib/dynflow/dispatcher/client_dispatcher.rb +33 -33
- data/lib/dynflow/dispatcher/executor_dispatcher.rb +7 -6
- data/lib/dynflow/dispatcher.rb +8 -7
- data/lib/dynflow/errors.rb +1 -0
- data/lib/dynflow/execution_history.rb +2 -1
- data/lib/dynflow/execution_plan/dependency_graph.rb +1 -2
- data/lib/dynflow/execution_plan/hooks.rb +1 -1
- data/lib/dynflow/execution_plan/output_reference.rb +4 -4
- data/lib/dynflow/execution_plan/steps/abstract.rb +21 -20
- data/lib/dynflow/execution_plan/steps/abstract_flow_step.rb +1 -1
- data/lib/dynflow/execution_plan/steps/error.rb +10 -9
- data/lib/dynflow/execution_plan/steps/finalize_step.rb +1 -2
- data/lib/dynflow/execution_plan/steps/plan_step.rb +12 -11
- data/lib/dynflow/execution_plan/steps/run_step.rb +1 -1
- data/lib/dynflow/execution_plan/steps.rb +1 -2
- data/lib/dynflow/execution_plan.rb +46 -46
- data/lib/dynflow/executors/abstract/core.rb +4 -3
- data/lib/dynflow/executors/parallel/core.rb +3 -2
- data/lib/dynflow/executors/parallel/pool.rb +1 -4
- data/lib/dynflow/executors/parallel/worker.rb +1 -0
- data/lib/dynflow/executors/parallel.rb +3 -2
- data/lib/dynflow/executors/sidekiq/core.rb +2 -0
- data/lib/dynflow/executors/sidekiq/internal_job_base.rb +1 -0
- data/lib/dynflow/executors/sidekiq/orchestrator_jobs.rb +1 -0
- data/lib/dynflow/executors/sidekiq/redis_locking.rb +1 -0
- data/lib/dynflow/executors/sidekiq/serialization.rb +1 -0
- data/lib/dynflow/executors/sidekiq/worker_jobs.rb +1 -0
- data/lib/dynflow/executors.rb +1 -1
- data/lib/dynflow/extensions/msgpack.rb +5 -4
- data/lib/dynflow/extensions.rb +1 -0
- data/lib/dynflow/flows/abstract.rb +1 -1
- data/lib/dynflow/flows/abstract_composed.rb +1 -2
- data/lib/dynflow/flows/atom.rb +1 -2
- data/lib/dynflow/flows/concurrence.rb +1 -1
- data/lib/dynflow/flows/registry.rb +1 -0
- data/lib/dynflow/flows/sequence.rb +1 -1
- data/lib/dynflow/flows.rb +1 -2
- data/lib/dynflow/logger_adapters/abstract.rb +1 -1
- data/lib/dynflow/logger_adapters/delegator.rb +1 -1
- 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/formatters.rb +1 -0
- data/lib/dynflow/logger_adapters/simple.rb +6 -5
- data/lib/dynflow/logger_adapters.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 +2 -3
- data/lib/dynflow/middleware/stack.rb +1 -0
- data/lib/dynflow/middleware/world.rb +1 -2
- data/lib/dynflow/middleware.rb +1 -0
- data/lib/dynflow/persistence.rb +4 -5
- data/lib/dynflow/persistence_adapters/abstract.rb +1 -1
- data/lib/dynflow/persistence_adapters/sequel.rb +14 -14
- data/lib/dynflow/persistence_adapters/sequel_migrations/001_initial.rb +2 -1
- 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 -1
- 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 -1
- 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 +37 -30
- data/lib/dynflow/persistence_adapters/sequel_migrations/019_update_mysql_time_precision.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/020_drop_duplicate_indices.rb +1 -0
- data/lib/dynflow/persistence_adapters/sequel_migrations/021_create_output_chunks.rb +4 -3
- data/lib/dynflow/persistence_adapters/sequel_migrations/023_sqlite_workarounds.rb +1 -0
- data/lib/dynflow/persistence_adapters.rb +1 -0
- data/lib/dynflow/rails/configuration.rb +1 -0
- data/lib/dynflow/rails/daemon.rb +1 -1
- data/lib/dynflow/rails.rb +3 -2
- data/lib/dynflow/round_robin.rb +2 -2
- data/lib/dynflow/semaphores/abstract.rb +1 -1
- data/lib/dynflow/semaphores/aggregating.rb +1 -2
- data/lib/dynflow/semaphores/dummy.rb +1 -1
- data/lib/dynflow/semaphores/stateful.rb +1 -1
- data/lib/dynflow/semaphores.rb +1 -0
- data/lib/dynflow/serializable.rb +1 -0
- data/lib/dynflow/serializer.rb +2 -2
- data/lib/dynflow/serializers/abstract.rb +1 -2
- data/lib/dynflow/serializers/noop.rb +1 -2
- data/lib/dynflow/serializers.rb +1 -2
- data/lib/dynflow/stateful.rb +1 -0
- data/lib/dynflow/telemetry.rb +11 -10
- 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 +2 -1
- data/lib/dynflow/testing/assertions.rb +7 -7
- data/lib/dynflow/testing/dummy_coordinator.rb +1 -0
- data/lib/dynflow/testing/dummy_execution_plan.rb +1 -0
- data/lib/dynflow/testing/dummy_executor.rb +1 -0
- data/lib/dynflow/testing/dummy_planned_action.rb +3 -1
- data/lib/dynflow/testing/dummy_step.rb +1 -0
- data/lib/dynflow/testing/dummy_world.rb +1 -0
- data/lib/dynflow/testing/factories.rb +42 -37
- data/lib/dynflow/testing/in_thread_executor.rb +1 -0
- data/lib/dynflow/testing/in_thread_world.rb +1 -0
- data/lib/dynflow/testing/managed_clock.rb +1 -1
- data/lib/dynflow/testing/mimic.rb +4 -4
- data/lib/dynflow/testing.rb +1 -0
- data/lib/dynflow/throttle_limiter.rb +1 -1
- 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/transaction_adapters.rb +1 -2
- data/lib/dynflow/utils/indifferent_hash.rb +7 -1
- data/lib/dynflow/utils/priority_queue.rb +1 -0
- data/lib/dynflow/utils.rb +1 -1
- data/lib/dynflow/version.rb +2 -1
- data/lib/dynflow/watchers/memory_consumption_watcher.rb +1 -1
- data/lib/dynflow/web/console.rb +1 -3
- data/lib/dynflow/web/console_helpers.rb +5 -4
- data/lib/dynflow/web/filtering_helpers.rb +1 -0
- data/lib/dynflow/web/world_helpers.rb +1 -0
- data/lib/dynflow/web.rb +3 -3
- data/lib/dynflow/web_console.rb +1 -0
- data/lib/dynflow/world/invalidation.rb +9 -1
- data/lib/dynflow/world.rb +20 -20
- data/lib/dynflow.rb +3 -6
- data/test/abnormal_states_recovery_test.rb +4 -8
- data/test/action_test.rb +10 -18
- data/test/activejob_adapter_test.rb +2 -2
- data/test/batch_sub_tasks_test.rb +1 -1
- data/test/clock_test.rb +2 -3
- data/test/concurrency_control_test.rb +6 -7
- data/test/coordinator_test.rb +1 -0
- data/test/daemon_test.rb +3 -2
- data/test/dead_letter_silencer_test.rb +2 -1
- data/test/dispatcher_test.rb +4 -5
- data/test/execution_plan_cleaner_test.rb +1 -0
- data/test/execution_plan_hooks_test.rb +1 -0
- data/test/execution_plan_test.rb +10 -32
- data/test/executor_test.rb +20 -37
- data/test/extensions_test.rb +1 -0
- data/test/flows_test.rb +2 -2
- data/test/future_execution_test.rb +2 -3
- data/test/memory_cosumption_watcher_test.rb +1 -0
- data/test/middleware_test.rb +4 -6
- data/test/persistence_test.rb +26 -26
- data/test/redis_locking_test.rb +1 -0
- data/test/rescue_test.rb +3 -11
- data/test/round_robin_test.rb +1 -0
- data/test/semaphores_test.rb +5 -7
- data/test/support/code_workflow_example.rb +11 -28
- data/test/support/dummy_example.rb +20 -19
- data/test/support/middleware_example.rb +2 -8
- data/test/support/rescue_example.rb +1 -14
- data/test/support/test_execution_log.rb +1 -2
- data/test/test_helper.rb +3 -7
- data/test/testing_test.rb +6 -8
- data/test/utils_test.rb +1 -0
- data/test/v2_sub_plans_test.rb +1 -0
- data/test/web_console_test.rb +4 -4
- data/test/world_test.rb +4 -3
- metadata +43 -43
data/lib/dynflow/telemetry.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'dynflow/telemetry_adapters/abstract'
|
3
4
|
require 'dynflow/telemetry_adapters/dummy'
|
4
5
|
require 'dynflow/telemetry_adapters/statsd'
|
@@ -18,7 +19,7 @@ module Dynflow
|
|
18
19
|
# Passes the block into the current telemetry adapter's
|
19
20
|
# {TelemetryAdapters::Abstract#with_instance} method
|
20
21
|
def with_instance(&block)
|
21
|
-
@instance.with_instance
|
22
|
+
@instance.with_instance(&block)
|
22
23
|
end
|
23
24
|
|
24
25
|
def measure(name, tags = {}, &block)
|
@@ -33,32 +34,32 @@ module Dynflow
|
|
33
34
|
with_instance do |t|
|
34
35
|
# Worker related
|
35
36
|
t.add_gauge :dynflow_active_workers, 'The number of currently busy workers',
|
36
|
-
|
37
|
+
[:queue, :world]
|
37
38
|
t.add_counter :dynflow_worker_events, 'The number of processed events',
|
38
|
-
|
39
|
+
[:queue, :world, :worker]
|
39
40
|
|
40
41
|
# Execution plan related
|
41
42
|
t.add_gauge :dynflow_active_execution_plans, 'The number of active execution plans',
|
42
|
-
|
43
|
+
[:action, :world, :state]
|
43
44
|
t.add_gauge :dynflow_queue_size, 'Number of items in queue',
|
44
|
-
|
45
|
+
[:queue, :world]
|
45
46
|
t.add_counter :dynflow_finished_execution_plans, 'The number of execution plans',
|
46
|
-
|
47
|
+
[:action, :world, :result]
|
47
48
|
|
48
49
|
# Step related
|
49
50
|
# TODO: Configure buckets in a sane manner
|
50
51
|
t.add_histogram :dynflow_step_real_time, 'The time between the start end end of the step',
|
51
|
-
|
52
|
+
[:action, :phase]
|
52
53
|
t.add_histogram :dynflow_step_execution_time, 'The time spent executing a step',
|
53
|
-
|
54
|
+
[:action, :phase]
|
54
55
|
|
55
56
|
# Connector related
|
56
57
|
t.add_counter :dynflow_connector_envelopes, 'The number of envelopes handled by a connector',
|
57
|
-
|
58
|
+
[:world, :direction]
|
58
59
|
|
59
60
|
# Persistence related
|
60
61
|
t.add_histogram :dynflow_persistence, 'The time spent communicating with the database',
|
61
|
-
|
62
|
+
[:world, :method]
|
62
63
|
end
|
63
64
|
end
|
64
65
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Dynflow
|
3
4
|
module TelemetryAdapters
|
4
5
|
class StatsD < Abstract
|
@@ -42,7 +43,7 @@ module Dynflow
|
|
42
43
|
def name_tag_mapping(name, tags)
|
43
44
|
instances = @instances[name]
|
44
45
|
return name if instances.nil? || instances.empty?
|
45
|
-
(name.to_s + '.' + instances.map {|x| tags[x]}.compact.join('.')).tr('-:/ ', '____')
|
46
|
+
(name.to_s + '.' + instances.map { |x| tags[x] }.compact.join('.')).tr('-:/ ', '____')
|
46
47
|
end
|
47
48
|
end
|
48
49
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Dynflow
|
3
4
|
module Testing
|
4
5
|
module Assertions
|
@@ -15,8 +16,8 @@ module Dynflow
|
|
15
16
|
end
|
16
17
|
|
17
18
|
assert(!found.empty?,
|
18
|
-
|
19
|
-
|
19
|
+
"Action #{planned_action_class} with plan_input #{plan_input} was not planned, " +
|
20
|
+
"there were only #{found_classes.map(&:plan_input)}")
|
20
21
|
found
|
21
22
|
end
|
22
23
|
|
@@ -24,8 +25,8 @@ module Dynflow
|
|
24
25
|
def assert_action_planned(action, planned_action_class)
|
25
26
|
Match! action.phase, Action::Plan
|
26
27
|
Match! action.state, :success
|
27
|
-
found = action.execution_plan.planned_plan_steps
|
28
|
-
|
28
|
+
found = action.execution_plan.planned_plan_steps
|
29
|
+
.select { |a| a.is_a?(planned_action_class) }
|
29
30
|
|
30
31
|
assert(!found.empty?, "Action #{planned_action_class} was not planned")
|
31
32
|
found
|
@@ -34,8 +35,8 @@ module Dynflow
|
|
34
35
|
def refute_action_planned(action, planned_action_class)
|
35
36
|
Match! action.phase, Action::Plan
|
36
37
|
Match! action.state, :success
|
37
|
-
found = action.execution_plan.planned_plan_steps
|
38
|
-
|
38
|
+
found = action.execution_plan.planned_plan_steps
|
39
|
+
.select { |a| a.is_a?(planned_action_class) }
|
39
40
|
|
40
41
|
assert(found.empty?, "Action #{planned_action_class} was planned")
|
41
42
|
found
|
@@ -74,7 +75,6 @@ module Dynflow
|
|
74
75
|
Match! action.state, :success
|
75
76
|
_(action.execution_plan.planned_finalize_steps).wont_include action
|
76
77
|
end
|
77
|
-
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Dynflow
|
3
4
|
module Testing
|
4
5
|
class DummyPlannedAction
|
@@ -8,7 +9,8 @@ module Dynflow
|
|
8
9
|
def initialize(klass)
|
9
10
|
mimic! klass
|
10
11
|
@output = ExecutionPlan::OutputReference.new(
|
11
|
-
|
12
|
+
Testing.get_id.to_s, Testing.get_id, Testing.get_id
|
13
|
+
)
|
12
14
|
end
|
13
15
|
|
14
16
|
def execute(execution_plan, event, from_subscription, *args)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Dynflow
|
3
4
|
module Testing
|
4
5
|
module Factories
|
@@ -9,14 +10,15 @@ module Dynflow
|
|
9
10
|
execution_plan = DummyExecutionPlan.new
|
10
11
|
step = DummyStep.new
|
11
12
|
action_class.new(
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
{ step: DummyStep.new,
|
14
|
+
execution_plan_id: execution_plan.id,
|
15
|
+
id: Testing.get_id,
|
16
|
+
phase: Action::Plan,
|
17
|
+
plan_step_id: step.id,
|
18
|
+
run_step_id: nil,
|
19
|
+
finalize_step_id: nil },
|
20
|
+
execution_plan.world
|
21
|
+
).tap do |action|
|
20
22
|
action.set_plan_context(execution_plan, trigger, false)
|
21
23
|
end
|
22
24
|
end
|
@@ -24,22 +26,23 @@ module Dynflow
|
|
24
26
|
def create_action_presentation(action_class)
|
25
27
|
execution_plan = DummyExecutionPlan.new
|
26
28
|
action_class.new(
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
{ execution_plan: execution_plan,
|
30
|
+
execution_plan_id: execution_plan.id,
|
31
|
+
id: Testing.get_id,
|
32
|
+
phase: Action::Present,
|
33
|
+
plan_step_id: 1,
|
34
|
+
run_step_id: nil,
|
35
|
+
finalize_step_id: nil,
|
36
|
+
input: nil },
|
37
|
+
execution_plan.world
|
38
|
+
)
|
36
39
|
end
|
37
40
|
|
38
41
|
# @return [Action::PlanPhase]
|
39
42
|
def plan_action(plan_action, *args, &block)
|
40
43
|
Match! plan_action.phase, Action::Plan
|
41
44
|
|
42
|
-
plan_action.execute
|
45
|
+
plan_action.execute(*args, &block)
|
43
46
|
raise plan_action.error if plan_action.error
|
44
47
|
plan_action
|
45
48
|
end
|
@@ -58,15 +61,16 @@ module Dynflow
|
|
58
61
|
step = DummyStep.new
|
59
62
|
run_action = if plan_action.phase == Action::Plan
|
60
63
|
plan_action.class.new(
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
64
|
+
{ step: step,
|
65
|
+
execution_plan_id: plan_action.execution_plan_id,
|
66
|
+
id: plan_action.id,
|
67
|
+
plan_step_id: plan_action.plan_step_id,
|
68
|
+
run_step_id: step.id,
|
69
|
+
finalize_step_id: nil,
|
70
|
+
phase: Action::Run,
|
71
|
+
input: plan_action.input },
|
72
|
+
plan_action.world
|
73
|
+
)
|
70
74
|
|
71
75
|
else
|
72
76
|
plan_action
|
@@ -85,22 +89,23 @@ module Dynflow
|
|
85
89
|
Match! run_action.phase, Action::Plan, Action::Run
|
86
90
|
step = DummyStep.new
|
87
91
|
finalize_action = run_action.class.new(
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
92
|
+
{ step: step,
|
93
|
+
execution_plan_id: run_action.execution_plan_id,
|
94
|
+
id: run_action.id,
|
95
|
+
plan_step_id: run_action.plan_step_id,
|
96
|
+
run_step_id: run_action.run_step_id,
|
97
|
+
finalize_step_id: step.id,
|
98
|
+
phase: Action::Finalize,
|
99
|
+
input: run_action.input },
|
100
|
+
run_action.world
|
101
|
+
)
|
97
102
|
|
98
103
|
stubbing.call finalize_action if stubbing
|
99
104
|
finalize_action.execute
|
100
105
|
finalize_action
|
101
106
|
end
|
102
107
|
|
103
|
-
def progress_action_time
|
108
|
+
def progress_action_time(action)
|
104
109
|
Match! action.phase, Action::Run
|
105
110
|
if action.world.clock.progress
|
106
111
|
return action.world.executor.progress
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Dynflow
|
3
4
|
module Testing
|
4
|
-
|
5
5
|
# when extended into Class or an_object it makes all instances of the class or the object
|
6
6
|
# mimic the supplied types. It does so by hooking into kind_of? method.
|
7
7
|
# @example
|
@@ -18,7 +18,7 @@ module Dynflow
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def mimic!(*types)
|
21
|
-
define
|
21
|
+
define = ->_ do
|
22
22
|
define_method :mimic_types do
|
23
23
|
types
|
24
24
|
end
|
@@ -30,9 +30,9 @@ module Dynflow
|
|
30
30
|
end
|
31
31
|
|
32
32
|
if self.kind_of? ::Class
|
33
|
-
self.class_eval
|
33
|
+
self.class_eval(&define)
|
34
34
|
else
|
35
|
-
self.singleton_class.class_eval
|
35
|
+
self.singleton_class.class_eval(&define)
|
36
36
|
end
|
37
37
|
|
38
38
|
self
|
data/lib/dynflow/testing.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Dynflow
|
3
4
|
module Utils
|
4
5
|
# Heavily inpired by ActiveSupport::HashWithIndifferentAccess,
|
@@ -84,7 +85,7 @@ module Dynflow
|
|
84
85
|
end
|
85
86
|
|
86
87
|
def reverse_merge!(other_hash)
|
87
|
-
replace(reverse_merge(
|
88
|
+
replace(reverse_merge(other_hash))
|
88
89
|
end
|
89
90
|
|
90
91
|
def replace(other_hash)
|
@@ -96,9 +97,13 @@ module Dynflow
|
|
96
97
|
end
|
97
98
|
|
98
99
|
def stringify_keys!; self end
|
100
|
+
|
99
101
|
def deep_stringify_keys!; self end
|
102
|
+
|
100
103
|
def stringify_keys; dup end
|
104
|
+
|
101
105
|
def deep_stringify_keys; dup end
|
106
|
+
|
102
107
|
def to_options!; self end
|
103
108
|
|
104
109
|
def select(*args, &block)
|
@@ -119,6 +124,7 @@ module Dynflow
|
|
119
124
|
end
|
120
125
|
|
121
126
|
protected
|
127
|
+
|
122
128
|
def convert_key(key)
|
123
129
|
key.kind_of?(Symbol) ? key.to_s : key
|
124
130
|
end
|
data/lib/dynflow/utils.rb
CHANGED
data/lib/dynflow/version.rb
CHANGED
data/lib/dynflow/web/console.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
|
2
1
|
# frozen_string_literal: true
|
2
|
+
|
3
3
|
module Dynflow
|
4
4
|
module Web
|
5
5
|
class Console < Sinatra::Base
|
6
|
-
|
7
6
|
set :public_folder, Web.web_dir('assets')
|
8
7
|
set :views, Web.web_dir('views')
|
9
8
|
set :per_page, 10
|
@@ -107,7 +106,6 @@ module Dynflow
|
|
107
106
|
redirect(url "/#{plan.id}?notice=#{url_encode('The step does not support cancelling')}")
|
108
107
|
end
|
109
108
|
end
|
110
|
-
|
111
109
|
end
|
112
110
|
end
|
113
111
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Dynflow
|
3
4
|
module Web
|
4
5
|
module ConsoleHelpers
|
@@ -36,7 +37,7 @@ module Dynflow
|
|
36
37
|
pretty_value = prettify_value(value)
|
37
38
|
<<-HTML
|
38
39
|
<pre class="prettyprint lang-yaml">#{h(pretty_value)}</pre>
|
39
|
-
|
40
|
+
HTML
|
40
41
|
else
|
41
42
|
""
|
42
43
|
end
|
@@ -90,7 +91,7 @@ module Dynflow
|
|
90
91
|
<b>#{h(label)}</b>
|
91
92
|
#{value_html}
|
92
93
|
</p>
|
93
|
-
|
94
|
+
HTML
|
94
95
|
else
|
95
96
|
""
|
96
97
|
end
|
@@ -177,9 +178,9 @@ module Dynflow
|
|
177
178
|
checkboxes = values.map do |value|
|
178
179
|
field_filter = filtering_options[:filters][field]
|
179
180
|
checked = field_filter && field_filter.include?(value)
|
180
|
-
%{<input type="checkbox" name="filters[#{field}][]" value="#{value}" #{
|
181
|
+
%{<input type="checkbox" name="filters[#{field}][]" value="#{value}" #{"checked" if checked}/>#{value}}
|
181
182
|
end.join(' ')
|
182
|
-
out
|
183
|
+
out %= checkboxes
|
183
184
|
return out
|
184
185
|
end
|
185
186
|
end
|
data/lib/dynflow/web.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'dynflow'
|
3
4
|
require 'pp'
|
4
5
|
require 'sinatra/base'
|
@@ -6,11 +7,10 @@ require 'yaml'
|
|
6
7
|
|
7
8
|
module Dynflow
|
8
9
|
module Web
|
9
|
-
|
10
10
|
def self.setup(&block)
|
11
|
-
console = Sinatra.new(Web::Console) { instance_exec(&block)}
|
11
|
+
console = Sinatra.new(Web::Console) { instance_exec(&block) }
|
12
12
|
Rack::Builder.app do
|
13
|
-
run Rack::URLMap.new('/'
|
13
|
+
run Rack::URLMap.new('/' => console)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
data/lib/dynflow/web_console.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Dynflow
|
3
4
|
class World
|
4
5
|
module Invalidation
|
@@ -116,7 +117,14 @@ module Dynflow
|
|
116
117
|
# @return [Integer] number of invalidated worlds
|
117
118
|
def perform_validity_checks
|
118
119
|
world_invalidation_result = worlds_validity_check
|
119
|
-
locks_validity_check
|
120
|
+
locks_validity_check.each do |lock|
|
121
|
+
case lock
|
122
|
+
when ::Dynflow::Coordinator::PlanningLock
|
123
|
+
invalidate_planning_lock(lock)
|
124
|
+
when ::Dynflow::Coordinator::ExecutionLock
|
125
|
+
invalidate_execution_lock(lock)
|
126
|
+
end
|
127
|
+
end
|
120
128
|
pruned = connector.prune_undeliverable_envelopes(self)
|
121
129
|
logger.error("Pruned #{pruned} undeliverable envelopes") unless pruned.zero?
|
122
130
|
world_invalidation_result.values.select { |result| result == :invalidated }.size
|