Class: RescheduleTasksForMissingRunners
- Inherits:
-
Object
- Object
- RescheduleTasksForMissingRunners
- Defined in:
- app/services/reschedule_tasks_for_missing_runners.rb
Instance Attribute Summary collapse
-
#runner_ids ⇒ Object
readonly
Returns the value of attribute runner_ids.
-
#started_tasks ⇒ Object
readonly
Returns the value of attribute started_tasks.
Instance Method Summary collapse
-
#initialize(runner_ids:, started_tasks:) ⇒ RescheduleTasksForMissingRunners
constructor
A new instance of RescheduleTasksForMissingRunners.
- #perform ⇒ Object
Constructor Details
#initialize(runner_ids:, started_tasks:) ⇒ RescheduleTasksForMissingRunners
Returns a new instance of RescheduleTasksForMissingRunners.
6 7 8 9 |
# File 'app/services/reschedule_tasks_for_missing_runners.rb', line 6 def initialize(runner_ids:, started_tasks:) @started_tasks = started_tasks @runner_ids = runner_ids end |
Instance Attribute Details
#runner_ids ⇒ Object (readonly)
Returns the value of attribute runner_ids.
4 5 6 |
# File 'app/services/reschedule_tasks_for_missing_runners.rb', line 4 def runner_ids @runner_ids end |
#started_tasks ⇒ Object (readonly)
Returns the value of attribute started_tasks.
4 5 6 |
# File 'app/services/reschedule_tasks_for_missing_runners.rb', line 4 def started_tasks @started_tasks end |
Instance Method Details
#perform ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/services/reschedule_tasks_for_missing_runners.rb', line 11 def perform tasks_without_runner.each do |runner_id| task = started_tasks_group_by_runner_id[runner_id] = "Task retryied because runner #{runner_id} is missing (#{task} #{task&.slot})" Rails.logger.debug() report_event(message: , task: task, runner_id: runner_id) slot = task.slot task.mark_as_retry(error: ) slot&.release end end |