Class: Aidp::Execute::DeterministicUnits::Definition
- Inherits:
-
Object
- Object
- Aidp::Execute::DeterministicUnits::Definition
- Defined in:
- lib/aidp/execute/deterministic_unit.rb
Overview
Represents a deterministic unit configured in aidp.yml. Definitions are immutable and provide helper accessors used by the scheduler.
Constant Summary collapse
- VALID_TYPES =
[:command, :wait].freeze
- NEXT_KEY_ALIASES =
{ if_pass: :success, if_success: :success, if_fail: :failure, if_failure: :failure, if_error: :failure, if_timeout: :timeout, if_wait: :waiting, if_new_item: :event, if_event: :event }.freeze
Instance Attribute Summary collapse
-
#backoff_multiplier ⇒ Object
readonly
Returns the value of attribute backoff_multiplier.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#enabled ⇒ Object
readonly
Returns the value of attribute enabled.
-
#max_backoff_seconds ⇒ Object
readonly
Returns the value of attribute max_backoff_seconds.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#min_interval_seconds ⇒ Object
readonly
Returns the value of attribute min_interval_seconds.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#next_map ⇒ Object
readonly
Returns the value of attribute next_map.
-
#output_file ⇒ Object
readonly
Returns the value of attribute output_file.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #command? ⇒ Boolean
-
#initialize(config) ⇒ Definition
constructor
A new instance of Definition.
- #next_for(result_status, default: nil) ⇒ Object
- #wait? ⇒ Boolean
Constructor Details
#initialize(config) ⇒ Definition
Returns a new instance of Definition.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/aidp/execute/deterministic_unit.rb', line 31 def initialize(config) @name = config.fetch(:name) @type = normalize_type(config[:type]) || default_type_for(config) validate_type! @command = config[:command] @output_file = config[:output_file] @next_map = normalize_next_config(config[:next] || {}) @min_interval_seconds = config.fetch(:min_interval_seconds, 60) @max_backoff_seconds = config.fetch(:max_backoff_seconds, 900) @backoff_multiplier = config.fetch(:backoff_multiplier, 2.0) @enabled = config.fetch(:enabled, true) = config.fetch(:metadata, {}).dup end |
Instance Attribute Details
#backoff_multiplier ⇒ Object (readonly)
Returns the value of attribute backoff_multiplier.
27 28 29 |
# File 'lib/aidp/execute/deterministic_unit.rb', line 27 def backoff_multiplier @backoff_multiplier end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
27 28 29 |
# File 'lib/aidp/execute/deterministic_unit.rb', line 27 def command @command end |
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
27 28 29 |
# File 'lib/aidp/execute/deterministic_unit.rb', line 27 def enabled @enabled end |
#max_backoff_seconds ⇒ Object (readonly)
Returns the value of attribute max_backoff_seconds.
27 28 29 |
# File 'lib/aidp/execute/deterministic_unit.rb', line 27 def max_backoff_seconds @max_backoff_seconds end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
27 28 29 |
# File 'lib/aidp/execute/deterministic_unit.rb', line 27 def end |
#min_interval_seconds ⇒ Object (readonly)
Returns the value of attribute min_interval_seconds.
27 28 29 |
# File 'lib/aidp/execute/deterministic_unit.rb', line 27 def min_interval_seconds @min_interval_seconds end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
27 28 29 |
# File 'lib/aidp/execute/deterministic_unit.rb', line 27 def name @name end |
#next_map ⇒ Object (readonly)
Returns the value of attribute next_map.
27 28 29 |
# File 'lib/aidp/execute/deterministic_unit.rb', line 27 def next_map @next_map end |
#output_file ⇒ Object (readonly)
Returns the value of attribute output_file.
27 28 29 |
# File 'lib/aidp/execute/deterministic_unit.rb', line 27 def output_file @output_file end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
27 28 29 |
# File 'lib/aidp/execute/deterministic_unit.rb', line 27 def type @type end |
Instance Method Details
#command? ⇒ Boolean
46 47 48 |
# File 'lib/aidp/execute/deterministic_unit.rb', line 46 def command? type == :command end |
#next_for(result_status, default: nil) ⇒ Object
54 55 56 |
# File 'lib/aidp/execute/deterministic_unit.rb', line 54 def next_for(result_status, default: nil) next_map[result_status.to_sym] || default || next_map[:else] end |
#wait? ⇒ Boolean
50 51 52 |
# File 'lib/aidp/execute/deterministic_unit.rb', line 50 def wait? type == :wait end |