Class: JobWorkflow::TaskDependencyWait
- Inherits:
-
Object
- Object
- JobWorkflow::TaskDependencyWait
- Defined in:
- lib/job_workflow/task_dependency_wait.rb
Overview
TaskDependencyWait holds configuration for waiting on dependent tasks.
When a task has dependencies (depends_on:), the runner waits for those tasks to complete. This class configures how long to poll before rescheduling the job.
Constant Summary collapse
- DEFAULT_POLL_TIMEOUT =
: Integer
0- DEFAULT_POLL_INTERVAL =
: Integer
5- DEFAULT_RESCHEDULE_DELAY =
: Integer
5
Instance Attribute Summary collapse
-
#poll_interval ⇒ Object
readonly
: Integer.
-
#poll_timeout ⇒ Object
readonly
: Integer.
-
#reschedule_delay ⇒ Object
readonly
: Integer.
Class Method Summary collapse
-
.from_primitive_value(value) ⇒ Object
: (Integer | Hash[Symbol, untyped] | nil) -> TaskDependencyWait.
Instance Method Summary collapse
-
#initialize(poll_timeout: DEFAULT_POLL_TIMEOUT, poll_interval: DEFAULT_POLL_INTERVAL, reschedule_delay: DEFAULT_RESCHEDULE_DELAY) ⇒ TaskDependencyWait
constructor
: (?poll_timeout: Integer, ?poll_interval: Integer, ?reschedule_delay: Integer) -> void.
-
#polling_keep?(started_at) ⇒ Boolean
: (Time) -> bool.
-
#polling_only? ⇒ Boolean
: () -> bool.
Constructor Details
#initialize(poll_timeout: DEFAULT_POLL_TIMEOUT, poll_interval: DEFAULT_POLL_INTERVAL, reschedule_delay: DEFAULT_RESCHEDULE_DELAY) ⇒ TaskDependencyWait
: (?poll_timeout: Integer, ?poll_interval: Integer, ?reschedule_delay: Integer) -> void
45 46 47 48 49 50 51 52 53 |
# File 'lib/job_workflow/task_dependency_wait.rb', line 45 def initialize( poll_timeout: DEFAULT_POLL_TIMEOUT, poll_interval: DEFAULT_POLL_INTERVAL, reschedule_delay: DEFAULT_RESCHEDULE_DELAY ) @poll_timeout = poll_timeout #: Integer @poll_interval = poll_interval #: Integer @reschedule_delay = reschedule_delay #: Integer end |
Instance Attribute Details
#poll_interval ⇒ Object (readonly)
: Integer
23 24 25 |
# File 'lib/job_workflow/task_dependency_wait.rb', line 23 def poll_interval @poll_interval end |
#poll_timeout ⇒ Object (readonly)
: Integer
22 23 24 |
# File 'lib/job_workflow/task_dependency_wait.rb', line 22 def poll_timeout @poll_timeout end |
#reschedule_delay ⇒ Object (readonly)
: Integer
24 25 26 |
# File 'lib/job_workflow/task_dependency_wait.rb', line 24 def reschedule_delay @reschedule_delay end |
Class Method Details
.from_primitive_value(value) ⇒ Object
: (Integer | Hash[Symbol, untyped] | nil) -> TaskDependencyWait
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/job_workflow/task_dependency_wait.rb', line 28 def from_primitive_value(value) case value when Integer new(poll_timeout: value) when Hash new( poll_timeout: value[:poll_timeout] || DEFAULT_POLL_TIMEOUT, poll_interval: value[:poll_interval] || DEFAULT_POLL_INTERVAL, reschedule_delay: value[:reschedule_delay] || DEFAULT_RESCHEDULE_DELAY ) else new end end |
Instance Method Details
#polling_keep?(started_at) ⇒ Boolean
: (Time) -> bool
61 62 63 64 |
# File 'lib/job_workflow/task_dependency_wait.rb', line 61 def polling_keep?(started_at) elapsed = Time.current - started_at elapsed < poll_timeout end |
#polling_only? ⇒ Boolean
: () -> bool
56 57 58 |
# File 'lib/job_workflow/task_dependency_wait.rb', line 56 def polling_only? poll_timeout <= 0 end |