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/middleware.rb
CHANGED
data/lib/dynflow/persistence.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'dynflow/persistence_adapters'
|
3
4
|
|
4
5
|
module Dynflow
|
5
|
-
|
6
6
|
class Persistence
|
7
|
-
|
8
7
|
include Algebrick::TypeCheck
|
9
8
|
|
10
9
|
attr_reader :adapter
|
@@ -18,9 +17,9 @@ module Dynflow
|
|
18
17
|
end
|
19
18
|
|
20
19
|
def load_action(step)
|
21
|
-
attributes = adapter
|
22
|
-
|
23
|
-
|
20
|
+
attributes = adapter
|
21
|
+
.load_action(step.execution_plan_id, step.action_id)
|
22
|
+
.update(step: step, phase: step.phase)
|
24
23
|
return Action.from_hash(attributes, step.world)
|
25
24
|
end
|
26
25
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'sequel'
|
3
4
|
require 'msgpack'
|
4
5
|
require 'fileutils'
|
@@ -7,7 +8,6 @@ require 'csv'
|
|
7
8
|
# rubocop:disable Metrics/ClassLength
|
8
9
|
module Dynflow
|
9
10
|
module PersistenceAdapters
|
10
|
-
|
11
11
|
Sequel.extension :migration
|
12
12
|
Sequel.database_timezone = :utc
|
13
13
|
|
@@ -67,10 +67,10 @@ module Dynflow
|
|
67
67
|
table_name = :execution_plan
|
68
68
|
options[:order_by] ||= :started_at
|
69
69
|
data_set = filter(table_name,
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
70
|
+
order(table_name,
|
71
|
+
paginate(table(table_name), options),
|
72
|
+
options),
|
73
|
+
options[:filters])
|
74
74
|
data_set.all.map { |record| execution_plan_column_map(load_data(record, table_name)) }
|
75
75
|
end
|
76
76
|
|
@@ -80,7 +80,7 @@ module Dynflow
|
|
80
80
|
|
81
81
|
def find_execution_plan_statuses(options)
|
82
82
|
plans = filter(:execution_plan, table(:execution_plan), options[:filters])
|
83
|
-
|
83
|
+
.select(:uuid, :state, :result)
|
84
84
|
|
85
85
|
plans.each_with_object({}) do |current, acc|
|
86
86
|
uuid = current.delete(:uuid)
|
@@ -99,7 +99,7 @@ module Dynflow
|
|
99
99
|
backup_to_csv(:step, steps, backup_dir, 'steps.csv') if backup_dir
|
100
100
|
steps.delete
|
101
101
|
|
102
|
-
|
102
|
+
table(:output_chunk).where(execution_plan_uuid: uuids).delete
|
103
103
|
|
104
104
|
actions = table(:action).where(execution_plan_uuid: uuids)
|
105
105
|
backup_to_csv(:action, actions, backup_dir, 'actions.csv') if backup_dir
|
@@ -169,7 +169,7 @@ module Dynflow
|
|
169
169
|
|
170
170
|
def save_step(execution_plan_id, step_id, value, update_conditions = {})
|
171
171
|
save :step, { execution_plan_uuid: execution_plan_id, id: step_id }, value,
|
172
|
-
|
172
|
+
with_data: false, update_conditions: update_conditions
|
173
173
|
end
|
174
174
|
|
175
175
|
def load_action(execution_plan_id, action_id)
|
@@ -254,7 +254,7 @@ module Dynflow
|
|
254
254
|
|
255
255
|
def update_coordinator_record(class_name, record_id, value)
|
256
256
|
coordinator_feature!
|
257
|
-
save :coordinator_record, {class: class_name, :id => record_id}, value
|
257
|
+
save :coordinator_record, { class: class_name, :id => record_id }, value
|
258
258
|
end
|
259
259
|
|
260
260
|
def delete_coordinator_record(class_name, record_id)
|
@@ -365,7 +365,7 @@ module Dynflow
|
|
365
365
|
|
366
366
|
def load_record(what, condition)
|
367
367
|
table = table(what)
|
368
|
-
if (record = with_retry { table.first(Utils.symbolize_keys(condition)) }
|
368
|
+
if (record = with_retry { table.first(Utils.symbolize_keys(condition)) })
|
369
369
|
load_data(record, what)
|
370
370
|
else
|
371
371
|
raise KeyError, "searching: #{what} by: #{condition.inspect}"
|
@@ -491,13 +491,13 @@ module Dynflow
|
|
491
491
|
end
|
492
492
|
|
493
493
|
if filters.key?('caller_execution_plan_id')
|
494
|
-
data_set = data_set.join_table(:inner, TABLES[:action], :execution_plan_uuid => :uuid)
|
495
|
-
|
494
|
+
data_set = data_set.join_table(:inner, TABLES[:action], :execution_plan_uuid => :uuid)
|
495
|
+
.select_all(TABLES[:execution_plan]).distinct
|
496
496
|
end
|
497
497
|
if filters.key?('delayed')
|
498
498
|
filters.delete('delayed')
|
499
|
-
data_set = data_set.join_table(:inner, TABLES[:delayed], :execution_plan_uuid => :uuid)
|
500
|
-
|
499
|
+
data_set = data_set.join_table(:inner, TABLES[:delayed], :execution_plan_uuid => :uuid)
|
500
|
+
.select_all(TABLES[:execution_plan]).distinct
|
501
501
|
end
|
502
502
|
end
|
503
503
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
Sequel.migration do
|
3
4
|
up do
|
4
5
|
create_table(:dynflow_execution_plans) do
|
@@ -33,7 +34,7 @@ Sequel.migration do
|
|
33
34
|
index [:execution_plan_uuid, :id], :unique => true
|
34
35
|
column :action_id, Integer
|
35
36
|
foreign_key [:execution_plan_uuid, :action_id], :dynflow_actions,
|
36
|
-
|
37
|
+
name: :dynflow_steps_execution_plan_uuid_fkey1
|
37
38
|
index [:execution_plan_uuid, :action_id]
|
38
39
|
|
39
40
|
column :data, String, text: true
|
@@ -1,45 +1,50 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
def to_uuid(table_name, column_name)
|
3
|
-
set_column_type(table_name, column_name, :uuid, :using => "#{column_name}::uuid")
|
4
|
-
end
|
5
|
-
|
6
|
-
def from_uuid(table_name, column_name)
|
7
|
-
set_column_type table_name, column_name, String, primary_key: true, size: 36, fixed: true
|
8
|
-
end
|
9
2
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
drop_foreign_key [:execution_plan_uuid]
|
14
|
-
end
|
15
|
-
alter_table :dynflow_steps do
|
16
|
-
drop_foreign_key [:execution_plan_uuid]
|
17
|
-
drop_foreign_key [:execution_plan_uuid, :action_id], :name => :dynflow_steps_execution_plan_uuid_fkey1
|
3
|
+
helper = Module.new do
|
4
|
+
def to_uuid(table_name, column_name)
|
5
|
+
set_column_type(table_name, column_name, :uuid, :using => "#{column_name}::uuid")
|
18
6
|
end
|
19
|
-
|
20
|
-
|
7
|
+
|
8
|
+
def from_uuid(table_name, column_name)
|
9
|
+
set_column_type table_name, column_name, String, primary_key: true, size: 36, fixed: true
|
21
10
|
end
|
22
11
|
|
23
|
-
block
|
12
|
+
def with_foreign_key_recreation(&block)
|
13
|
+
# Drop the foreign key constraints so we can change the column type
|
14
|
+
alter_table :dynflow_actions do
|
15
|
+
drop_foreign_key [:execution_plan_uuid]
|
16
|
+
end
|
17
|
+
alter_table :dynflow_steps do
|
18
|
+
drop_foreign_key [:execution_plan_uuid]
|
19
|
+
drop_foreign_key [:execution_plan_uuid, :action_id], :name => :dynflow_steps_execution_plan_uuid_fkey1
|
20
|
+
end
|
21
|
+
alter_table :dynflow_delayed_plans do
|
22
|
+
drop_foreign_key [:execution_plan_uuid]
|
23
|
+
end
|
24
|
+
|
25
|
+
block.call
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
27
|
+
# Recreat the foreign key constraints as they were before
|
28
|
+
alter_table :dynflow_actions do
|
29
|
+
add_foreign_key [:execution_plan_uuid], :dynflow_execution_plans
|
30
|
+
end
|
31
|
+
alter_table :dynflow_steps do
|
32
|
+
add_foreign_key [:execution_plan_uuid], :dynflow_execution_plans
|
33
|
+
add_foreign_key [:execution_plan_uuid, :action_id], :dynflow_actions,
|
34
|
+
:name => :dynflow_steps_execution_plan_uuid_fkey1
|
35
|
+
end
|
36
|
+
alter_table :dynflow_delayed_plans do
|
37
|
+
add_foreign_key [:execution_plan_uuid], :dynflow_execution_plans,
|
38
|
+
:name => :dynflow_scheduled_plans_execution_plan_uuid_fkey
|
39
|
+
end
|
37
40
|
end
|
38
41
|
end
|
39
42
|
|
40
43
|
Sequel.migration do
|
41
44
|
up do
|
42
45
|
if database_type.to_s.include?('postgres')
|
46
|
+
Sequel::Postgres::Database.include helper
|
47
|
+
|
43
48
|
with_foreign_key_recreation do
|
44
49
|
to_uuid :dynflow_execution_plans, :uuid
|
45
50
|
to_uuid :dynflow_actions, :execution_plan_uuid
|
@@ -51,6 +56,8 @@ Sequel.migration do
|
|
51
56
|
|
52
57
|
down do
|
53
58
|
if database_type.to_s.include?('postgres')
|
59
|
+
Sequel::Postgres::Database.include helper
|
60
|
+
|
54
61
|
with_foreign_key_recreation do
|
55
62
|
from_uuid :dynflow_execution_plans, :uuid
|
56
63
|
from_uuid :dynflow_actions, :execution_plan_uuid
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
Sequel.migration do
|
3
4
|
up do
|
4
5
|
type = database_type
|
@@ -6,16 +7,16 @@ Sequel.migration do
|
|
6
7
|
primary_key :id
|
7
8
|
|
8
9
|
column_properties = if type.to_s.include?('postgres')
|
9
|
-
{type: :uuid}
|
10
|
+
{ type: :uuid }
|
10
11
|
else
|
11
|
-
{type: String, size: 36, fixed: true, null: false}
|
12
|
+
{ type: String, size: 36, fixed: true, null: false }
|
12
13
|
end
|
13
14
|
foreign_key :execution_plan_uuid, :dynflow_execution_plans, **column_properties
|
14
15
|
index :execution_plan_uuid
|
15
16
|
|
16
17
|
column :action_id, Integer, null: false
|
17
18
|
foreign_key [:execution_plan_uuid, :action_id], :dynflow_actions,
|
18
|
-
|
19
|
+
name: :dynflow_output_chunks_execution_plan_uuid_fkey1
|
19
20
|
index [:execution_plan_uuid, :action_id]
|
20
21
|
|
21
22
|
column :chunk, String, text: true
|
data/lib/dynflow/rails/daemon.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'fileutils'
|
3
4
|
require 'get_process_mem'
|
4
5
|
require 'dynflow/watchers/memory_consumption_watcher'
|
@@ -175,7 +176,6 @@ module Dynflow
|
|
175
176
|
else raise "Unknown unit: #{unit.inspect}!"
|
176
177
|
end
|
177
178
|
end
|
178
|
-
|
179
179
|
end
|
180
180
|
end
|
181
181
|
end
|
data/lib/dynflow/rails.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# frozen_string_literal: true
|
3
|
+
|
3
4
|
module Dynflow
|
4
5
|
# Class for configuring and preparing the Dynflow runtime environment.
|
5
6
|
class Rails
|
@@ -32,8 +33,8 @@ module Dynflow
|
|
32
33
|
return @world if @world
|
33
34
|
|
34
35
|
if config.lazy_initialization && defined?(::PhusionPassenger)
|
35
|
-
config.dynflow_logger
|
36
|
-
|
36
|
+
config.dynflow_logger
|
37
|
+
.warn('Dynflow: lazy loading with PhusionPassenger might lead to unexpected results')
|
37
38
|
end
|
38
39
|
init_world.tap do |world|
|
39
40
|
@world = world
|
data/lib/dynflow/round_robin.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Dynflow
|
3
4
|
# A simple round-robin scheduling implementation used at various
|
4
5
|
# places in Dynflow
|
@@ -19,7 +20,7 @@ module Dynflow
|
|
19
20
|
end
|
20
21
|
|
21
22
|
def next
|
22
|
-
@cursor = 0 if @cursor > @data.size-1
|
23
|
+
@cursor = 0 if @cursor > @data.size - 1
|
23
24
|
@data[@cursor]
|
24
25
|
ensure
|
25
26
|
@cursor += 1
|
@@ -35,4 +36,3 @@ module Dynflow
|
|
35
36
|
attr_writer :data
|
36
37
|
end
|
37
38
|
end
|
38
|
-
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Dynflow
|
3
4
|
module Semaphores
|
4
5
|
class Aggregating < Abstract
|
5
|
-
|
6
6
|
attr_reader :children, :waiting
|
7
7
|
|
8
8
|
def initialize(children)
|
@@ -58,7 +58,6 @@ module Dynflow
|
|
58
58
|
@children[key].release n
|
59
59
|
end
|
60
60
|
end
|
61
|
-
|
62
61
|
end
|
63
62
|
end
|
64
63
|
end
|
data/lib/dynflow/semaphores.rb
CHANGED
data/lib/dynflow/serializable.rb
CHANGED
data/lib/dynflow/serializer.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'algebrick/serializer'
|
3
4
|
|
4
5
|
module Dynflow
|
@@ -7,7 +8,6 @@ module Dynflow
|
|
7
8
|
end
|
8
9
|
|
9
10
|
class Serializer < Algebrick::Serializer
|
10
|
-
|
11
11
|
ARBITRARY_TYPE_KEY = :class
|
12
12
|
MARSHAL_KEY = :marshaled
|
13
13
|
|
@@ -38,7 +38,7 @@ module Dynflow
|
|
38
38
|
end
|
39
39
|
|
40
40
|
if (type_name = other[ARBITRARY_TYPE_KEY] || other[ARBITRARY_TYPE_KEY.to_s])
|
41
|
-
if type_name == 'Time' && (
|
41
|
+
if type_name == 'Time' && (time_str = other['value'])
|
42
42
|
return Serializable.send(:string_to_time, time_str)
|
43
43
|
end
|
44
44
|
type = Utils.constantize(type_name) rescue nil
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Dynflow
|
3
4
|
module Serializers
|
4
5
|
# @abstract
|
@@ -6,7 +7,6 @@ module Dynflow
|
|
6
7
|
# Used by {DelayedPlan} to store arguments which should be passed into
|
7
8
|
# the {Dynflow::Action}'s #plan method when the plan is executed.
|
8
9
|
class Abstract
|
9
|
-
|
10
10
|
attr_reader :args, :serialized_args
|
11
11
|
|
12
12
|
# @param args [Array] arguments to be serialized
|
@@ -65,7 +65,6 @@ module Dynflow
|
|
65
65
|
def deserialize(arg)
|
66
66
|
raise NotImplementedError
|
67
67
|
end
|
68
|
-
|
69
68
|
end
|
70
69
|
end
|
71
70
|
end
|
data/lib/dynflow/serializers.rb
CHANGED