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/Gemfile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
source 'https://rubygems.org'
|
3
4
|
|
4
5
|
gemspec
|
@@ -13,8 +14,8 @@ group :pry do
|
|
13
14
|
end
|
14
15
|
|
15
16
|
group :sidekiq do
|
16
|
-
gem 'sidekiq'
|
17
17
|
gem 'gitlab-sidekiq-fetcher', :require => 'sidekiq-reliable-fetch'
|
18
|
+
gem 'sidekiq'
|
18
19
|
end
|
19
20
|
|
20
21
|
group :postgresql do
|
@@ -26,7 +27,7 @@ group :mysql do
|
|
26
27
|
end
|
27
28
|
|
28
29
|
group :lint do
|
29
|
-
gem 'rubocop', '0.
|
30
|
+
gem 'theforeman-rubocop', '~> 0.0.4'
|
30
31
|
end
|
31
32
|
|
32
33
|
group :memory_watcher do
|
@@ -35,8 +36,8 @@ end
|
|
35
36
|
|
36
37
|
group :rails do
|
37
38
|
gem 'daemons'
|
38
|
-
gem 'rails', '>= 4.2.9', '< 7'
|
39
39
|
gem 'logging'
|
40
|
+
gem 'rails', '>= 4.2.9', '< 7'
|
40
41
|
end
|
41
42
|
|
42
43
|
group :telemetry do
|
data/Rakefile
CHANGED
data/doc/pages/Gemfile
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
source 'https://rubygems.org'
|
3
4
|
|
4
|
-
gem 'rake'
|
5
5
|
gem 'jekyll'
|
6
6
|
gem 'pry'
|
7
|
+
gem 'pygments.rb'
|
8
|
+
gem 'rake'
|
9
|
+
gem 'redcarpet'
|
7
10
|
gem 'ruby-nuggets' # require by tags plugin
|
8
11
|
gem 'therubyracer'
|
9
|
-
gem 'redcarpet'
|
10
|
-
gem 'pygments.rb'
|
data/doc/pages/Rakefile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
# taken from https://raw.githubusercontent.com/kui/octopress-graphviz/master/graphviz_block.rb
|
3
4
|
|
4
5
|
require 'open3'
|
5
6
|
|
6
7
|
module Jekyll
|
7
8
|
class GraphvizBlock < Liquid::Block
|
8
|
-
|
9
9
|
DIV_CLASS_ATTR = 'graphviz-wrapper'
|
10
10
|
DEFAULT_GRAPH_NAME = 'Graphviz'
|
11
11
|
DOT_OPTS = '-Tsvg'
|
@@ -13,9 +13,9 @@ module Jekyll
|
|
13
13
|
DOT_EXTS = (ENV['PATHEXT'] || '.exe;.bat;.com').split(";")
|
14
14
|
DOT_EXTS.unshift ''
|
15
15
|
DOT_PATH = ENV['PATH'].split(File::PATH_SEPARATOR)
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
.map { |a| File.join a, DOT_EXEC }
|
17
|
+
.map { |a| DOT_EXTS.map { |ex| a + ex } }.flatten
|
18
|
+
.find { |c| File.executable_real? c }
|
19
19
|
raise "not found a executable file: #{DOT_EXEC}" if DOT_PATH.nil?
|
20
20
|
DOT_CMD = "#{DOT_PATH} #{DOT_OPTS}"
|
21
21
|
|
@@ -61,7 +61,7 @@ module Jekyll
|
|
61
61
|
code = add_desc_attrs code
|
62
62
|
code = insert_desc_elements code
|
63
63
|
code = wrap_with_div code
|
64
|
-
code = code.gsub
|
64
|
+
code = code.gsub(/<polygon fill="white" stroke="none"/, '<polygon fill="transparent" stroke="none"')
|
65
65
|
code
|
66
66
|
end
|
67
67
|
|
@@ -89,7 +89,7 @@ module Jekyll
|
|
89
89
|
|
90
90
|
def remove_xmlns_attrs(svg)
|
91
91
|
svg.sub(%[xmlns="http://www.w3.org/2000/svg"], '')
|
92
|
-
|
92
|
+
.sub(%[xmlns:xlink="http://www.w3.org/1999/xlink"], '')
|
93
93
|
end
|
94
94
|
|
95
95
|
def add_desc_attrs(svg)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
# Title: PlantUML Code Blocks for Jekyll
|
3
4
|
# Author: YJ Park (yjpark@gmail.com)
|
4
5
|
# https://github.com/yjpark/jekyll-plantuml
|
@@ -13,7 +14,6 @@ require 'open3'
|
|
13
14
|
require 'fileutils'
|
14
15
|
|
15
16
|
module Jekyll
|
16
|
-
|
17
17
|
class PlantUMLBlock < Liquid::Block
|
18
18
|
attr_reader :config
|
19
19
|
|
@@ -31,7 +31,7 @@ module Jekyll
|
|
31
31
|
if !File.exist?(filepath)
|
32
32
|
plantuml_jar = File.expand_path(plantuml_jar_path)
|
33
33
|
cmd = "java -Djava.awt.headless=true -jar " + plantuml_jar + dot_cmd + " -pipe > " + filepath
|
34
|
-
result, status = Open3.capture2e(cmd, :stdin_data=>code)
|
34
|
+
result, status = Open3.capture2e(cmd, :stdin_data => code)
|
35
35
|
Jekyll.logger.debug(filepath + " -->\t" + status.inspect() + "\t" + result)
|
36
36
|
end
|
37
37
|
|
@@ -79,7 +79,6 @@ module Jekyll
|
|
79
79
|
Jekyll.logger.info("Create PlantUML image folder: " + folderpath)
|
80
80
|
end
|
81
81
|
end
|
82
|
-
|
83
82
|
end # PlantUMLBlock
|
84
83
|
end
|
85
84
|
|
data/doc/pages/plugins/play.rb
CHANGED
data/doc/pages/plugins/tags.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'nuggets/range/quantile'
|
3
4
|
require 'erb'
|
4
5
|
|
5
6
|
module Jekyll
|
6
|
-
|
7
7
|
class Tagger < Generator
|
8
|
-
|
9
8
|
safe true
|
10
9
|
|
11
10
|
attr_accessor :site
|
@@ -44,7 +43,7 @@ module Jekyll
|
|
44
43
|
page_name = "#{pretty? ? 'index' : name}#{site.layouts[data['layout']].ext}"
|
45
44
|
|
46
45
|
site.pages << TagPage.new(
|
47
|
-
|
46
|
+
site, site.source, tag_dir, page_name, data
|
48
47
|
)
|
49
48
|
end
|
50
49
|
}
|
@@ -79,11 +78,9 @@ module Jekyll
|
|
79
78
|
def pretty?
|
80
79
|
@pretty ||= (site.permalink_style == :pretty || site.config['tag_permalink_style'] == 'pretty')
|
81
80
|
end
|
82
|
-
|
83
81
|
end
|
84
82
|
|
85
83
|
class TagPage < Page
|
86
|
-
|
87
84
|
def initialize(site, base, dir, name, data = {})
|
88
85
|
self.content = data.delete('content') || ''
|
89
86
|
self.data = data
|
@@ -94,11 +91,9 @@ module Jekyll
|
|
94
91
|
def read_yaml(*)
|
95
92
|
# Do nothing
|
96
93
|
end
|
97
|
-
|
98
94
|
end
|
99
95
|
|
100
96
|
module Filters
|
101
|
-
|
102
97
|
def tag_cloud(site)
|
103
98
|
active_tag_data.map { |tag, set|
|
104
99
|
tag_link(tag, tag_url(tag), :class => "set-#{set} label label-default")
|
@@ -134,5 +129,4 @@ module Jekyll
|
|
134
129
|
site.config["tag_data"].reject { |tag, set| site.config["ignored_tags"].include? tag }
|
135
130
|
end
|
136
131
|
end
|
137
|
-
|
138
132
|
end
|
data/doc/pages/plugins/toc.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Jekyll
|
3
4
|
module FancyToCFilter
|
4
5
|
def fancytoc(input)
|
5
|
-
|
6
6
|
converter = @context.registers[:site].converters.find { |c| c.is_a? Jekyll::Converters::Markdown }
|
7
7
|
extensions = converter.instance_variable_get(:@parser).instance_variable_get(:@redcarpet_extensions)
|
8
8
|
toc_generator = Redcarpet::Markdown.new(Redcarpet::Render::HTML_TOC, extensions)
|
data/dynflow.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
# frozen_string_literal: true
|
3
|
+
|
3
4
|
$:.push File.expand_path("../lib", __FILE__)
|
4
5
|
require "dynflow/version"
|
5
6
|
|
@@ -17,24 +18,24 @@ Gem::Specification.new do |s|
|
|
17
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
19
|
s.require_paths = ["lib"]
|
19
20
|
|
20
|
-
s.required_ruby_version = '>= 2.
|
21
|
+
s.required_ruby_version = '>= 2.7.0'
|
21
22
|
|
22
|
-
s.add_dependency "multi_json"
|
23
|
-
s.add_dependency "msgpack", '~> 1.3', '>= 1.3.3'
|
24
|
-
s.add_dependency "apipie-params"
|
25
23
|
s.add_dependency "algebrick", '~> 0.7.0'
|
24
|
+
s.add_dependency "apipie-params"
|
26
25
|
s.add_dependency "concurrent-ruby", '~> 1.1.3'
|
27
26
|
s.add_dependency "concurrent-ruby-edge", '~> 0.6.0'
|
27
|
+
s.add_dependency "msgpack", '~> 1.3', '>= 1.3.3'
|
28
|
+
s.add_dependency "multi_json"
|
28
29
|
s.add_dependency "sequel", '>= 4.0.0'
|
29
30
|
|
30
|
-
s.add_development_dependency
|
31
|
-
s.add_development_dependency "
|
31
|
+
s.add_development_dependency 'activejob'
|
32
|
+
s.add_development_dependency "activerecord"
|
32
33
|
s.add_development_dependency "minitest", "< 5.19"
|
33
34
|
s.add_development_dependency "minitest-reporters"
|
34
35
|
s.add_development_dependency "minitest-stub-const"
|
35
|
-
s.add_development_dependency "activerecord"
|
36
|
-
s.add_development_dependency 'activejob'
|
37
|
-
s.add_development_dependency "sqlite3"
|
38
|
-
s.add_development_dependency "sinatra"
|
39
36
|
s.add_development_dependency 'mocha'
|
37
|
+
s.add_development_dependency "rack-test"
|
38
|
+
s.add_development_dependency "rake"
|
39
|
+
s.add_development_dependency "sinatra"
|
40
|
+
s.add_development_dependency "sqlite3"
|
40
41
|
end
|
data/examples/clock_benchmark.rb
CHANGED
data/examples/example_helper.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
$:.unshift(File.expand_path('../../lib', __FILE__))
|
3
4
|
|
4
5
|
require 'dynflow'
|
5
6
|
|
6
7
|
class ExampleHelper
|
7
|
-
CONSOLE_URL='http://localhost:4567'
|
8
|
-
DYNFLOW_URL="#{CONSOLE_URL}/dynflow"
|
9
|
-
SIDEKIQ_URL="#{CONSOLE_URL}/sidekiq"
|
8
|
+
CONSOLE_URL = 'http://localhost:4567'
|
9
|
+
DYNFLOW_URL = "#{CONSOLE_URL}/dynflow"
|
10
|
+
SIDEKIQ_URL = "#{CONSOLE_URL}/sidekiq"
|
10
11
|
|
11
12
|
class << self
|
12
13
|
def world
|
@@ -25,7 +25,6 @@ class CustomPassedObjectSerializer < ::Dynflow::Serializers::Abstract
|
|
25
25
|
end
|
26
26
|
|
27
27
|
class DelayedAction < Dynflow::Action
|
28
|
-
|
29
28
|
def delay(delay_options, *args)
|
30
29
|
CustomPassedObjectSerializer.new(args)
|
31
30
|
end
|
@@ -36,7 +35,6 @@ class DelayedAction < Dynflow::Action
|
|
36
35
|
|
37
36
|
def run
|
38
37
|
end
|
39
|
-
|
40
38
|
end
|
41
39
|
|
42
40
|
if $0 == __FILE__
|
@@ -3,14 +3,14 @@
|
|
3
3
|
|
4
4
|
require_relative 'example_helper'
|
5
5
|
|
6
|
-
example_description =
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
In this example we are setting a watcher that will terminate our world object
|
11
|
-
when process memory consumption exceeds a limit that will be set.
|
12
|
-
|
13
|
-
|
6
|
+
example_description = <<~DESC
|
7
|
+
Memory limit watcher Example
|
8
|
+
===========================
|
9
|
+
|
10
|
+
In this example we are setting a watcher that will terminate our world object
|
11
|
+
when process memory consumption exceeds a limit that will be set.
|
12
|
+
|
13
|
+
|
14
14
|
DESC
|
15
15
|
|
16
16
|
module MemorylimiterExample
|
data/examples/orchestrate.rb
CHANGED
@@ -24,9 +24,7 @@ DESC
|
|
24
24
|
require_relative 'example_helper'
|
25
25
|
|
26
26
|
module Orchestrate
|
27
|
-
|
28
27
|
class CreateInfrastructure < Dynflow::Action
|
29
|
-
|
30
28
|
def plan
|
31
29
|
sequence do
|
32
30
|
concurrence do
|
@@ -34,26 +32,25 @@ module Orchestrate
|
|
34
32
|
plan_action(CreateMachine, 'host2', 'storage')
|
35
33
|
end
|
36
34
|
plan_action(CreateMachine,
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
35
|
+
'host3',
|
36
|
+
'web_server',
|
37
|
+
:db_machine => 'host1',
|
38
|
+
:storage_machine => 'host2')
|
41
39
|
end
|
42
40
|
end
|
43
41
|
end
|
44
42
|
|
45
43
|
class CreateMachine < Dynflow::Action
|
46
|
-
|
47
44
|
def plan(name, profile, config_options = {})
|
48
45
|
prepare_disk = plan_action(PrepareDisk, 'name' => name)
|
49
46
|
create_vm = plan_action(CreateVM,
|
50
|
-
|
51
|
-
|
47
|
+
:name => name,
|
48
|
+
:disk => prepare_disk.output['path'])
|
52
49
|
plan_action(AddIPtoHosts, :name => name, :ip => create_vm.output[:ip])
|
53
50
|
plan_action(ConfigureMachine,
|
54
|
-
|
55
|
-
|
56
|
-
|
51
|
+
:ip => create_vm.output[:ip],
|
52
|
+
:profile => profile,
|
53
|
+
:config_options => config_options)
|
57
54
|
plan_self(:name => name)
|
58
55
|
end
|
59
56
|
|
@@ -61,7 +58,6 @@ module Orchestrate
|
|
61
58
|
# this is called after run methods of the actions in the
|
62
59
|
# execution plan were finished
|
63
60
|
end
|
64
|
-
|
65
61
|
end
|
66
62
|
|
67
63
|
class Base < Dynflow::Action
|
@@ -71,7 +67,6 @@ module Orchestrate
|
|
71
67
|
end
|
72
68
|
|
73
69
|
class PrepareDisk < Base
|
74
|
-
|
75
70
|
def queue
|
76
71
|
:slow
|
77
72
|
end
|
@@ -88,11 +83,9 @@ module Orchestrate
|
|
88
83
|
sleep!
|
89
84
|
output[:path] = "/var/images/#{input[:name]}.img"
|
90
85
|
end
|
91
|
-
|
92
86
|
end
|
93
87
|
|
94
88
|
class CreateVM < Base
|
95
|
-
|
96
89
|
input_format do
|
97
90
|
param :name
|
98
91
|
param :disk
|
@@ -106,11 +99,9 @@ module Orchestrate
|
|
106
99
|
sleep!
|
107
100
|
output[:ip] = "192.168.100.#{rand(256)}"
|
108
101
|
end
|
109
|
-
|
110
102
|
end
|
111
103
|
|
112
104
|
class AddIPtoHosts < Base
|
113
|
-
|
114
105
|
input_format do
|
115
106
|
param :ip
|
116
107
|
end
|
@@ -118,11 +109,9 @@ module Orchestrate
|
|
118
109
|
def run
|
119
110
|
sleep!
|
120
111
|
end
|
121
|
-
|
122
112
|
end
|
123
113
|
|
124
114
|
class ConfigureMachine < Base
|
125
|
-
|
126
115
|
input_format do
|
127
116
|
param :ip
|
128
117
|
param :profile
|
@@ -144,7 +133,6 @@ module Orchestrate
|
|
144
133
|
|
145
134
|
sleep!
|
146
135
|
end
|
147
|
-
|
148
136
|
end
|
149
137
|
end
|
150
138
|
|
@@ -24,9 +24,7 @@ example_description = <<DESC
|
|
24
24
|
DESC
|
25
25
|
|
26
26
|
module OrchestrateEvented
|
27
|
-
|
28
27
|
class CreateInfrastructure < Dynflow::Action
|
29
|
-
|
30
28
|
def plan(get_stuck = false)
|
31
29
|
sequence do
|
32
30
|
concurrence do
|
@@ -34,59 +32,54 @@ module OrchestrateEvented
|
|
34
32
|
plan_action(CreateMachine, 'host2', 'storage')
|
35
33
|
end
|
36
34
|
plan_action(CreateMachine,
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
35
|
+
'host3',
|
36
|
+
'web_server',
|
37
|
+
:db_machine => 'host1',
|
38
|
+
:storage_machine => 'host2')
|
41
39
|
end
|
42
40
|
end
|
43
41
|
end
|
44
42
|
|
45
43
|
class CreateMachine < Dynflow::Action
|
46
|
-
|
47
44
|
def plan(name, profile, config_options = {})
|
48
45
|
prepare_disk = plan_action(PrepareDisk, 'name' => name)
|
49
46
|
create_vm = plan_action(CreateVM,
|
50
|
-
|
51
|
-
|
47
|
+
:name => name,
|
48
|
+
:disk => prepare_disk.output['path'])
|
52
49
|
plan_action(AddIPtoHosts, :name => name, :ip => create_vm.output[:ip])
|
53
50
|
plan_action(ConfigureMachine,
|
54
|
-
|
55
|
-
|
56
|
-
|
51
|
+
:ip => create_vm.output[:ip],
|
52
|
+
:profile => profile,
|
53
|
+
:config_options => config_options)
|
57
54
|
plan_self(:name => name)
|
58
55
|
end
|
59
56
|
|
60
57
|
def finalize
|
61
58
|
end
|
62
|
-
|
63
59
|
end
|
64
60
|
|
65
61
|
class Base < Dynflow::Action
|
66
|
-
|
67
62
|
Finished = Algebrick.atom
|
68
63
|
|
69
64
|
def run(event = nil)
|
70
65
|
match(event,
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
66
|
+
(on Finished do
|
67
|
+
on_finish
|
68
|
+
end),
|
69
|
+
(on Dynflow::Action::Skip do
|
70
|
+
# do nothing
|
71
|
+
end),
|
72
|
+
(on nil do
|
73
|
+
suspend { |suspended_action| world.clock.ping suspended_action, rand(1), Finished }
|
74
|
+
end))
|
80
75
|
end
|
81
76
|
|
82
77
|
def on_finish
|
83
78
|
raise NotImplementedError
|
84
79
|
end
|
85
|
-
|
86
80
|
end
|
87
81
|
|
88
82
|
class PrepareDisk < Base
|
89
|
-
|
90
83
|
input_format do
|
91
84
|
param :name
|
92
85
|
end
|
@@ -98,11 +91,9 @@ module OrchestrateEvented
|
|
98
91
|
def on_finish
|
99
92
|
output[:path] = "/var/images/#{input[:name]}.img"
|
100
93
|
end
|
101
|
-
|
102
94
|
end
|
103
95
|
|
104
96
|
class CreateVM < Base
|
105
|
-
|
106
97
|
input_format do
|
107
98
|
param :name
|
108
99
|
param :disk
|
@@ -115,22 +106,18 @@ module OrchestrateEvented
|
|
115
106
|
def on_finish
|
116
107
|
output[:ip] = "192.168.100.#{rand(256)}"
|
117
108
|
end
|
118
|
-
|
119
109
|
end
|
120
110
|
|
121
111
|
class AddIPtoHosts < Base
|
122
|
-
|
123
112
|
input_format do
|
124
113
|
param :ip
|
125
114
|
end
|
126
115
|
|
127
116
|
def on_finish
|
128
117
|
end
|
129
|
-
|
130
118
|
end
|
131
119
|
|
132
120
|
class ConfigureMachine < Base
|
133
|
-
|
134
121
|
# thanks to this Dynflow knows this action can be politely
|
135
122
|
# asked to get canceled
|
136
123
|
include ::Dynflow::Action::Cancellable
|
@@ -163,9 +150,7 @@ module OrchestrateEvented
|
|
163
150
|
suspend
|
164
151
|
end
|
165
152
|
end
|
166
|
-
|
167
153
|
end
|
168
|
-
|
169
154
|
end
|
170
155
|
|
171
156
|
if $0 == __FILE__
|
data/examples/remote_executor.rb
CHANGED
@@ -45,7 +45,6 @@ end
|
|
45
45
|
|
46
46
|
class RemoteExecutorExample
|
47
47
|
class << self
|
48
|
-
|
49
48
|
def run_observer
|
50
49
|
world = ExampleHelper.create_world do |config|
|
51
50
|
config.persistence_adapter = persistence_adapter
|
@@ -136,7 +135,6 @@ class RemoteExecutorExample
|
|
136
135
|
sleep 0.5
|
137
136
|
end
|
138
137
|
end
|
139
|
-
|
140
138
|
end
|
141
139
|
end
|
142
140
|
|
@@ -145,17 +143,17 @@ command = ARGV.first || 'server'
|
|
145
143
|
if $0 == __FILE__
|
146
144
|
case command
|
147
145
|
when 'observer'
|
148
|
-
puts
|
149
|
-
The observer starting…. You can see what's going on there
|
150
|
-
MSG
|
146
|
+
puts <<~MSG
|
147
|
+
The observer starting…. You can see what's going on there
|
148
|
+
MSG
|
151
149
|
RemoteExecutorExample.run_observer
|
152
150
|
when 'server'
|
153
|
-
puts
|
154
|
-
The server is starting…. You can send the work to it by running:
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
MSG
|
151
|
+
puts <<~MSG
|
152
|
+
The server is starting…. You can send the work to it by running:
|
153
|
+
|
154
|
+
#{$0} client
|
155
|
+
|
156
|
+
MSG
|
159
157
|
RemoteExecutorExample.run_server
|
160
158
|
when 'client'
|
161
159
|
RemoteExecutorExample.run_client
|
data/examples/singletons.rb
CHANGED
data/examples/sub_plans.rb
CHANGED
data/examples/sub_plans_v2.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
module Dynflow
|
3
2
|
|
3
|
+
module Dynflow
|
4
4
|
# Input/output format validation logic calling
|
5
5
|
# input_format/output_format with block acts as a setter for
|
6
6
|
# specifying the format. Without a block it acts as a getter
|
7
7
|
module Action::Format
|
8
|
-
|
9
8
|
# we don't evaluate tbe block immediatelly, but postpone it till all the
|
10
9
|
# action classes are loaded, because we can use them to reference output format
|
11
10
|
def input_format(&block)
|
@@ -41,7 +40,5 @@ module Dynflow
|
|
41
40
|
end
|
42
41
|
end
|
43
42
|
end
|
44
|
-
|
45
43
|
end
|
46
44
|
end
|
47
|
-
|