dipa 0.1.0.pre.1 → 0.1.0.pre.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +77 -49
- data/Rakefile +50 -0
- data/app/models/concerns/dipa/models/agent_state_attributes.rb +24 -0
- data/app/models/concerns/dipa/models/coordinator_state_attributes.rb +24 -0
- data/app/models/concerns/{models/dipa → dipa/models}/dumpable.rb +3 -3
- data/app/models/concerns/{models/dipa → dipa/models}/loadable.rb +4 -4
- data/app/models/concerns/dipa/models/setting_constants.rb +23 -0
- data/app/models/concerns/dipa/models/state_attribute_handling.rb +77 -0
- data/app/models/dipa/agent.rb +14 -13
- data/app/models/dipa/coordinator.rb +32 -19
- data/app/models/dipa/coordinator_options_record.rb +52 -0
- data/app/services/concerns/dipa/services/process_failure_handling.rb +80 -0
- data/app/services/dipa/agent_services/base_service.rb +21 -0
- data/app/services/dipa/agent_services/coordinator_state_service.rb +58 -4
- data/app/services/dipa/agent_services/post_processing_service.rb +5 -3
- data/app/services/dipa/agent_services/processing_service.rb +84 -3
- data/app/services/dipa/agent_services/start_processing_service.rb +6 -4
- data/app/services/dipa/coordinator_services/base_service.rb +21 -0
- data/app/services/dipa/coordinator_services/create_agents_service.rb +7 -5
- data/app/services/dipa/coordinator_services/destroy_service.rb +13 -0
- data/app/services/dipa/coordinator_services/maybe_cleanup_service.rb +20 -0
- data/app/services/dipa/coordinator_services/start_processing_service.rb +6 -4
- data/db/migrate/20220102132652_create_dipa_coordinators.rb +3 -5
- data/db/migrate/20220106183616_create_dipa_agents.rb +3 -3
- data/db/migrate/20230624053724_create_dipa_coordinator_options_record.rb +21 -0
- data/lib/dipa/engine.rb +15 -8
- data/lib/dipa/errors.rb +20 -3
- data/lib/dipa/processor/base.rb +20 -106
- data/lib/dipa/processor/concerns/coordinator.rb +86 -0
- data/lib/dipa/processor/concerns/options.rb +80 -0
- data/lib/dipa/processor/concerns/source.rb +17 -0
- data/lib/dipa/processor/concerns/state.rb +27 -0
- data/lib/dipa/processor/concerns/wait.rb +62 -0
- data/lib/dipa/processor/map.rb +1 -2
- data/lib/dipa/version.rb +3 -1
- data/lib/dipa.rb +18 -0
- metadata +54 -25
- data/app/models/concerns/models/dipa/state_attribute_handling.rb +0 -38
- data/app/models/modules/models/dipa/status_constants.rb +0 -24
- data/lib/tasks/auto_annotate_models.rake +0 -62
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Models
|
4
|
-
module Dipa
|
5
|
-
module StateAttributeHandling
|
6
|
-
extend ActiveSupport::Concern
|
7
|
-
|
8
|
-
include Modules::Models::Dipa::StatusConstants
|
9
|
-
|
10
|
-
included do
|
11
|
-
attribute :state, :string, default: INITIALIZED_STATE
|
12
|
-
|
13
|
-
validates :state, presence: true, inclusion: { in: STATES }
|
14
|
-
if Rails.version >= '7'
|
15
|
-
validates :state, comparison: { equal_to: INITIALIZED_STATE },
|
16
|
-
on: :create
|
17
|
-
else
|
18
|
-
validates :state, inclusion: { in: [INITIALIZED_STATE] },
|
19
|
-
on: :create
|
20
|
-
end
|
21
|
-
|
22
|
-
STATES.each do |state_value|
|
23
|
-
define_method("#{state_value}?".to_sym) do
|
24
|
-
state == state_value
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def started!
|
30
|
-
update!(started_at: Time.zone.now, state: PROCESSING_STATE)
|
31
|
-
end
|
32
|
-
|
33
|
-
def finished!
|
34
|
-
update!(finished_at: Time.zone.now, state: PROCESSED_STATE)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Modules
|
4
|
-
module Models
|
5
|
-
module Dipa
|
6
|
-
module StatusConstants
|
7
|
-
ABORTED_STATE = 'aborted'
|
8
|
-
INITIALIZED_STATE = 'initialized'
|
9
|
-
PROCESSED_STATE = 'processed'
|
10
|
-
PROCESSING_STATE = 'processing'
|
11
|
-
PROCESSING_FAILED_STATE = 'processing_failed'
|
12
|
-
TIMEOUT_STATE = 'timed_out'
|
13
|
-
STATES = [
|
14
|
-
ABORTED_STATE,
|
15
|
-
INITIALIZED_STATE,
|
16
|
-
PROCESSED_STATE,
|
17
|
-
PROCESSING_STATE,
|
18
|
-
PROCESSING_FAILED_STATE,
|
19
|
-
TIMEOUT_STATE
|
20
|
-
].freeze
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# NOTE: only doing this in development as some production environments (Heroku)
|
4
|
-
# NOTE: are sensitive to local FS writes, and besides -- it's just not proper
|
5
|
-
# NOTE: to have a dev-mode tool do its thing in production.
|
6
|
-
if Rails.env.development?
|
7
|
-
require 'annotate'
|
8
|
-
desc 'annotate'
|
9
|
-
task set_annotation_options: :environment do # rubocop:disable Metrics/BlockLength
|
10
|
-
# You can override any of these by setting an environment variable of the
|
11
|
-
# same name.
|
12
|
-
Annotate.set_defaults(
|
13
|
-
'active_admin' => 'false',
|
14
|
-
'additional_file_patterns' => [],
|
15
|
-
'routes' => 'false',
|
16
|
-
'models' => 'true',
|
17
|
-
'position_in_routes' => 'before',
|
18
|
-
'position_in_class' => 'before',
|
19
|
-
'position_in_test' => 'before',
|
20
|
-
'position_in_fixture' => 'before',
|
21
|
-
'position_in_factory' => 'before',
|
22
|
-
'position_in_serializer' => 'before',
|
23
|
-
'show_foreign_keys' => 'true',
|
24
|
-
'show_complete_foreign_keys' => 'false',
|
25
|
-
'show_indexes' => 'true',
|
26
|
-
'simple_indexes' => 'false',
|
27
|
-
'model_dir' => 'app/models',
|
28
|
-
'root_dir' => '',
|
29
|
-
'include_version' => 'false',
|
30
|
-
'require' => '',
|
31
|
-
'exclude_tests' => 'true',
|
32
|
-
'exclude_fixtures' => 'true',
|
33
|
-
'exclude_factories' => 'false',
|
34
|
-
'exclude_serializers' => 'false',
|
35
|
-
'exclude_scaffolds' => 'true',
|
36
|
-
'exclude_controllers' => 'true',
|
37
|
-
'exclude_helpers' => 'true',
|
38
|
-
'exclude_sti_subclasses' => 'false',
|
39
|
-
'ignore_model_sub_dir' => 'false',
|
40
|
-
'ignore_columns' => nil,
|
41
|
-
'ignore_routes' => nil,
|
42
|
-
'ignore_unknown_models' => 'false',
|
43
|
-
'hide_limit_column_types' => 'integer,bigint,boolean',
|
44
|
-
'hide_default_column_types' => 'json,jsonb,hstore',
|
45
|
-
'skip_on_db_migrate' => 'false',
|
46
|
-
'format_bare' => 'true',
|
47
|
-
'format_rdoc' => 'false',
|
48
|
-
'format_yard' => 'false',
|
49
|
-
'format_markdown' => 'false',
|
50
|
-
'sort' => 'true',
|
51
|
-
'force' => 'false',
|
52
|
-
'frozen' => 'false',
|
53
|
-
'classified_sort' => 'true',
|
54
|
-
'trace' => 'false',
|
55
|
-
'wrapper_open' => nil,
|
56
|
-
'wrapper_close' => nil,
|
57
|
-
'with_comment' => 'true'
|
58
|
-
)
|
59
|
-
end
|
60
|
-
|
61
|
-
Annotate.load_tasks
|
62
|
-
end
|